8000 JP-1636: Fix slit wcs issue in extract_1d apcorr by hbushouse · Pull Request #5260 · spacetelescope/jwst · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JP-1636: Fix slit wcs issue in extract_1d apcorr #5260

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 2 commits into from
Aug 20, 2020
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
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ extract_1d

- Fixed the conversion of flux to surface brightness for IFU extended source case [#5201]

- Fixed bugs in aperture correction for NIRSpec multi-slit modes. [#5260]

extract_2d
----------

Expand Down
10 changes: 7 additions & 3 deletions jwst/extract_1d/apply_apcorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class ApCorrBase(abc.ABC):
apcorr_row_units : str, Optional
Units for the aperture correction data "row" values (assuming the aperture correction is a 2D array).
If not given, units will be determined from the input apcorr_table ColDefs if possible.
slit_name : str, Optional
For MultiSlitModels, the name of the slit being processed.

Raises
------
Expand Down Expand Up @@ -56,13 +58,14 @@ class ApCorrBase(abc.ABC):
size_key = None

def __init__(self, input_model: DataModel, apcorr_table: fits.FITS_rec, sizeunit: str,
location: Tuple[float, float, float] = None, **match_kwargs):
location: Tuple[float, float, float] = None, slit_name: str = None, **match_kwargs):
self.correction = None

self.model = input_model
self._reference_table = apcorr_table
self.location = location
self.apcorr_sizeunits = sizeunit
self.slit_name = slit_name

self.match_keys = self._get_match_keys()
self.match_pars = self._get_match_pars()
Expand All @@ -77,10 +80,11 @@ def _convert_size_units(self):
if self.apcorr_sizeunits.startswith('arcsec'):
if self.location is not None:
if isinstance(self.m 8000 odel, MultiSlitModel):
idx = [slit.name for slit in self.model.slits].index(self.slit_name)
self.reference[self.size_key] /= compute_scale(
self.model.slits[0].meta.wcs,
self.model.slits[idx].meta.wcs,
self.location,
disp_axis=self.model.slits[0].meta.wcsinfo.dispersion_direction
disp_axis=self.model.slits[idx].meta.wcsinfo.dispersion_direction
)
else:
self.reference[self.size_key] /= compute_scale(
Expand Down
10 changes: 6 additions & 4 deletions jwst/extract_1d/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,8 @@ def do_extract1d(
match_kwargs['slit'] = slitname

apcorr = select_apcorr(input_model)(
input_model, apcorr_ref_model.apcorr_table, apcorr_ref_model.sizeunit, **match_kwargs
input_model, apcorr_ref_model.apcorr_table, apcorr_ref_model.sizeunit,
slit_name = slitname, **match_kwargs
)
apcorr.apply(spec.spec_table)

Expand Down Expand Up @@ -2987,7 +2988,7 @@ def do_extract1d(
# ImageModel now has the attributes we will look for in this function.
copy_keyword_info(input_model, slitname, spec)

if source_type.upper() == 'POINT' and apcorr_ref_model is not None:
if source_type is not None and source_type.upper() == 'POINT' and apcorr_ref_model is not None:
log.info('Applying Aperture correction.')

if instrument == 'NIRSPEC':
Expand Down Expand Up @@ -3142,7 +3143,7 @@ def do_extract1d(
spec.dispersion_direction = extract_params['dispaxis']
copy_keyword_info(input_model, slitname, spec)

if source_type.upper() == 'POINT' and apcorr_ref_model is not None:
if source_type is not None and source_type.upper() == 'POINT' and apcorr_ref_model is not None:
log.info('Applying Aperture correction.')

if instrument == 'NIRSPEC':
Expand All @@ -3155,7 +3156,8 @@ def do_extract1d(
match_kwargs['slit'] = slitname

apcorr = select_apcorr(input_model)(
input_model, apcorr_ref_model.apcorr_table, apcorr_ref_model.sizeunit, **match_kwargs
input_model, apcorr_ref_model.apcorr_table, apcorr_ref_model.sizeunit,
slit_name = slitname, **match_kwargs
)
apcorr.apply(spec.spec_table)

Expand Down
0