Skip to content

Cutout bounds fix#136

Merged
pdowler merged 17 commits into
opencadc:mainfrom
at88mph:cutout-bounds-fix
Jun 30, 2026
Merged

Cutout bounds fix#136
pdowler merged 17 commits into
opencadc:mainfrom
at88mph:cutout-bounds-fix

Conversation

@at88mph

@at88mph at88mph commented Apr 23, 2026

Copy link
Copy Markdown
Member

Changes

  • NDimensionalSlicer: Fills cornet/span logic when a cutout’s requested bounds extend past the real image, using intersection so lengths and striding are correct instead of capping the difference in a way that can mis-size slices.
  • EnergyCutout: Clamps the requested barycentric metre interval to the cube’s spectral extent (linear WCS at channels 1 and N before WCS sky2pix, so e.g. (-Inf, λ) past the high edge still clips to the band instead of no overlap; overlap in pixel space uses a 1…N native span consistent with FITSCutout.clip.
  • AxisBoundsFiller (replaces the former “bounds clipper” idea): Puts the clipped 1D interval on the chosen energy/polarization axis and [1, NAXISn] on all other axes (no longer reusing a single “length 60” for every axis).
  • PolarizationCutout: Returns null when there is no overlap on the Stokes axis (instead of an empty long[]); uses AxisBoundsFiller with per-axis sizes.
  • Gradle upgrade for version 8 to allow for JDK 21, and added unit tests

Use case was to fix an Energy cutout where requested bounds exceeded the image cube bounds, but should be clipped.

@pdowler

pdowler commented Apr 23, 2026

Copy link
Copy Markdown
Member

I do not want to upgrade java version and gradle wrapper in this repo yet... need to evaluate impact on other devs.

@pdowler pdowler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some details that should be looked at carefully.

Comment thread cadc-data-ops-fits/src/main/java/org/opencadc/fits/slice/AxisBoundsFiller.java Outdated
Comment thread cadc-data-ops-fits/src/main/java/org/opencadc/fits/slice/EnergyCutout.java Outdated
Comment thread cadc-data-ops-fits/src/main/java/org/opencadc/fits/slice/EnergyCutout.java Outdated
@pdowler pdowler merged commit cd242b0 into opencadc:main Jun 30, 2026
1 check passed
@at88mph at88mph deleted the cutout-bounds-fix branch June 30, 2026 21:35
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