Skip to content

[2.4.0] test_crop_by_extra_coords_values_all_axes_with_coord fails during build time #913

@olebole

Description

@olebole

Describe the bug

When running pytest during package build, I see the following failure:

_____________ test_crop_by_extra_coords_values_all_axes_with_coord _____________

ndcube_3d_ln_lt_l_ec_all_axes = <ndcube.ndcube.NDCube object at 0x7fdac83fdb30>
NDCube
------
Shape: (2, 3, 4)
Physical Types of Axes: [('custom:pos.h...ive.lat', 'custom:pos.helioprojective.lon', 'custom:PIXEL'), ('em.wl', 'custom:SPATIAL')]
Unit: None
Data Type: float64

    def test_crop_by_extra_coords_values_all_axes_with_coord(ndcube_3d_ln_lt_l_ec_all_axes):
        cube = ndcube_3d_ln_lt_l_ec_all_axes
        interval0 = [3 * 60 * 60, 8 * 60 * 60] * u.s
        interval1 = [0, 1] * u.pix
        interval2 = [1, 3] * u.m
        lower_corner = (interval0[0], interval1[0], interval2[0])
        upper_corner = (interval0[1], interval1[1], interval2[1])
>       output = cube.crop_by_values(lower_corner, upper_corner, wcs=cube.extra_coords)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

../../../ndcube/tests/test_ndcube_slice_and_crop.py:483: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../ndcube/ndcube.py:658: in crop_by_values
    item = self._get_crop_by_values_item(*points, units=units, wcs=wcs, keepdims=keepdims)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/utils/cube.py:58: in wcs_wrapper
    return func(*params.args, **params.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/ndcube.py:695: in _get_crop_by_values_item
    return utils.cube.get_crop_item_from_points(points, wcs, True, keepdims=keepdims,
../../../ndcube/utils/cube.py:184: in get_crop_item_from_points
    point_pixel_indices = (sliced_wcs.world_to_pixel_values(*sliced_point) if crop_by_values
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/wcs/wrappers/compound_wcs.py:127: in world_to_pixel_values
    pixel_arrays_sub = w.world_to_pixel_values(*world_arrays_sub)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gwcs/api.py:121: in world_to_pixel_values
    result = self.invert(*world_arrays)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gwcs/wcs/_wcs.py:351: in invert
    if is_high_level(*args, low_level_wcs=self):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

low_level_wcs = <WCS(output_frame=CompositeFrame, input_frame=Frame-8546, forward_transform=Model: CompoundModel
Inputs: ('x0', 'x1', ... 2.] pix)>

    [2]: <Tabular1D(points=(<Quantity [0., 1., 2., 3.] pix>,), lookup_table=[0. 1. 2. 3.] m)>
Parameters:)>
args = (<Quantity 10800. s>, <Quantity 0. pix>, <Quantity 1. m>)

    def is_high_level(*args, low_level_wcs):
        """
        Determine if args matches the high level classes as defined by
        ``low_level_wcs``.
        """
        if len(args) != len(low_level_wcs.world_axis_object_classes):
            return False
    
        type_match = [
            (type(arg), waoc[0])
            for arg, waoc in zip(
                args, low_level_wcs.world_axis_object_classes.values(), strict=False
            )
        ]
    
        types_are_high_level = [argt is t for argt, t in type_match]
    
        if all(types_are_high_level):
            return True
    
        if any(types_are_high_level):
            msg = (
                "Invalid types were passed, got "
                f"({', '.join(tm[0].__name__ for tm in type_match)}) expected "
                f"({', '.join(tm[1].__name__ for tm in type_match)})."
            )
>           raise TypeError(msg)
E           TypeError: Invalid types were passed, got (Quantity, Quantity, Quantity) expected (Time, Quantity, Quantity).

/usr/lib/python3/dist-packages/gwcs/utils.py:508: TypeError

System Details

  • Python 3.13 and 3.14
  • asdf 5.1.0
  • asdf-standard 1.4.0
  • asdf-transform-schemas 0.6.0
  • asdf-coordinates-schemas 0.4.0
  • asdf-wcs-schemas 0.5.0
  • asdf-astropy 0.9.0

All dependencies are from Debian testing.

Installation method

From github, while building a .deb package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugProbably a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions