Skip to content

Conversation

@gibsongreen
Copy link
Contributor

@gibsongreen gibsongreen commented Jan 5, 2026

Added 63 new unit tests across 4 test modules to improve coverage of core slitlessutils functionality:

test_wfss_simulated.py

  • Validates simulated WFSS data creation and orientation handling
  • Tests detector configuration keywords (NAXIS, CRPIX, CRVAL, spectral orders)
  • Verifies WFSSCollection CSV loading and iteration
  • Edge case testing for coordinate systems and orientation angles

test_sources.py

  • Tests SourceCollection loading from segmentation maps
  • Validates source properties (segid, pixels, WCS)
  • Tests filtering parameters (minpix, maglim)
  • Verifies spectral parameter propagation
  • Edge cases: sources at image edges, single-pixel sources, high segid values

test_photometry.py

  • Tests Throughput loading from telescope/instrument/filter keys
  • Validates SED creation, data access, and normalization
  • Tests photometric workflows and integration
  • Edge cases: sharp filter edges, wavelength gaps, low transmission values

test_config.py

  • Validates Config singleton pattern
  • Tests required parameters (fluxscale, fluxunits, compression settings)
  • Verifies reference file paths and directory structure
  • Tests file suffix definitions

@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

❌ Patch coverage is 98.48485% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 39.50%. Comparing base (31375b4) to head (3d57e7e).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
slitlessutils/conftest.py 98.48% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
- Coverage   47.08%   39.50%   -7.59%     
==========================================
  Files         106      107       +1     
  Lines        6872     6971      +99     
==========================================
- Hits         3236     2754     -482     
- Misses       3636     4217     +581     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gibsongreen gibsongreen marked this pull request as ready for review January 6, 2026 15:19
photfnu = sample_throughput.photfnu

assert photfnu is not None, "PHOTFNU must be computable"
assert photfnu > 0, f"PHOTFNU must be positive, got {photfnu}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some checks like this throughout that I think should be an allclose on the exact value to make sure the calculated value isn't changing, since this should be a deterministic calculation. As it it isn't useless, but it could easily be more useful. Similarly, there are various places that are checking that the length of arrays is > 0 where we could be checking the actual values and/or exact length of the array.

sed = su.photometry.SED(wave, flux)
sed.normalize(10000., 5.0)
assert np.isclose(sed['flam'][50], 5.0, rtol=0.1)
assert np.allclose(sed['flam'][50], 5.0, rtol=0.1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't mean to imply that isclose needed to change to allclose, I'm just in the habit of using allclose since I'm usually working with arrays. Probably don't need to change it back though 🤷

@rosteen rosteen merged commit fdc1361 into spacetelescope:main Jan 12, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants