diff --git a/CHANGES.rst b/CHANGES.rst index fe803f74..6f0cce2a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,8 @@ - Add ``gwcs.examples`` module, based on the examples located in the testing ``conftest.py``. [#521] +- Force ``bounding_box`` to always be returned as a ``F`` ordered box. [#522] + 0.21.0 (2024-03-10) ------------------- diff --git a/docs/gwcs/using_wcs.rst b/docs/gwcs/using_wcs.rst index 1e051523..c3ff9d26 100644 --- a/docs/gwcs/using_wcs.rst +++ b/docs/gwcs/using_wcs.rst @@ -74,6 +74,39 @@ Calling the :meth:`~gwcs.WCS.footprint` returns the footprint on the sky. ... [ 5.63010439, -72.05426843], ... [ 5.610708 , -72.04173847]]) +.. warning:: + + GWCS and astropy default to different tuple ordering conventions for representing + multi-dimensional bounding boxes. + + * GWCS uses the ``"F"`` ordering convention, where the tuples are ordered + ``((x0min, x0max), (x1min, x1max), ..., (xnmin, xnmax))`` (x,y,z ordering). + * While astropy uses the ``"C"`` ordering convention, where tuples are ordered + ``((xnmin, xnmax), ..., (x1min, x1max), (x0min, x0max))`` (z, y, x ordering). + + This means that given the same tuple of tuples, say ``((a, b), (c, d))``, setting + the bounding box on the transform prior to creating the GWCS will result in a + different bounding box than if one sets the same tuple of tuples on the GWCS object + itself. Indeed, in this case the former will assume ``(c, d)`` is the bounding box + for ``x`` while the latter will assume ``(a, b)`` is the bounding box for ``x``. + + It is recommended that when working on GWCS objects that one sets the bounding + box on the GWCS object itself, rather than on the transform prior to creating + the GWCS object. + + Note if one wants to set the bounding box on the transform itself + rather than the GWCS object then it should be done with + `~astropy.modeling.bind_bounding_box` with the ``order`` argument properly set. + + +.. note :: + + The GWCS will always convert or assume the bounding box to the ``"F"`` ordering + convention when setting the bounding box on the GWCS object itself and will + perform this conversion on the first access to the bounding box through the GWCS + object. If conversion occurs on first access, GWCS will issue a warning to alert + the user that the bounding box has been converted. + Manipulating Transforms ----------------------- diff --git a/gwcs/examples.py b/gwcs/examples.py index 5d74fd74..8e3b3e36 100644 --- a/gwcs/examples.py +++ b/gwcs/examples.py @@ -239,7 +239,6 @@ def gwcs_3d_galactic_spectral(): wave_model = models.Shift(-crpix2) | models.Multiply(cdelt2) | models.Shift(crval2) transform = models.Mapping((2, 0, 1)) | celestial & wave_model | models.Mapping((1, 2, 0)) - transform.bounding_box = ((5, 50), (-2, 45), (-1, 35)) sky_frame = cf.CelestialFrame(axes_order=(2, 0), reference_frame=coord.Galactic(), axes_names=("Longitude", "Latitude")) @@ -253,6 +252,7 @@ def gwcs_3d_galactic_spectral(): unit=(u.pix, u.pix, u.pix)) owcs = wcs.WCS(forward_transform=transform, output_frame=frame, input_frame=detector_frame) + owcs.bounding_box = ((-1, 35), (-2, 45), (5, 50)) owcs.array_shape = (30, 20, 10) owcs.pixel_shape = (10, 20, 30) diff --git a/gwcs/tests/data/miri_lrs_wcs.asdf b/gwcs/tests/data/miri_lrs_wcs.asdf index 48d0e44d..e5fe5bbd 100644 --- a/gwcs/tests/data/miri_lrs_wcs.asdf +++ b/gwcs/tests/data/miri_lrs_wcs.asdf @@ -3,97 +3,57 @@ %YAML 1.1 %TAG ! tag:stsci.edu:asdf/ --- !core/asdf-1.1.0 -asdf_library: !core/software-1.0.0 {author: Space Telescope Science Institute, homepage: 'http://github.com/spacetelescope/asdf', - name: asdf, version: 2.6.0} +asdf_library: !core/software-1.0.0 {author: The ASDF Developers, homepage: 'http://github.com/asdf-format/asdf', + name: asdf, version: 3.5.0} history: extensions: - !core/extension_metadata-1.0.0 - extension_class: asdf.extension.BuiltinExtension - software: !core/software-1.0.0 {name: asdf, version: 2.6.0} + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/core/extensions/core-1.5.0 + manifest_software: !core/software-1.0.0 {name: asdf_standard, version: 1.1.1} + software: !core/software-1.0.0 {name: asdf, version: 3.5.0} - !core/extension_metadata-1.0.0 - extension_class: gwcs.extension.GWCSExtension - software: !core/software-1.0.0 {name: gwcs, version: 0.13.1.dev16+g71f9b60} -wcs: ! + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://astropy.org/astropy/extensions/units-1.0.0 + software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} + - !core/extension_metadata-1.0.0 + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/astronomy/gwcs/extensions/gwcs-1.2.0 + manifest_software: !core/software-1.0.0 {name: asdf_wcs_schemas, version: 0.4.0} + software: !core/software-1.0.0 {name: gwcs, version: 0.22.0a1.dev14+gc46e932} + - !core/extension_metadata-1.0.0 + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/astronomy/coordinates/extensions/coordinates-1.0.0 + manifest_software: !core/software-1.0.0 {name: asdf_coordinates_schemas, version: 0.3.0} + software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} + - !core/extension_metadata-1.0.0 + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/transform/extensions/transform-1.5.0 + manifest_software: !core/software-1.0.0 {name: asdf_transform_schemas, version: 0.5.0} + software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} +wcs: ! name: '' + pixel_shape: null steps: - - ! + - ! frame: ! axes_names: [x, y] axes_order: [0, 1] axis_physical_types: ['custom:x', 'custom:y'] name: detector - unit: [!unit/unit-1.0.0 'pixel', !unit/unit-1.0.0 'pixel'] + unit: [!unit/unit-1.0.0 pixel, !unit/unit-1.0.0 pixel] transform: !transform/compose-1.2.0 - bounding_box: - - [6.5, 396.5] - - [302.5, 346.5] - bounds: - amplitude_7: [null, null] - angle_22: [null, null] - angle_3: [null, null] - c0_0_13: [null, null] - c0_0_14: [null, null] - c0_0_16: [null, null] - c0_0_17: [null, null] - c0_10: [null, null] - c0_11: [null, null] - c0_1_13: [null, null] - c0_1_14: [null, null] - c0_1_16: [null, null] - c0_1_17: [null, null] - c0_2_13: [null, null] - c0_2_14: [null, null] - c0_3_13: [null, null] - c0_3_14: [null, null] - c0_4_13: [null, null] - c0_4_14: [null, null] - c1_0_13: [null, null] - c1_0_14: [null, null] - c1_0_16: [null, null] - c1_0_17: [null, null] - c1_10: [null, null] - c1_11: [null, null] - c1_1_13: [null, null] - c1_1_14: [null, null] - c1_2_13: [null, null] - c1_2_14: [null, null] - c1_3_13: [null, null] - c1_3_14: [null, null] - c2_0_13: [null, null] - c2_0_14: [null, null] - c2_1_13: [null, null] - c2_1_14: [null, null] - c2_2_13: [null, null] - c2_2_14: [null, null] - c3_0_13: [null, null] - c3_0_14: [null, null] - c3_1_13: [null, null] - c3_1_14: [null, null] - c4_0_13: [null, null] - c4_0_14: [null, null] - offset_1: [null, null] - offset_2: [null, null] - offset_20: [null, null] - offset_21: [null, null] - offset_4: [null, null] - offset_5: [null, null] - offset_8: [null, null] - fixed: {amplitude_7: false, angle_22: false, angle_3: false, c0_0_13: false, - c0_0_14: false, c0_0_16: false, c0_0_17: false, c0_10: false, c0_11: false, - c0_1_13: false, c0_1_14: false, c0_1_16: false, c0_1_17: false, c0_2_13: false, - c0_2_14: false, c0_3_13: false, c0_3_14: false, c0_4_13: false, c0_4_14: false, - c1_0_13: false, c1_0_14: false, c1_0_16: false, c1_0_17: false, c1_10: false, - c1_11: false, c1_1_13: false, c1_1_14: false, c1_2_13: false, c1_2_14: false, - c1_3_13: false, c1_3_14: false, c2_0_13: false, c2_0_14: false, c2_1_13: false, - c2_1_14: false, c2_2_13: false, c2_2_14: false, c3_0_13: false, c3_0_14: false, - c3_1_13: false, c3_1_14: false, c4_0_13: false, c4_0_14: false, offset_1: false, - offset_2: false, offset_20: false, offset_21: false, offset_4: false, offset_5: false, - offset_8: false} + bounding_box: !transform/property/bounding_box-1.0.0 + ignore: [] + intervals: + x0: [302.5, 346.5] + x1: [6.5, 396.5] + order: F forward: - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] - !transform/concatenate-1.2.0 forward: - !transform/compose-1.2.0 @@ -103,51 +63,54 @@ wcs: ! - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: &id001 [null, null] - fixed: {offset: false} + inputs: [x] offset: -325.13 + outputs: [y] - !transform/shift-1.2.0 - bounds: - offset: *id001 - fixed: {offset: false} + inputs: [x] offset: -299.7 - - !transform/rotate2d-1.2.0 + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] + - !transform/rotate2d-1.3.0 angle: 0.24155757363306068 - bounds: - angle: &id002 [null, null] - fixed: {angle: false} + inputs: [x, y] + outputs: [x, y] + inputs: [x0, x1] + outputs: [x, y] - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: *id001 - fixed: {offset: false} + inputs: [x] offset: 325.13 + outputs: [y] - !transform/shift-1.2.0 - bounds: - offset: *id001 - fixed: {offset: false} + inputs: [x] offset: 299.7 + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/identity-1.2.0 - bounds: {} - fixed: {} - - !transform/constant-1.2.0 - bounds: - amplitude: [null, null] - fixed: {amplitude: false} - inverse: !transform/constant-1.2.0 - bounds: - amplitude: [null, null] - fixed: {amplitude: false} + inputs: [x0] + outputs: [x0] + - !transform/constant-1.4.0 + dimensions: 1 + inputs: [x] + inverse: !transform/constant-1.4.0 + dimensions: 1 + inputs: [x] + outputs: [y] value: 299.7 + outputs: [y] value: 299.7 + inputs: [x0, x] + outputs: [x0, y] - !transform/compose-1.2.0 forward: - !transform/compose-1.2.0 @@ -165,92 +128,75 @@ wcs: ! - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: *id001 - fixed: {offset: false} + inputs: [x] offset: -4.0 + outputs: [y] - !transform/identity-1.2.0 - bounds: {} - fixed: {} + inputs: [x0] + outputs: [x0] + inputs: [x, x0] + outputs: [y, x0] - !transform/concatenate-1.2.0 forward: - !transform/polynomial-1.2.0 - bounds: - c0: [null, null] - c1: [null, null] coefficients: !core/ndarray-1.0.0 source: 0 datatype: float64 byteorder: little shape: [2] domain: [-1, 1] - fixed: {c0: false, c1: false} + inputs: [x] inverse: !transform/polynomial-1.2.0 - bounds: - c0: [null, null] - c1: [null, null] coefficients: !core/ndarray-1.0.0 source: 1 datatype: float64 byteorder: little shape: [2] domain: [-1, 1] - fixed: {c0: false, c1: false} + inputs: [x] + outputs: [y] window: [-1, 1] name: M_column_correction + outputs: [y] window: [-1, 1] - !transform/polynomial-1.2.0 - bounds: - c0: [null, null] - c1: [null, null] coefficients: !core/ndarray-1.0.0 source: 2 datatype: float64 byteorder: little shape: [2] domain: [-1, 1] - fixed: {c0: false, c1: false} + inputs: [x] inverse: !transform/polynomial-1.2.0 - bounds: - c0: [null, null] - c1: [null, null] coefficients: !core/ndarray-1.0.0 source: 3 datatype: float64 byteorder: little shape: [2] domain: [-1, 1] - fixed: {c0: false, c1: false} + inputs: [x] + outputs: [y] window: [-1, 1] name: M_row_correction + outputs: [y] window: [-1, 1] - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + inputs: [x0, x1] + outputs: [y0, y1] + inputs: [x, x0] + outputs: [y0, y1] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] inverse: !transform/identity-1.2.0 - bounds: {} - fixed: {} + inputs: [x0, x1] n_dims: 2 + outputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] + inputs: [x, x0] + outputs: [x0, x1, x2, x3] - !transform/concatenate-1.2.0 forward: - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c0_2: [null, null] - c0_3: [null, null] - c0_4: [null, null] - c1_0: [null, null] - c1_1: [null, null] - c1_2: [null, null] - c1_3: [null, null] - c2_0: [null, null] - c2_1: [null, null] - c2_2: [null, null] - c3_0: [null, null] - c3_1: [null, null] - c4_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 4 datatype: float64 @@ -259,27 +205,8 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c0_2: false, c0_3: false, - c0_4: false, c1_0: false, c1_1: false, c1_2: false, - c1_3: false, c2_0: false, c2_1: false, c2_2: false, - c3_0: false, c3_1: false, c4_0: false} + inputs: [x, y] inverse: !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c0_2: [null, null] - c0_3: [null, null] - c0_4: [null, null] - c1_0: [null, null] - c1_1: [null, null] - c1_2: [null, null] - c1_3: [null, null] - c2_0: [null, null] - c2_1: [null, null] - c2_2: [null, null] - c3_0: [null, null] - c3_1: [null, null] - c4_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 5 datatype: float64 @@ -288,34 +215,17 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c0_2: false, c0_3: false, - c0_4: false, c1_0: false, c1_1: false, c1_2: false, - c1_3: false, c2_0: false, c2_1: false, c2_2: false, - c3_0: false, c3_1: false, c4_0: false} + inputs: [x, y] + outputs: [z] window: - [-1, 1] - [-1, 1] name: B_correction + outputs: [z] window: - [-1, 1] - [-1, 1] - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c0_2: [null, null] - c0_3: [null, null] - c0_4: [null, null] - c1_0: [null, null] - c1_1: [null, null] - c1_2: [null, null] - c1_3: [null, null] - c2_0: [null, null] - c2_1: [null, null] - c2_2: [null, null] - c3_0: [null, null] - c3_1: [null, null] - c4_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 6 datatype: float64 @@ -324,27 +234,8 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c0_2: false, c0_3: false, - c0_4: false, c1_0: false, c1_1: false, c1_2: false, - c1_3: false, c2_0: false, c2_1: false, c2_2: false, - c3_0: false, c3_1: false, c4_0: false} + inputs: [x, y] inverse: !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c0_2: [null, null] - c0_3: [null, null] - c0_4: [null, null] - c1_0: [null, null] - c1_1: [null, null] - c1_2: [null, null] - c1_3: [null, null] - c2_0: [null, null] - c2_1: [null, null] - c2_2: [null, null] - c3_0: [null, null] - c3_1: [null, null] - c4_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 7 datatype: float64 @@ -353,32 +244,33 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c0_2: false, c0_3: false, - c0_4: false, c1_0: false, c1_1: false, c1_2: false, - c1_3: false, c2_0: false, c2_1: false, c2_2: false, - c3_0: false, c3_1: false, c4_0: false} + inputs: [x, y] + outputs: [z] window: - [-1, 1] - [-1, 1] name: A_correction + outputs: [z] window: - [-1, 1] - [-1, 1] - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} - inverse: !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] + inputs: [x, x0] + outputs: [z0, z1] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] + inverse: !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] + inputs: [x, x0] + outputs: [x0, x1, x2, x3] - !transform/concatenate-1.2.0 forward: - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c1_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 8 datatype: float64 @@ -387,16 +279,13 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c1_0: false} + inputs: [x, y] name: TI_row_correction + outputs: [z] window: - [-1, 1] - [-1, 1] - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c1_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 9 datatype: float64 @@ -405,23 +294,38 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c1_0: false} + inputs: [x, y] name: TI_column_correction + outputs: [z] window: - [-1, 1] - [-1, 1] + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] + inputs: [x, x0] + outputs: [z0, z1] - !transform/identity-1.2.0 - bounds: {} - fixed: {} - inverse: !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + inputs: [x0, x1] + inverse: !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] n_dims: 2 - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + outputs: [x0, x1] + inputs: [x, x0] + outputs: [x0, x1] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [1, 0] + outputs: [x0, x1] + inputs: [x, x0] + outputs: [x0, x1] + inputs: [x0, x] + outputs: [x0, x1] + inputs: [x0, x1] + outputs: [x0, x1] + inputs: [x0, x1] + outputs: [x0, x1] - !transform/compose-1.2.0 forward: - !transform/compose-1.2.0 @@ -431,42 +335,53 @@ wcs: ! - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: *id001 - fixed: {offset: false} + inputs: [x] offset: -325.13 + outputs: [y] - !transform/shift-1.2.0 - bounds: - offset: *id001 - fixed: {offset: false} + inputs: [x] offset: -299.7 - - !transform/rotate2d-1.2.0 + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] + - !transform/rotate2d-1.3.0 angle: 0.24155757363306068 - bounds: - angle: *id002 - fixed: {angle: false} - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + inputs: [x, y] + outputs: [x, y] + inputs: [x0, x1] + outputs: [x, y] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [1] + outputs: [x0] + inputs: [x0, x1] + outputs: [x0] - !transform/tabular-1.2.0 - bounding_box: [-291.60259000740217, 95.69787960086536] - bounds: {} + bounding_box: !transform/property/bounding_box-1.0.0 + ignore: [] + intervals: + x: [-291.60259000740217, 95.69787960086536] + order: C bounds_error: false fill_value: .nan - fixed: {} + inputs: [x] inverse: !transform/tabular-1.2.0 - bounding_box: [3.596040329703134, 14.387876373781149] - bounds: {} + bounding_box: !transform/property/bounding_box-1.0.0 + ignore: [] + intervals: + x: [3.596040329703134, 14.387876373781149] + order: C bounds_error: false fill_value: .nan - fixed: {} + inputs: [x] lookup_table: !core/ndarray-1.0.0 source: 12 datatype: float64 byteorder: little shape: [699] + method: linear name: waverefinv + outputs: [y] points: - !core/ndarray-1.0.0 source: 13 @@ -478,72 +393,21 @@ wcs: ! datatype: float64 byteorder: little shape: [388] + method: linear name: waveref + outputs: [y] points: - !core/ndarray-1.0.0 source: 11 datatype: float64 byteorder: little shape: [388] + inputs: [x0, x1] + outputs: [y] + inputs: [x00, x10, x01, x11] + outputs: [x0, x1, y] + inputs: [x0, x1] inverse: !transform/compose-1.2.0 - bounds: - angle_14: [null, null] - angle_17: [null, null] - c0_0_2: [null, null] - c0_0_3: [null, null] - c0_0_5: [null, null] - c0_0_6: [null, null] - c0_1_2: [null, null] - c0_1_3: [null, null] - c0_1_5: [null, null] - c0_1_6: [null, null] - c0_2_5: [null, null] - c0_2_6: [null, null] - c0_3_5: [null, null] - c0_3_6: [null, null] - c0_4_5: [null, null] - c0_4_6: [null, null] - c0_8: [null, null] - c0_9: [null, null] - c1_0_2: [null, null] - c1_0_3: [null, null] - c1_0_5: [null, null] - c1_0_6: [null, null] - c1_1_5: [null, null] - c1_1_6: [null, null] - c1_2_5: [null, null] - c1_2_6: [null, null] - c1_3_5: [null, null] - c1_3_6: [null, null] - c1_8: [null, null] - c1_9: [null, null] - c2_0_5: [null, null] - c2_0_6: [null, null] - c2_1_5: [null, null] - c2_1_6: [null, null] - c2_2_5: [null, null] - c2_2_6: [null, null] - c3_0_5: [null, null] - c3_0_6: [null, null] - c3_1_5: [null, null] - c3_1_6: [null, null] - c4_0_5: [null, null] - c4_0_6: [null, null] - offset_10: [null, null] - offset_12: [null, null] - offset_13: [null, null] - offset_18: [null, null] - offset_19: [null, null] - fixed: {angle_14: false, angle_17: false, c0_0_2: false, c0_0_3: false, c0_0_5: false, - c0_0_6: false, c0_1_2: false, c0_1_3: false, c0_1_5: false, c0_1_6: false, - c0_2_5: false, c0_2_6: false, c0_3_5: false, c0_3_6: false, c0_4_5: false, - c0_4_6: false, c0_8: false, c0_9: false, c1_0_2: false, c1_0_3: false, c1_0_5: false, - c1_0_6: false, c1_1_5: false, c1_1_6: false, c1_2_5: false, c1_2_6: false, - c1_3_5: false, c1_3_6: false, c1_8: false, c1_9: false, c2_0_5: false, c2_0_6: false, - c2_1_5: false, c2_1_6: false, c2_2_5: false, c2_2_6: false, c3_0_5: false, - c3_0_6: false, c3_1_5: false, c3_1_6: false, c4_0_5: false, c4_0_6: false, - offset_10: false, offset_12: false, offset_13: false, offset_18: false, - offset_19: false} forward: - !transform/concatenate-1.2.0 forward: @@ -553,25 +417,21 @@ wcs: ! forward: - !transform/compose-1.2.0 forward: - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [1, 0] + outputs: [x0, x1] - !transform/compose-1.2.0 forward: - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c1_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 14 datatype: float64 @@ -580,16 +440,13 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c1_0: false} + inputs: [x, y] name: T_row_correction + outputs: [z] window: - [-1, 1] - [-1, 1] - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c1_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 15 datatype: float64 @@ -598,38 +455,25 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c1_0: false} + inputs: [x, y] name: T_column_correction + outputs: [z] window: - [-1, 1] - [-1, 1] + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] - !transform/compose-1.2.0 forward: - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c0_2: [null, null] - c0_3: [null, null] - c0_4: [null, null] - c1_0: [null, null] - c1_1: [null, null] - c1_2: [null, null] - c1_3: [null, null] - c2_0: [null, null] - c2_1: [null, null] - c2_2: [null, null] - c3_0: [null, null] - c3_1: [null, null] - c4_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 16 datatype: float64 @@ -638,30 +482,12 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c0_2: false, c0_3: false, - c0_4: false, c1_0: false, c1_1: false, c1_2: false, - c1_3: false, c2_0: false, c2_1: false, c2_2: false, - c3_0: false, c3_1: false, c4_0: false} + inputs: [x, y] + outputs: [z] window: - [-1, 1] - [-1, 1] - !transform/polynomial-1.2.0 - bounds: - c0_0: [null, null] - c0_1: [null, null] - c0_2: [null, null] - c0_3: [null, null] - c0_4: [null, null] - c1_0: [null, null] - c1_1: [null, null] - c1_2: [null, null] - c1_3: [null, null] - c2_0: [null, null] - c2_1: [null, null] - c2_2: [null, null] - c3_0: [null, null] - c3_1: [null, null] - c4_0: [null, null] coefficients: !core/ndarray-1.0.0 source: 17 datatype: float64 @@ -670,119 +496,148 @@ wcs: ! domain: - [-1, 1] - [-1, 1] - fixed: {c0_0: false, c0_1: false, c0_2: false, c0_3: false, - c0_4: false, c1_0: false, c1_1: false, c1_2: false, - c1_3: false, c2_0: false, c2_1: false, c2_2: false, - c3_0: false, c3_1: false, c4_0: false} + inputs: [x, y] + outputs: [z] window: - [-1, 1] - [-1, 1] + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] - !transform/compose-1.2.0 forward: - !transform/identity-1.2.0 - bounds: {} - fixed: {} + inputs: [x0, x1] n_dims: 2 + outputs: [x0, x1] - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/polynomial-1.2.0 - bounds: - c0: [null, null] - c1: [null, null] coefficients: !core/ndarray-1.0.0 source: 18 datatype: float64 byteorder: little shape: [2] domain: [-1, 1] - fixed: {c0: false, c1: false} + inputs: [x] + outputs: [y] window: [-1, 1] - !transform/polynomial-1.2.0 - bounds: - c0: [null, null] - c1: [null, null] coefficients: !core/ndarray-1.0.0 source: 19 datatype: float64 byteorder: little shape: [2] domain: [-1, 1] - fixed: {c0: false, c1: false} + inputs: [x] + outputs: [y] window: [-1, 1] + inputs: [x0, x1] + outputs: [y0, y1] - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: &id003 [null, null] - fixed: {offset: false} + inputs: [x] offset: 4.0 + outputs: [y] - !transform/identity-1.2.0 - bounds: {} - fixed: {} + inputs: [x0] + outputs: [x0] + inputs: [x, x0] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, y0, x1, y1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, y0, x1, y1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: *id003 - fixed: {offset: false} + inputs: [x] offset: -325.13 + outputs: [y] - !transform/shift-1.2.0 - bounds: - offset: *id003 - fixed: {offset: false} + inputs: [x] offset: -299.7 - - !transform/rotate2d-1.2.0 + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] + - !transform/rotate2d-1.3.0 angle: 0.24155757363306068 - bounds: - angle: &id004 [null, null] - fixed: {angle: false} - - !transform/remap_axes-1.2.0 - bounds: {} - fixed: {} + inputs: [x, y] + outputs: [x, y] + inputs: [x0, x1] + outputs: [x, y] + inputs: [x0, x1] + outputs: [x, y] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0] n_inputs: 2 + outputs: [x0] + inputs: [x0, x1] + outputs: [x0] - !transform/tabular-1.2.0 - bounding_box: [3.596040329703134, 14.387876373781149] - bounds: {} + bounding_box: !transform/property/bounding_box-1.0.0 + ignore: [] + intervals: + x: [3.596040329703134, 14.387876373781149] + order: C bounds_error: false fill_value: .nan - fixed: {} + inputs: [x] lookup_table: !core/ndarray-1.0.0 source: 20 datatype: float64 byteorder: little shape: [699] + method: linear name: waverefinv + outputs: [y] points: - !core/ndarray-1.0.0 source: 21 datatype: float64 byteorder: little shape: [699] + inputs: [x0, x1, x] + outputs: [x0, y] - !transform/compose-1.2.0 forward: - - !transform/rotate2d-1.2.0 + - !transform/rotate2d-1.3.0 angle: -0.24155757363306068 - bounds: - angle: *id004 - fixed: {angle: false} + inputs: [x, y] + outputs: [x, y] - !transform/concatenate-1.2.0 forward: - !transform/shift-1.2.0 - bounds: - offset: *id003 - fixed: {offset: false} + inputs: [x] offset: 325.13 + outputs: [y] - !transform/shift-1.2.0 - bounds: - offset: *id003 - fixed: {offset: false} + inputs: [x] offset: 299.7 - - ! + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] + inputs: [x, y] + outputs: [y0, y1] + inputs: [x0, x1, x] + outputs: [y0, y1] + outputs: [x0, x1, y] + - ! frame: ! frames: - ! @@ -790,47 +645,45 @@ wcs: ! axes_order: [0, 1] axis_physical_types: ['custom:v2', 'custom:v3'] name: v2v3_spatial - unit: [!unit/unit-1.0.0 'arcsec', !unit/unit-1.0.0 'arcsec'] + unit: [!unit/unit-1.0.0 arcsec, !unit/unit-1.0.0 arcsec] - ! axes_names: [lambda] axes_order: [2] axis_physical_types: [em.wl] name: spec - unit: [!unit/unit-1.0.0 'um'] + unit: [!unit/unit-1.0.0 um] name: v2v3 transform: !transform/concatenate-1.2.0 - bounds: - angles_2: [null, null] - factor_0: [null, null] - factor_1: [null, null] - fixed: {angles_2: false, factor_0: false, factor_1: false} forward: - !transform/compose-1.2.0 forward: - !transform/concatenate-1.2.0 forward: - !transform/scale-1.2.0 - bounds: - factor: &id005 [null, null] factor: 0.0002777777777777778 - fixed: {factor: false} + inputs: [x] + outputs: [y] - !transform/scale-1.2.0 - bounds: - factor: *id005 factor: 0.0002777777777777778 - fixed: {factor: false} + inputs: [x] + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] - !transform/rotate_sequence_3d-1.0.0 angles: [-0.12597594444444443, 0.10374517305555556, 0.0, -72.0545718, -5.630568] axes_order: zyxyz - bounds: - angles: [null, null] - fixed: {angles: false} + inputs: [lon, lat] name: v23tosky + outputs: [lon, lat] rotation_type: spherical + inputs: [x0, x1] + outputs: [lon, lat] - !transform/identity-1.2.0 - bounds: {} - fixed: {} - - ! + inputs: [x0] + outputs: [x0] + inputs: [x00, x10, x01] + outputs: [lon, lat, x0] + - ! frame: ! frames: - ! @@ -840,14 +693,15 @@ wcs: ! name: icrs reference_frame: ! frame_attributes: {} - unit: [!unit/unit-1.0.0 'deg', !unit/unit-1.0.0 'deg'] + unit: [!unit/unit-1.0.0 deg, !unit/unit-1.0.0 deg] - ! axes_names: [lambda] axes_order: [2] axis_physical_types: [em.wl] name: spec - unit: [!unit/unit-1.0.0 'um'] + unit: [!unit/unit-1.0.0 um] name: world + transform: null ... BLK0۴ke-.u33333)?BLK0Eտ5Nh{@D@BLK0۴ke-.u33333)?BLK0Eտ5Nh{@D@BLK0 Z惂<LCjX?_@ r+9:mM)3><ǹ?"KmL-?@n.>TF>6 \UnҪx->Fa>V9>`f>BLK0*W˲VN{C&IiujBCƞ>@ Ո8x:?Z4~\W?rfƾd;P>6X=#>`hg=eLD-BLK0ȓr)ǸW`ӷi?ϝ_2*0IAn d>([RѨ@H`f0'9YE (p]>o-L'? t>3MX/Egy>\` ^>BLK09UHw o+u F_|0W4?Wʽxн{D=_=mR?w8j{?h  X,,R[ތ>Iİ؃>%Mu,i"qF!Z9 @@ -930,26 +784,26 @@ A>8)@ #+@y)*+@J5_v2+@A<:+@L~B+@XJ+@dӅR+@_p tZ+@0|^b+@jIj+@ғG3r+@$z+@t+@E +@ûݑ+@Θ(ș+@u+@R0+@Z/+@+ 8r+@ \+@?G+@!1+@o-G+@@9^+@E;O+@P+@\V+@hڰ,@Ut^,@&,@ifp,@ȗFZ ,@#nE(,@j/0,@;u8,@ Ǻ@,@җ}G,@tO,@QW,@P. _,@! g,@ o,@Ɣnw,@%Y,@e1C,@6=] .,@I:,@T(,@`,@zl/خ,@Kx¶,@7,@h,@#ASDF BLOCK INDEX %YAML 1.1 --- -- 35600 -- 35670 -- 35740 -- 35810 -- 35880 -- 36134 -- 36388 -- 36642 -- 36896 -- 36982 -- 37068 -- 40226 -- 43384 -- 49030 -- 54676 -- 54762 -- 54848 -- 55102 -- 55356 -- 55426 -- 55496 -- 61142 +- 27843 +- 27913 +- 27983 +- 28053 +- 28123 +- 28377 +- 28631 +- 28885 +- 29139 +- 29225 +- 29311 +- 32469 +- 35627 +- 41273 +- 46919 +- 47005 +- 47091 +- 47345 +- 47599 +- 47669 +- 47739 +- 53385 ... diff --git a/gwcs/tests/data/miriwcs.asdf b/gwcs/tests/data/miriwcs.asdf index e70bc620..2cc3a875 100644 --- a/gwcs/tests/data/miriwcs.asdf +++ b/gwcs/tests/data/miriwcs.asdf @@ -1,237 +1,470 @@ #ASDF 1.0.0 -#ASDF_STANDARD 1.4.0 +#ASDF_STANDARD 1.5.0 %YAML 1.1 %TAG ! tag:stsci.edu:asdf/ --- !core/asdf-1.1.0 -asdf_library: !core/software-1.0.0 {author: Space Telescope Science Institute, homepage: 'http://github.com/spacetelescope/asdf', - name: asdf, version: 2.5.2} +asdf_library: !core/software-1.0.0 {author: The ASDF Developers, homepage: 'http://github.com/asdf-format/asdf', + name: asdf, version: 3.5.0} history: extensions: - !core/extension_metadata-1.0.0 - extension_class: astropy.io.misc.asdf.extension.AstropyAsdfExtension - software: {name: astropy, version: '4.0'} + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/core/extensions/core-1.5.0 + manifest_software: !core/software-1.0.0 {name: asdf_standard, version: 1.1.1} + software: !core/software-1.0.0 {name: asdf, version: 3.5.0} - !core/extension_metadata-1.0.0 - extension_class: gwcs.extension.GWCSExtension - software: {name: gwcs, version: 0.12.0} + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://astropy.org/astropy/extensions/units-1.0.0 + software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} - !core/extension_metadata-1.0.0 - extension_class: asdf.extension.BuiltinExtension - software: {name: asdf, version: 2.5.2} -wcs: ! + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/transform/extensions/transform-1.5.0 + manifest_software: !core/software-1.0.0 {name: asdf_transform_schemas, version: 0.5.0} + software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} + - !core/extension_metadata-1.0.0 + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/astronomy/gwcs/extensions/gwcs-1.2.0 + manifest_software: !core/software-1.0.0 {name: asdf_wcs_schemas, version: 0.4.0} + software: !core/software-1.0.0 {name: gwcs, version: 0.22.0a1.dev14+gc46e932} + - !core/extension_metadata-1.0.0 + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/astronomy/coordinates/extensions/coordinates-1.0.0 + manifest_software: !core/software-1.0.0 {name: asdf_coordinates_schemas, version: 0.3.0} + software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} +wcs: ! name: '' + pixel_shape: null steps: - - ! + - ! frame: ! axes_names: [x, y] axes_order: [0, 1] axis_physical_types: ['custom:x', 'custom:y'] name: detector - unit: [!unit/unit-1.0.0 'pixel', !unit/unit-1.0.0 'pixel'] - transform: !transform/compose-1.1.0 - bounding_box: - - [-0.5, 1023.5] - - [3.5, 1027.5] + unit: [!unit/unit-1.0.0 pixel, !unit/unit-1.0.0 pixel] + transform: !transform/compose-1.2.0 + bounding_box: !transform/property/bounding_box-1.0.0 + ignore: [] + intervals: + x0: [3.5, 1027.5] + x1: [-0.5, 1023.5] + order: F forward: - - !transform/concatenate-1.1.0 + - !transform/concatenate-1.2.0 forward: - - !transform/shift-1.2.0 {offset: 0.15} - - !transform/shift-1.2.0 {offset: -0.59} - - !transform/compose-1.1.0 + - !transform/shift-1.2.0 + inputs: [x] + offset: 0.15 + outputs: [y] + - !transform/shift-1.2.0 + inputs: [x] + offset: -0.59 + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] + - !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/concatenate-1.1.0 + - !transform/concatenate-1.2.0 forward: - - !transform/shift-1.2.0 {offset: -4.0} - - !transform/identity-1.1.0 {} - - !transform/concatenate-1.1.0 + - !transform/shift-1.2.0 + inputs: [x] + offset: -4.0 + outputs: [y] + - !transform/identity-1.2.0 + inputs: [x0] + outputs: [x0] + inputs: [x, x0] + outputs: [y, x0] + - !transform/concatenate-1.2.0 forward: - - !transform/polynomial-1.1.0 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 0 datatype: float64 byteorder: little shape: [2] - inverse: !transform/polynomial-1.1.0 + domain: &id001 [-1, 1] + inputs: [x] + inverse: !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 1 datatype: float64 byteorder: little shape: [2] + domain: *id001 + inputs: [x] + outputs: [y] + window: *id001 name: M_column_correction - - !transform/polynomial-1.1.0 + outputs: [y] + window: *id001 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 2 datatype: float64 byteorder: little shape: [2] - inverse: !transform/polynomial-1.1.0 + domain: *id001 + inputs: [x] + inverse: !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 3 datatype: float64 byteorder: little shape: [2] + domain: *id001 + inputs: [x] + outputs: [y] + window: *id001 name: M_row_correction - - !transform/remap_axes-1.1.0 - inverse: !transform/identity-1.1.0 {n_dims: 2} + outputs: [y] + window: *id001 + inputs: [x0, x1] + outputs: [y0, y1] + inputs: [x, x0] + outputs: [y0, y1] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] + inverse: !transform/identity-1.2.0 + inputs: [x0, x1] + n_dims: 2 + outputs: [x0, x1] mapping: [0, 1, 0, 1] - - !transform/concatenate-1.1.0 + outputs: [x0, x1, x2, x3] + inputs: [x, x0] + outputs: [x0, x1, x2, x3] + - !transform/concatenate-1.2.0 forward: - - !transform/polynomial-1.1.0 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 4 datatype: float64 byteorder: little shape: [5, 5] - inverse: !transform/polynomial-1.1.0 + domain: + - *id001 + - *id001 + inputs: [x, y] + inverse: !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 5 datatype: float64 byteorder: little shape: [5, 5] + domain: + - *id001 + - *id001 + inputs: [x, y] + outputs: [z] + window: + - *id001 + - *id001 name: B_correction - - !transform/polynomial-1.1.0 + outputs: [z] + window: + - *id001 + - *id001 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 6 datatype: float64 byteorder: little shape: [5, 5] - inverse: !transform/polynomial-1.1.0 + domain: + - *id001 + - *id001 + inputs: [x, y] + inverse: !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 7 datatype: float64 byteorder: little shape: [5, 5] + domain: + - *id001 + - *id001 + inputs: [x, y] + outputs: [z] + window: + - *id001 + - *id001 name: A_correction - - !transform/remap_axes-1.1.0 - inverse: !transform/remap_axes-1.1.0 + outputs: [z] + window: + - *id001 + - *id001 + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] + inputs: [x, x0] + outputs: [z0, z1] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] + inverse: !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] mapping: [0, 1, 0, 1] - - !transform/concatenate-1.1.0 + outputs: [x0, x1, x2, x3] + inputs: [x, x0] + outputs: [x0, x1, x2, x3] + - !transform/concatenate-1.2.0 forward: - - !transform/polynomial-1.1.0 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 8 datatype: float64 byteorder: little shape: [2, 2] + domain: + - *id001 + - *id001 + inputs: [x, y] name: TI_row_correction - - !transform/polynomial-1.1.0 + outputs: [z] + window: + - *id001 + - *id001 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 9 datatype: float64 byteorder: little shape: [2, 2] + domain: + - *id001 + - *id001 + inputs: [x, y] name: TI_column_correction - - !transform/identity-1.1.0 - inverse: !transform/remap_axes-1.1.0 + outputs: [z] + window: + - *id001 + - *id001 + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] + inputs: [x, x0] + outputs: [z0, z1] + - !transform/identity-1.2.0 + inputs: [x0, x1] + inverse: !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] + outputs: [x0, x1, x2, x3] n_dims: 2 - - !transform/remap_axes-1.1.0 + outputs: [x0, x1] + inputs: [x, x0] + outputs: [x0, x1] + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [1, 0] - inverse: !transform/compose-1.1.0 + outputs: [x0, x1] + inputs: [x, x0] + outputs: [x0, x1] + inputs: [x0, x1] + inverse: !transform/compose-1.2.0 forward: - - !transform/compose-1.1.0 + - !transform/compose-1.2.0 forward: - - !transform/remap_axes-1.1.0 + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [1, 0] - - !transform/compose-1.1.0 + outputs: [x0, x1] + - !transform/compose-1.2.0 forward: - - !transform/remap_axes-1.1.0 + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] - - !transform/compose-1.1.0 + outputs: [x0, x1, x2, x3] + - !transform/compose-1.2.0 forward: - - !transform/concatenate-1.1.0 + - !transform/concatenate-1.2.0 forward: - - !transform/polynomial-1.1.0 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 10 datatype: float64 byteorder: little shape: [2, 2] + domain: + - *id001 + - *id001 + inputs: [x, y] name: T_row_correction - - !transform/polynomial-1.1.0 + outputs: [z] + window: + - *id001 + - *id001 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 11 datatype: float64 byteorder: little shape: [2, 2] + domain: + - *id001 + - *id001 + inputs: [x, y] name: T_column_correction - - !transform/compose-1.1.0 + outputs: [z] + window: + - *id001 + - *id001 + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] + - !transform/compose-1.2.0 forward: - - !transform/remap_axes-1.1.0 + - !transform/remap_axes-1.3.0 + inputs: [x0, x1] mapping: [0, 1, 0, 1] - - !transform/compose-1.1.0 + outputs: [x0, x1, x2, x3] + - !transform/compose-1.2.0 forward: - - !transform/concatenate-1.1.0 + - !transform/concatenate-1.2.0 forward: - - !transform/polynomial-1.1.0 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 12 datatype: float64 byteorder: little shape: [5, 5] - - !transform/polynomial-1.1.0 + domain: + - *id001 + - *id001 + inputs: [x, y] + outputs: [z] + window: + - *id001 + - *id001 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 13 datatype: float64 byteorder: little shape: [5, 5] - - !transform/compose-1.1.0 + domain: + - *id001 + - *id001 + inputs: [x, y] + outputs: [z] + window: + - *id001 + - *id001 + inputs: [x0, y0, x1, y1] + outputs: [z0, z1] + - !transform/compose-1.2.0 forward: - - !transform/identity-1.1.0 {n_dims: 2} - - !transform/compose-1.1.0 + - !transform/identity-1.2.0 + inputs: [x0, x1] + n_dims: 2 + outputs: [x0, x1] + - !transform/compose-1.2.0 forward: - - !transform/concatenate-1.1.0 + - !transform/concatenate-1.2.0 forward: - - !transform/polynomial-1.1.0 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 14 datatype: float64 byteorder: little shape: [2] - - !transform/polynomial-1.1.0 + domain: *id001 + inputs: [x] + outputs: [y] + window: *id001 + - !transform/polynomial-1.2.0 coefficients: !core/ndarray-1.0.0 source: 15 datatype: float64 byteorder: little shape: [2] - - !transform/concatenate-1.1.0 + domain: *id001 + inputs: [x] + outputs: [y] + window: *id001 + inputs: [x0, x1] + outputs: [y0, y1] + - !transform/concatenate-1.2.0 forward: - - !transform/shift-1.2.0 {offset: 4.0} - - !transform/identity-1.1.0 {} - - !transform/concatenate-1.1.0 + - !transform/shift-1.2.0 + inputs: [x] + offset: 4.0 + outputs: [y] + - !transform/identity-1.2.0 + inputs: [x0] + outputs: [x0] + inputs: [x, x0] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, y0, x1, y1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, y0, x1, y1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + inputs: [x0, x1] + outputs: [y, x0] + - !transform/concatenate-1.2.0 forward: - - !transform/shift-1.2.0 {offset: -0.15} - - !transform/shift-1.2.0 {offset: 0.59} - - ! + - !transform/shift-1.2.0 + inputs: [x] + offset: -0.15 + outputs: [y] + - !transform/shift-1.2.0 + inputs: [x] + offset: 0.59 + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] + inputs: [x0, x1] + outputs: [y0, y1] + outputs: [x0, x1] + - ! frame: ! axes_names: [x, y] axes_order: [0, 1] axis_physical_types: ['custom:x', 'custom:y'] name: v2v3 - unit: [!unit/unit-1.0.0 'arcsec', !unit/unit-1.0.0 'arcsec'] - transform: !transform/compose-1.1.0 + unit: [!unit/unit-1.0.0 arcsec, !unit/unit-1.0.0 arcsec] + transform: !transform/compose-1.2.0 forward: - - !transform/concatenate-1.1.0 + - !transform/concatenate-1.2.0 forward: - - !transform/scale-1.2.0 {factor: 0.0002777777777777778} - - !transform/scale-1.2.0 {factor: 0.0002777777777777778} + - !transform/scale-1.2.0 + factor: 0.0002777777777777778 + inputs: [x] + outputs: [y] + - !transform/scale-1.2.0 + factor: 0.0002777777777777778 + inputs: [x] + outputs: [y] + inputs: [x0, x1] + outputs: [y0, y1] - !transform/rotate_sequence_3d-1.0.0 angles: [-0.12597594444444443, 0.10374517305555556, 0.0, -72.0545718, -5.630568] axes_order: zyxyz + inputs: [lon, lat] name: v23tosky + outputs: [lon, lat] rotation_type: spherical - - ! + inputs: [x0, x1] + outputs: [lon, lat] + - ! frame: ! axes_names: [lon, lat] axes_order: [0, 1] @@ -239,7 +472,8 @@ wcs: ! name: world reference_frame: ! frame_attributes: {} - unit: [!unit/unit-1.0.0 'deg', !unit/unit-1.0.0 'deg'] + unit: [!unit/unit-1.0.0 deg, !unit/unit-1.0.0 deg] + transform: null ... BLK0۴ke-.u33333)?BLK0Eտ5Nh{@D@BLK0۴ke-.u33333)?BLK0Eտ5Nh{@D@BLK0 Z惂<LCjX?_@ r+9:mM)3><ǹ?"KmL-?@n.>TF>6 \UnҪx->Fa>V9>`f>BLK0*W˲VN{C&IiujBCƞ>@ Ո8x:?Z4~\W?rfƾd;P>6X=#>`hg=eLD-BLK0ȓr)ǸW`ӷi?ϝ_2*0IAn d>([RѨ@H`f0'9YE (p]>o-L'? t>3MX/Egy>\` ^>BLK09UHw o+u F_|0W4?Wʽxн{D=_=mR?w8j{?h  X,,R[ތ>Iİ؃>%Mu,i"qF!Z9 @@ -249,20 +483,20 @@ X,,R ؐ=BLK0*W˲VN{C&IiujBCƞ>@ Ո8x:?Z4~\W?rfƾd;P>6X=#>`hg=eLD-BLK0Eտ5Nh{@D@BLK0Eտ5Nh{@D@#ASDF BLOCK INDEX %YAML 1.1 --- -- 9730 -- 9800 -- 9870 -- 9940 -- 10010 -- 10264 -- 10518 -- 10772 -- 11026 -- 11112 -- 11198 -- 11284 -- 11370 -- 11624 -- 11878 -- 11948 +- 17762 +- 17832 +- 17902 +- 17972 +- 18042 +- 18296 +- 18550 +- 18804 +- 19058 +- 19144 +- 19230 +- 19316 +- 19402 +- 19656 +- 19910 +- 19980 ... diff --git a/gwcs/tests/data/nircamwcs.asdf b/gwcs/tests/data/nircamwcs.asdf index f0e2c14b..c9d739db 100644 Binary files a/gwcs/tests/data/nircamwcs.asdf and b/gwcs/tests/data/nircamwcs.asdf differ diff --git a/gwcs/tests/test_wcs.py b/gwcs/tests/test_wcs.py index 7a69c853..9387922d 100644 --- a/gwcs/tests/test_wcs.py +++ b/gwcs/tests/test_wcs.py @@ -1394,3 +1394,52 @@ def test_spatial_spectral_stokes(): def test_wcs_str(): w = wcs.WCS(output_frame="icrs") assert 'icrs' in str(w) + + +def test_bounding_box_is_returned_F(): + bbox_tuple = ((1, 2), (3, 4)) + + detector_2d_frame = cf.Frame2D(name='detector', axes_order=(0, 1)) + model_2d_shift = models.Shift(1) & models.Shift(2) + + model_2d_shift_bbox = model_2d_shift.copy() + model_2d_shift_bbox.bounding_box = bbox_tuple + + frame = cf.CoordinateFrame(name="quantity", axes_order=(0, 1), naxes=2, axes_type=("SPATIAL", "SPATIAL"), unit=(u.km, u.km)) + + # Demonstrate that model_2d_shift does not have a bounding box + with pytest.raises(NotImplementedError): + model_2d_shift.bounding_box + + # Demonstrate that model_2d_shift_bbox does have a bounding box + assert model_2d_shift_bbox.bounding_box == bbox_tuple + + # Demonstrate the model_2d_shift_bbox has order "C" + assert model_2d_shift_bbox.bounding_box.order == "C" + + # Create a WCS and then set a bounding box on it + pipeline_bbox_after = [(detector_2d_frame, model_2d_shift), (frame, None)] + gwcs_object_after = wcs.WCS(pipeline_bbox_after) + gwcs_object_after.bounding_box = bbox_tuple + + assert gwcs_object_after.bounding_box == bbox_tuple + assert gwcs_object_after.bounding_box.order == "F" + + # Create a WCS on transform with a bounding box + pipeline_bbox_before = [(detector_2d_frame, model_2d_shift_bbox), (frame, None)] + gwcs_object_before = wcs.WCS(pipeline_bbox_before) + + # Check that first access in this case will raise a warning + with pytest.warns(wcs.GwcsBoundingBoxWarning): + gwcs_object_before.bounding_box + + # Check order is returned as F + assert gwcs_object_before.bounding_box.order == "F" + + # The bounding box tuple will now be ordered differently than the original + # Tuple due to the order change + assert gwcs_object_before.bounding_box != bbox_tuple + assert gwcs_object_before.bounding_box.bounding_box(order="C") == bbox_tuple + + # Show the the bounding box is different between the two WCS objects + assert gwcs_object_after.bounding_box != gwcs_object_before.bounding_box diff --git a/gwcs/wcs.py b/gwcs/wcs.py index 6dede33e..cb33eae8 100644 --- a/gwcs/wcs.py +++ b/gwcs/wcs.py @@ -72,6 +72,12 @@ def __init__(self, *args, best_solution=None, accuracy=None, niter=None, self.slow_conv = slow_conv +class GwcsBoundingBoxWarning(UserWarning): + """ + A warning class to report issues with bounding boxes in GWCS. + """ + + class _WorldAxisInfo(): def __init__(self, axis, frame, world_axis_order, cunit, ctype, input_axes): """ @@ -1286,6 +1292,23 @@ def bounding_box(self): except NotImplementedError: return None + if ( + # Check that the bounding_box was set on the instance (not a default) + transform_0._user_bounding_box is not None + # Check the order of that bounding_box is C + and bb.order == "C" + # Check that the bounding_box is not a single value + and (isinstance(bb, CompoundBoundingBox) or len(bb) > 1) + ): + warnings.warn( + "The bounding_box was set in C order on the transform prior to being used in the gwcs!\n" + "Check that you indended that ordering for the bounding_box, and consider setting it in F order.\n" + "The bounding_box will remain meaning the same but will be converted to F order for consistency in the GWCS.", + GwcsBoundingBoxWarning + ) + self.bounding_box = bb.bounding_box(order="F") + bb = self.bounding_box + return bb @bounding_box.setter