Skip to content

Image importer expose data label#26

Merged
javerbukh merged 29 commits into
javerbukh:enable-loaders-with-testsfrom
kecnry:image-importer-expose-data-label
Jul 11, 2025
Merged

Image importer expose data label#26
javerbukh merged 29 commits into
javerbukh:enable-loaders-with-testsfrom
kecnry:image-importer-expose-data-label

Conversation

@kecnry

@kecnry kecnry commented Jul 9, 2025

Copy link
Copy Markdown

This PR modifies spacetelescope#3662 to:

  • expose the proposed data_label to the user if there will be a single entry added, and otherwise exposes the prefix (future work could expose how the for-loop will result in multiple data labels in the UI). This requires moving backwards-compatibility logic out of the old parser functions and either into the new default labels or into the mapping from load_data.
  • allow passing extension through imviz._load, and allow mapping from extension names so that previous inputs to load_data are supported.
  • preserve expected data-label from load_data with general logic in importer, where possible, and by mapping when sending from load_data to _load in other cases
  • simplify the repr of importers for easier debugging (hides the template)
  • deprecate the import button in Imviz

@github-actions github-actions Bot added the embed label Jul 9, 2025
@kecnry kecnry force-pushed the image-importer-expose-data-label branch from c2ca307 to e73fb39 Compare July 9, 2025 18:01
@kecnry kecnry force-pushed the image-importer-expose-data-label branch 3 times, most recently from 49aa7dc to 8a344e5 Compare July 9, 2025 18:15
@kecnry kecnry force-pushed the image-importer-expose-data-label branch 2 times, most recently from b1213ff to 32c5a58 Compare July 10, 2025 16:13
@kecnry kecnry force-pushed the image-importer-expose-data-label branch 6 times, most recently from 2587c01 to 73556c3 Compare July 10, 2025 20:55
@kecnry kecnry force-pushed the image-importer-expose-data-label branch 3 times, most recently from 5a9a93c to 91650e8 Compare July 11, 2025 12:31
@kecnry kecnry force-pushed the image-importer-expose-data-label branch from 91650e8 to 16bc94f Compare July 11, 2025 12:41
kecnry and others added 8 commits July 11, 2025 08:43
* Remove jwst s3d parser now that it can be handled by Spectrum1D

* Update Jdaviz for specutils 2 compatibility

Fix coords mouseover when SkyCoord is before SpectralCoord

More debugging

Fix slice with different spectral_axis_index, add specutils_format kwarg to cubeviz parser

Remove unused import

Remove ESA parser from commissioning [skip ci]

Generalizing coords_info to handle spectral axis first or last [ci skip]

Working on debugging aperture photometry

Need to pull meta from data not comp

Fix aperture photometry and wrong coord order in coords_info

Fix codestyle, delete defunct case in parser

Change Spectrum1D to Spectrum

Change class name in recent code additions

Get spectral extraction working again for cylinder case

Debugging wavelength dependent case

Make sure spectral extraction result is linked when added to data collection

Moved fix to correct place

Fix indents

Remove stray code from rebase

Update missed Spectrum1D

Debugging cubeviz parser

First start on fixing testt

Fix bad rebase in spectral extraction

Starting to work through test failures

Working through test failures

Debugging spectral extraction

Fixing errors after rebase to  main

Finish fixing codestyle, probably still need functional fixes

Replace new occurances of Spectrum1D with Spectrum

Missed committing a file

(re-) fix spectral extraction

Handle checking GWCS for spectral subset, fix codestyle

More debugging

More debugging

Remove parent data label code reintroduced by rebase

* Update newer instances of Spectrum1D

* Working on resolving test failures

Trying to fix slicing

Add keyword in velocity calculation

Fix spectral extraction for arrays

Update collapse

Debugging moment maps

* Fix bugs revealed by CI and update tests with new values where needed

More debugging

Debugging cube model fitting

Fixing more tests

Debugging spectral extraction and collapse

Keep metadata in return_spectrum_with_correct_units

Update gaussian smooth tests

Take correct slice index in coords info

Look for SpectralGWCS for linking as well as SpectralCoordinate

More debugging

Fix spectrum-at-spaxel for spectral-first cubes, linking for plugin generated cubes

Fix model initialization and subset application for non-last spectral axis

Link moment maps to correct cube components

Update moment map test

Remove debugging prints

Update test value

Remove debugging prints

* Missed a couple codestyle things and Spectrum1D instances

Fix moment map test

* Fix remaining Spectrum1D instances

Codestyle

* Trying to fix tests related to this fixture

* Update test values here as well for fixed test fixture

* Changelog and updated specutils pin to use 2.0 RC

* Update test values for fixed test fixture

Codestyle

* Add missing spectral_axis_index to this case

* Temporarily pin glue-astronomy PR in dependencies

Also pin dev specreduce for now, for CI

Try this again...

Same thing for glue-astronomy

* Rename Spectrum1D instances after rebase to main

* Remove new Spectrum1D usage

* Glue-astronomy PR has been merged, pin to main

* Revert specutils intersphinx mapping to stable

* Fix cross dispersion profile wav calculation with specutils 2

* Update pins, fix aperture mask, update docs links

Update specutils documentation links

Fix specreduce pin

* Fix moment map coordinate handling for GWCS, slice check for data ndim=1

Fix another remote data test

* Remove duplicate line

* Generalize generate_spaxels

* Getting sonification working with specutils 2 and multiprocessing

More work on cube listener

Move wcs code to where it's actually used for readability

Still trying to get sonification working, wrong pixel axes are getting linked in external_links

Codestyle

Get percentile along correct axis for sonification

Link sonified data properly, fix expand_di axis

Missed this Spectrum1D

Got sonification working

Fix failing testtest

* Codestyle, debugging tests, addressing review comments

Fixing spectrum2d loader

Ignore warning in this test

Move time information to snackbar output

Revert check on len(subset_region)

* Fix two minor rebase problems

* Update jdaviz/configs/cubeviz/plugins/viewers.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Apply suggestions from code review

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Handle case where meta doesn't have spectral_axis_index

* Update jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Ignore new FitsFixed warning

* Debugging failing test

* Fix failing spectrum2d test

