Skip to content

Component issue when using n-D data with an m-D coordinate system #2574

@MatthewPortman

Description

@MatthewPortman

Describe the bug
When data is loaded in that has a different number of dimensions than the provided coordinate system, e.g. a 2D spectra that uses a 3D WCS, the units that are assigned to the world components are incorrect.

In the following example, the data is a 2D spectrum with a 3D WCS. The expected components are Wavelength with unit um, Lat with unit deg, and Lon with unit deg:

Loaded data: jw01538-o161_s000000001_nirspec_f290lp-g395h-s1600a1_s2d
  component Pixel Axis 0 [y] -> unit=
  component Pixel Axis 1 [x] -> unit=
  component Wavelength -> unit=deg
  component Lat -> unit=deg
  component flux -> unit=MJy
  component uncertainty -> unit=MJy

Wavelength in this example has the wrong unit and Lon is missing.

To Reproduce
Steps to reproduce:

  1. Install Jdaviz v4.5, a temporary fix has been applied to the latest version.
  2. In the Jdaviz Example notebook for 2d Spectra products (here), run the notebook through the third cell to download the data and load it into the application. You may have to add format = '2D Spectrum' to load to avoid an error if not already fixed.
  3. From the data collection, which can be accessed via specviz2d.app.data_collection, retrieve the unit of each component. This can be done as
data = specviz2d.app.data_collection[0]
components = data.components
for comp in components:
    comp_obj = data.get_component(comp.label)
    print(f'component {comp.label} -> unit={comp_obj.units}')

Expected behavior
The data should have the three coordinate components (Lat, Lon, and Wavelength) with the correct units.

I have created a PR to address the unit issue (2573) but the missing component is a deeper issue that I'm unable to debug.

Details:

  • Operating System: MacOS Sequoia 15.7.3
  • Python version (python --version): Python 3.11.14
  • Glue version (glue --version): 1.25.0
  • Jdaviz version: 4.5
  • How you installed glue: pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions