Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/9606.cube_build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix slice width calculation for NIRSpec IFU with a new-style slice map WCS.
15 changes: 5 additions & 10 deletions jwst/cube_build/ifu_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2181,24 +2181,19 @@ def map_nirspec_pixel_to_sky(self, input_model, offsets):
dec3_det = np.zeros((ysize, xsize))
dec4_det = np.zeros((ysize, xsize))

pixfrac = 1.0

# determine the slice width using slice 1 and 3
slice_wcs1 = nirspec.nrs_wcs_set_input(input_model, 0)
detector2slicer = slice_wcs1.get_transform("detector", "slicer")
x, y = wcstools.grid_from_bounding_box(slice_wcs1.bounding_box)
across1, along1, _ = detector2slicer(x, y - 0.4999 * pixfrac)
across1 = across1[~np.isnan(across1)]
slice_loc1 = np.unique(across1)
mean_x, mean_y = np.mean(slice_wcs1.bounding_box[0]), np.mean(slice_wcs1.bounding_box[1])
slice_loc1, _, _ = detector2slicer(mean_x, mean_y)

slice_wcs3 = nirspec.nrs_wcs_set_input(input_model, 2)
detector2slicer = slice_wcs3.get_transform("detector", "slicer")
x, y = wcstools.grid_from_bounding_box(slice_wcs3.bounding_box)
across3, along3, _ = detector2slicer(x, y - 0.4999 * pixfrac)
across3 = across3[~np.isnan(across3)]
slice_loc3 = np.unique(across3)
mean_x, mean_y = np.mean(slice_wcs3.bounding_box[0]), np.mean(slice_wcs3.bounding_box[1])
slice_loc3, _, _ = detector2slicer(mean_x, mean_y)

across_width = abs(slice_loc1 - slice_loc3)

# for NIRSPEC each file has 30 slices
# wcs information access separately for each slice
nslices = 30
Expand Down
Loading