* Make this more robust

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
@kecnry kecnry force-pushed the image-importer-expose-data-label branch from fac8646 to 1a30204 Compare July 11, 2025 16:29
@kecnry kecnry force-pushed the image-importer-expose-data-label branch from 1a30204 to 15395fa Compare July 11, 2025 16:34
@javerbukh javerbukh marked this pull request as ready for review July 11, 2025 17:56
@javerbukh javerbukh self-requested a review as a code owner July 11, 2025 17:56
@javerbukh javerbukh merged commit 4141113 into javerbukh:enable-loaders-with-tests Jul 11, 2025
10 of 17 checks passed
javerbukh pushed a commit that referenced this pull request Jul 11, 2025
* ignore deprecation warning from astropy via spectral-cube (spacetelescope#3683)

* feat: allow exporting of figures in a custom resolution (spacetelescope#3478)


Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* loaders: use filename/URL as default label (spacetelescope#3684)

* expose proposed data_label to user

* allow passing extension through load

* simplify repr of importers for debugging

* import button enabled for all BUT listed configs

* clearer as we extend support for loaders, but also will enable for lcviz
* deprecates import button for imviz

* codestyle

* pass extension through _load

* hdu2data to not return data

* load_data: support list of filenames

* allow defaulting to have extension for data without extension

* strip out repeated data_label logic

* load_data: backwards compatibility for appending [DATA]

* orientation: bypass load_data

* load_data: backwards compatibility for appending extension to ImageHDU

* loaders: use filename/URL as default label (spacetelescope#3684)

* update to use filename as default prefix

* handle appending "extensions" for NDData

* fix HDUList case when providing data_label through load_data

* bypass NDData extension logic if coming from plugin (incl orientation)

* Revert "orientation: bypass load_data"

This reverts commit 2b49a73.

* fix tests

* maintain .reg support through load_data

* Specutils 2 compatibility (spacetelescope#2922)

* Remove jwst s3d parser now that it can be handled by Spectrum1D

* Update Jdaviz for specutils 2 compatibility

Fix coords mouseover when SkyCoord is before SpectralCoord

More debugging

Fix slice with different spectral_axis_index, add specutils_format kwarg to cubeviz parser

Remove unused import

Remove ESA parser from commissioning [skip ci]

Generalizing coords_info to handle spectral axis first or last [ci skip]

Working on debugging aperture photometry

Need to pull meta from data not comp

Fix aperture photometry and wrong coord order in coords_info

Fix codestyle, delete defunct case in parser

Change Spectrum1D to Spectrum

Change class name in recent code additions

Get spectral extraction working again for cylinder case

Debugging wavelength dependent case

Make sure spectral extraction result is linked when added to data collection

Moved fix to correct place

Fix indents

Remove stray code from rebase

Update missed Spectrum1D

Debugging cubeviz parser

First start on fixing testt

Fix bad rebase in spectral extraction

Starting to work through test failures

Working through test failures

Debugging spectral extraction

Fixing errors after rebase to  main

Finish fixing codestyle, probably still need functional fixes

Replace new occurances of Spectrum1D with Spectrum

Missed committing a file

(re-) fix spectral extraction

Handle checking GWCS for spectral subset, fix codestyle

More debugging

More debugging

Remove parent data label code reintroduced by rebase

* Update newer instances of Spectrum1D

* Working on resolving test failures

Trying to fix slicing

Add keyword in velocity calculation

Fix spectral extraction for arrays

Update collapse

Debugging moment maps

* Fix bugs revealed by CI and update tests with new values where needed

More debugging

Debugging cube model fitting

Fixing more tests

Debugging spectral extraction and collapse

Keep metadata in return_spectrum_with_correct_units

Update gaussian smooth tests

Take correct slice index in coords info

Look for SpectralGWCS for linking as well as SpectralCoordinate

More debugging

Fix spectrum-at-spaxel for spectral-first cubes, linking for plugin generated cubes

Fix model initialization and subset application for non-last spectral axis

Link moment maps to correct cube components

Update moment map test

Remove debugging prints

Update test value

Remove debugging prints

* Missed a couple codestyle things and Spectrum1D instances

Fix moment map test

* Fix remaining Spectrum1D instances

Codestyle

* Trying to fix tests related to this fixture

* Update test values here as well for fixed test fixture

* Changelog and updated specutils pin to use 2.0 RC

* Update test values for fixed test fixture

Codestyle

* Add missing spectral_axis_index to this case

* Temporarily pin glue-astronomy PR in dependencies

Also pin dev specreduce for now, for CI

Try this again...

Same thing for glue-astronomy

* Rename Spectrum1D instances after rebase to main

* Remove new Spectrum1D usage

* Glue-astronomy PR has been merged, pin to main

* Revert specutils intersphinx mapping to stable

* Fix cross dispersion profile wav calculation with specutils 2

* Update pins, fix aperture mask, update docs links

Update specutils documentation links

Fix specreduce pin

* Fix moment map coordinate handling for GWCS, slice check for data ndim=1

Fix another remote data test

* Remove duplicate line

* Generalize generate_spaxels

* Getting sonification working with specutils 2 and multiprocessing

More work on cube listener

Move wcs code to where it's actually used for readability

Still trying to get sonification working, wrong pixel axes are getting linked in external_links

Codestyle

Get percentile along correct axis for sonification

Link sonified data properly, fix expand_di axis

Missed this Spectrum1D

Got sonification working

Fix failing testtest

* Codestyle, debugging tests, addressing review comments

Fixing spectrum2d loader

Ignore warning in this test

Move time information to snackbar output

Revert check on len(subset_region)

* Fix two minor rebase problems

* Update jdaviz/configs/cubeviz/plugins/viewers.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Apply suggestions from code review

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Handle case where meta doesn't have spectral_axis_index

* Update jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Ignore new FitsFixed warning

* Debugging failing test

* Fix failing spectrum2d test

* Make this more robust

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* allow API access to imviz.loaders

* nddata without meta

* for HDUList, always append extension to user-passed data_label

---------

Co-authored-by: Maarten Breddels <maartenbreddels@gmail.com>
Co-authored-by: Ricky O'Steen <39831871+rosteen@users.noreply.github.com>
javerbukh pushed a commit that referenced this pull request Jul 17, 2025
* ignore deprecation warning from astropy via spectral-cube (spacetelescope#3683)

* feat: allow exporting of figures in a custom resolution (spacetelescope#3478)


Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* loaders: use filename/URL as default label (spacetelescope#3684)

* expose proposed data_label to user

* allow passing extension through load

* simplify repr of importers for debugging

* import button enabled for all BUT listed configs

* clearer as we extend support for loaders, but also will enable for lcviz
* deprecates import button for imviz

* codestyle

* pass extension through _load

* hdu2data to not return data

* load_data: support list of filenames

* allow defaulting to have extension for data without extension

* strip out repeated data_label logic

* load_data: backwards compatibility for appending [DATA]

* orientation: bypass load_data

* load_data: backwards compatibility for appending extension to ImageHDU

* loaders: use filename/URL as default label (spacetelescope#3684)

* update to use filename as default prefix

* handle appending "extensions" for NDData

* fix HDUList case when providing data_label through load_data

* bypass NDData extension logic if coming from plugin (incl orientation)

* Revert "orientation: bypass load_data"

This reverts commit 2b49a73.

* fix tests

* maintain .reg support through load_data

* Specutils 2 compatibility (spacetelescope#2922)

* Remove jwst s3d parser now that it can be handled by Spectrum1D

* Update Jdaviz for specutils 2 compatibility

Fix coords mouseover when SkyCoord is before SpectralCoord

More debugging

Fix slice with different spectral_axis_index, add specutils_format kwarg to cubeviz parser

Remove unused import

Remove ESA parser from commissioning [skip ci]

Generalizing coords_info to handle spectral axis first or last [ci skip]

Working on debugging aperture photometry

Need to pull meta from data not comp

Fix aperture photometry and wrong coord order in coords_info

Fix codestyle, delete defunct case in parser

Change Spectrum1D to Spectrum

Change class name in recent code additions

Get spectral extraction working again for cylinder case

Debugging wavelength dependent case

Make sure spectral extraction result is linked when added to data collection

Moved fix to correct place

Fix indents

Remove stray code from rebase

Update missed Spectrum1D

Debugging cubeviz parser

First start on fixing testt

Fix bad rebase in spectral extraction

Starting to work through test failures

Working through test failures

Debugging spectral extraction

Fixing errors after rebase to  main

Finish fixing codestyle, probably still need functional fixes

Replace new occurances of Spectrum1D with Spectrum

Missed committing a file

(re-) fix spectral extraction

Handle checking GWCS for spectral subset, fix codestyle

More debugging

More debugging

Remove parent data label code reintroduced by rebase

* Update newer instances of Spectrum1D

* Working on resolving test failures

Trying to fix slicing

Add keyword in velocity calculation

Fix spectral extraction for arrays

Update collapse

Debugging moment maps

* Fix bugs revealed by CI and update tests with new values where needed

More debugging

Debugging cube model fitting

Fixing more tests

Debugging spectral extraction and collapse

Keep metadata in return_spectrum_with_correct_units

Update gaussian smooth tests

Take correct slice index in coords info

Look for SpectralGWCS for linking as well as SpectralCoordinate

More debugging

Fix spectrum-at-spaxel for spectral-first cubes, linking for plugin generated cubes

Fix model initialization and subset application for non-last spectral axis

Link moment maps to correct cube components

Update moment map test

Remove debugging prints

Update test value

Remove debugging prints

* Missed a couple codestyle things and Spectrum1D instances

Fix moment map test

* Fix remaining Spectrum1D instances

Codestyle

* Trying to fix tests related to this fixture

* Update test values here as well for fixed test fixture

* Changelog and updated specutils pin to use 2.0 RC

* Update test values for fixed test fixture

Codestyle

* Add missing spectral_axis_index to this case

* Temporarily pin glue-astronomy PR in dependencies

Also pin dev specreduce for now, for CI

Try this again...

Same thing for glue-astronomy

* Rename Spectrum1D instances after rebase to main

* Remove new Spectrum1D usage

* Glue-astronomy PR has been merged, pin to main

* Revert specutils intersphinx mapping to stable

* Fix cross dispersion profile wav calculation with specutils 2

* Update pins, fix aperture mask, update docs links

Update specutils documentation links

Fix specreduce pin

* Fix moment map coordinate handling for GWCS, slice check for data ndim=1

Fix another remote data test

* Remove duplicate line

* Generalize generate_spaxels

* Getting sonification working with specutils 2 and multiprocessing

More work on cube listener

Move wcs code to where it's actually used for readability

Still trying to get sonification working, wrong pixel axes are getting linked in external_links

Codestyle

Get percentile along correct axis for sonification

Link sonified data properly, fix expand_di axis

Missed this Spectrum1D

Got sonification working

Fix failing testtest

* Codestyle, debugging tests, addressing review comments

Fixing spectrum2d loader

Ignore warning in this test

Move time information to snackbar output

Revert check on len(subset_region)

* Fix two minor rebase problems

* Update jdaviz/configs/cubeviz/plugins/viewers.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Apply suggestions from code review

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Handle case where meta doesn't have spectral_axis_index

* Update jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* Ignore new FitsFixed warning

* Debugging failing test

* Fix failing spectrum2d test

* Make this more robust

---------

Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>

* allow API access to imviz.loaders

* nddata without meta

* for HDUList, always append extension to user-passed data_label

---------

Co-authored-by: Maarten Breddels <maartenbreddels@gmail.com>
Co-authored-by: Ricky O'Steen <39831871+rosteen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants