-
Notifications
You must be signed in to change notification settings - Fork 9
Cutout bounds fix #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Cutout bounds fix #136
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
36a9774
fix: fix filling corners and proper lengths especially when requested…
at88mph 193bf5e
fix: reset bumped order of repos
at88mph cf732c4
fix: cadc soda server fix for obsolete test compile
at88mph 58cdebf
fix: remove dependency on latest cadc wcs as there is nothing in the …
at88mph b71adff
fix: conform to checkstyle name
at88mph 051c10e
fix: return gradle version back to 6_8_3
at88mph 7bc9643
fix: rename axes to better match fits and do the 2 calculation inside
at88mph 51ab089
Merge branch 'main' of https://github.com/opencadc/dal into cutout-bo…
at88mph 28adb56
Merge branch 'main' of https://github.com/opencadc/dal into cutout-bo…
at88mph eb267ae
Merge branch 'main' of https://github.com/opencadc/dal into cutout-bo…
at88mph bc63fe0
fix: re use caom2 cutout logic
at88mph d76d49c
fix: fixed test header with padding and removed deprecated warnings
at88mph aa63599
fix: proper padding to header
at88mph 988e0bb
fix: fixing wcs cutout error for spectral axis
at88mph 49b9dcd
fix: hush the linter
at88mph bba28ac
fix: update top level opencadc gradle file
at88mph 0e5124b
fix: remove settings added by ide
at88mph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
cadc-data-ops-fits/src/main/java/org/opencadc/fits/slice/AxisBoundsFiller.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package org.opencadc.fits.slice; | ||
|
|
||
| import java.util.Arrays; | ||
| import nom.tam.fits.header.Standard; | ||
| import org.apache.log4j.Logger; | ||
|
|
||
|
|
||
| /** | ||
| * Fills a flat {@code long[naxis*2]} bounds array: the cut axis uses clipped interval coordinates | ||
| * ({@code clippedBounds[0]},{@code clippedBounds[1]} when present); every other axis spans | ||
| * {@code [1, NAXISn]} for that axis. {@code naxisPerAxis.length} must equal {@code naxis} (FITS | ||
| * NAXIS1..NAXISn sizes in axis order). | ||
| */ | ||
| public class AxisBoundsFiller { | ||
| private static final Logger LOGGER = Logger.getLogger(AxisBoundsFiller.class); | ||
|
|
||
| /** | ||
| * @param naxis FITS NAXIS (number of axes); array length in elements is {@code 2 * naxis} | ||
| * @param clippedBounds pixel bounds on {@code clipAxis} (up to two values), or {@code null} only | ||
| * when {@code naxis} is 0 | ||
| * @param clipAxis 1-based axis index receiving {@code clippedBounds} | ||
| * @param naxisPerAxis per-axis NAXISn lengths, length {@code naxis} | ||
| */ | ||
| static long[] fill(final int naxis, final long[] clippedBounds, final int clipAxis, final int[] naxisPerAxis) { | ||
| LOGGER.debug("Filling bounds for naxis=" + naxis + ", clip axis " + clipAxis + ", clipped bounds " | ||
| + Arrays.toString(clippedBounds)); | ||
| final int flatLen = 2 * naxis; | ||
| final long[] bounds = new long[flatLen]; | ||
| for (int i = 0; i < flatLen; i += 2) { | ||
| final int axis = (i + 2) / 2; | ||
| if (axis == clipAxis) { | ||
| bounds[i] = clippedBounds != null && clippedBounds.length > 0 ? clippedBounds[0] : 1L; | ||
| bounds[i + 1] = clippedBounds != null && clippedBounds.length > 1 | ||
| ? clippedBounds[1] : naxisPerAxis[axis - 1]; | ||
| } else { | ||
| bounds[i] = 1L; | ||
| bounds[i + 1] = naxisPerAxis[axis - 1]; | ||
| } | ||
| } | ||
| LOGGER.debug("Filled bounds: " + Arrays.toString(bounds)); | ||
|
|
||
| return bounds; | ||
| } | ||
|
|
||
| static int[] naxisSizes(final FITSHeaderWCSKeywords wcs, final int naxis) { | ||
| final int[] sizes = new int[naxis]; | ||
| for (int a = 1; a <= naxis; a++) { | ||
| sizes[a - 1] = wcs.getIntValue(Standard.NAXISn.n(a).key()); | ||
| } | ||
| return sizes; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.