Skip to content

Commit

Permalink
Merge branch 'main' into improve_combine1d
Browse files Browse the repository at this point in the history
  • Loading branch information
melanieclarke authored Nov 15, 2024
2 parents 76d218b + e9a482d commit ccc9905
Show file tree
Hide file tree
Showing 37 changed files with 405 additions and 319 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
1.16.1 (2024-10-30)
===================

resample_spec
-------------

- Update NIRSpec spectral resampling to add a missing correction factor in resampled
WCS tangent plane transformation. [#8908]

1.16.0 (2024-09-20)
===================

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,13 @@ the specified context and less than the context for the next release.

| jwst tag | DMS build | SDP_VER | CRDS_CONTEXT | Released | Ops Install | Notes |
|---------------------|-----------|----------|--------------|------------|-------------|-----------------------------------------------|
| 1.16.0 | B11.1rc1 | TBD | 1281 | 2024-09-20 | TBD | First release candidate for B11.1 |
| 1.15.1 | B11.0 | 2024.2.2 | 1242 | 2024-07-08 | 2024-09-12 | Final release candidate for B11.0 |
| 1.15.0 | B11.0rc1 | | 1241 | 2024-06-26 | | First release candidate for B11.0 |
| 1.14.1 | | | 1238 | 2024-06-27 | | PyPI-only release for external users |
| 1.14.0 | B10.2.1 | 2024.1.1 | 1238 | 2024-03-29 | 2024-06-12 | Final release candidate for B10.2.1 |
| 1.13.4 | | | 1185 | 2024-01-25 | | PyPI-only release for external users |
| 1.16.1 | B11.1.1 | 2024.3.1 | 1298 | 2024-11-13 | TBD | Final release candidate for B11.1 |
| 1.16.0 | B11.1 | 2024.3.0 | 1298 | 2024-09-20 | TBD | First release candidate for B11.1 |
| 1.15.1 | B11.0 | 2024.2.2 | 1293 | 2024-07-08 | 2024-09-12 | Final release candidate for B11.0 |
| 1.15.0 | B11.0rc1 | | 1274 | 2024-06-26 | | First release candidate for B11.0 |
| 1.14.1 | | | 1240 | 2024-06-27 | | PyPI-only release for external users |
| 1.14.0 | B10.2.1 | 2024.1.1 | 1240 | 2024-03-29 | 2024-06-12 | Final release candidate for B10.2.1 |
| 1.13.4 | | | 1210 | 2024-01-25 | | PyPI-only release for external users |
| 1.13.3 | B10.1 | 2023.4.0 | 1181 | 2024-01-05 | | Final release candidate for B10.1 |
| 1.13.2 | B10.1rc3 | 2023.4.0 | 1181 | 2023-12-21 | | Third release candidate for B10.1 |
| 1.13.1 | B10.1rc2 | 2023.4.0 | 1181 | 2023-12-19 | | Second release candidate for B10.1 |
Expand Down
1 change: 1 addition & 0 deletions changes/8893.resample.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use s_region list to calculate output footprint instead of re-computing via WCS transforms
1 change: 1 addition & 0 deletions changes/8927.combine_1d.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix wavelength sort order for single input spectrum.
1 change: 1 addition & 0 deletions changes/8927.master_background.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ModelContainer handling for user background input.
1 change: 1 addition & 0 deletions changes/8927.pipeline.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add 'mbsub' to the list of known suffixes, for ``master_background`` correction in ``calwebb_spec3``.
1 change: 1 addition & 0 deletions changes/8945.stpipe.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove all uses of Step.__call__ to allow it's deprecation.
4 changes: 4 additions & 0 deletions jwst/assign_mtwcs/moving_target_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

from jwst.datamodels import ModelLibrary
from jwst.stpipe.utilities import record_step_status
from jwst.assign_wcs.util import update_s_region_imaging
from jwst.lib.exposure_types import IMAGING_TYPES

log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
Expand Down Expand Up @@ -69,6 +71,8 @@ def assign_moving_target_wcs(input_models):
model.meta.wcsinfo.mt_ra, model.meta.wcsinfo.mt_dec)
del model.meta.wcs
model.meta.wcs = new_wcs
if model.meta.exposure.type.lower() in IMAGING_TYPES:
update_s_region_imaging(model)
record_step_status(model, "assign_mtwcs", True)
input_models.shelve(model, i, modify=True)

Expand Down
2 changes: 1 addition & 1 deletion jwst/combine_1d/combine1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def count_input(input_spectra):
# only include spectra that have more than 1 data point
if len(input_wl) > 1:
if wl is None:
wl = input_wl
wl = input_wl.copy()
else:
wl = np.hstack((input_wl, wl))
wl.sort()
Expand Down
2 changes: 1 addition & 1 deletion jwst/lib/suffix.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
'c1d', 'cal', 'calints', 'cat', 'crf', 'crfints',
'dark',
'i2d',
'median',
'mbsub', 'median',
'phot', 'psf-amiavg', 'psfalign', 'psfstack', 'psfsub',
'ramp', 'rate', 'rateints', 'residual_fringe',
's2d', 's3d', 'snr',
Expand Down
16 changes: 8 additions & 8 deletions jwst/master_background/master_background_mos_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ def _calc_master_background(
self.barshadow.source_type = 'EXTENDED'
self.photom.source_type = 'EXTENDED'

pre_calibrated = self.flat_field(data)
pre_calibrated = self.pathloss(pre_calibrated)
pre_calibrated = self.barshadow(pre_calibrated)
pre_calibrated = self.photom(pre_calibrated)
pre_calibrated = self.flat_field.run(data)
pre_calibrated = self.pathloss.run(pre_calibrated)
pre_calibrated = self.barshadow.run(pre_calibrated)
pre_calibrated = self.photom.run(pre_calibrated)

# Create the 1D, fully calibrated master background.
if user_background:
Expand Down Expand Up @@ -294,9 +294,9 @@ def _calc_master_background(
self.flat_field.use_correction_pars = True
self.flat_field.inverse = True

mb_multislit = self.photom(mb_multislit)
mb_multislit = self.barshadow(mb_multislit)
mb_multislit = self.pathloss(mb_multislit)
mb_multislit = self.flat_field(mb_multislit)
mb_multislit = self.photom.run(mb_multislit)
mb_multislit = self.barshadow.run(mb_multislit)
mb_multislit = self.pathloss.run(mb_multislit)
mb_multislit = self.flat_field.run(mb_multislit)

return master_background, mb_multislit, bkg_x1d_spectra
3 changes: 1 addition & 2 deletions jwst/master_background/master_background_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def process(self, input):
del _
result = ModelContainer()
background_2d_collection = ModelContainer()
background_2d_collection.update(input_data)
for model in input_data:
background_2d = expand_to_2d(model, self.user_background)
result.append(subtract_2d_background(model, background_2d))
Expand All @@ -109,7 +108,7 @@ def process(self, input):
else:
asn_id = None
background_2d = expand_to_2d(input_data, self.user_background)
background_2d_collection = background_2d
background_2d_collection = ModelContainer([background_2d])
result = subtract_2d_background(input_data, background_2d)
# Record name of user-supplied master background spectrum
result.meta.background.master_background_file = basename(self.user_background)
Expand Down
2 changes: 2 additions & 0 deletions jwst/outlier_detection/tests/test_outlier_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from gwcs.wcs import WCS
from stdatamodels.jwst import datamodels
from stcal.alignment.util import compute_s_region_imaging

from jwst.datamodels import ModelContainer, ModelLibrary
from jwst.assign_wcs import AssignWcsStep
Expand Down Expand Up @@ -151,6 +152,7 @@ def we_many_sci(

# Replace the FITS-type WCS with an Identity WCS
sci1.meta.wcs = create_fitswcs(sci1)
sci1.meta.wcsinfo.s_region = compute_s_region_imaging(sci1.meta.wcs, shape=shape, center=False)
rng = np.random.default_rng(720)
sci1.data = rng.normal(loc=background, size=shape, scale=sigma)
sci1.err = np.zeros(shape) + sigma
Expand Down
6 changes: 3 additions & 3 deletions jwst/pipeline/calwebb_ami3.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def process(self, input):

# Do the LG analysis for this image
log.debug('Do LG processing for member %s', input_file)
result1, result2, result3 = self.ami_analyze(input_file)
result1, result2, result3 = self.ami_analyze.run(input_file)

# Save the averaged LG analysis results to a file
result1.meta.asn.pool_name = asn['asn_pool']
Expand All @@ -90,7 +90,7 @@ def process(self, input):

# Do the LG analysis for this image
log.debug('Do LG processing for member %s', input_file)
result1, result2, result3 = self.ami_analyze(input_file)
result1, result2, result3 = self.ami_analyze.run(input_file)

# Save the LG analysis results to a file
result1.meta.asn.pool_name = asn['asn_pool']
Expand All @@ -104,7 +104,7 @@ def process(self, input):
# assuming one ref star exposure per targ exposure
if (len(psf_files) > 0) & (len(targ_files) > 0):
for (targ, psf) in zip(targ_lg,psf_lg):
result = self.ami_normalize(targ, psf)
result = self.ami_normalize.run(targ, psf)
# Save the result
result.meta.asn.pool_name = asn['asn_pool']
result.meta.asn.table_name = op.basename(asn.filename)
Expand Down
12 changes: 6 additions & 6 deletions jwst/pipeline/calwebb_coron3.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ def process(self, user_input):
# Perform outlier detection on the PSFs.
if not skip_outlier_detection:
for model in psf_models:
self.outlier_detection(model)
self.outlier_detection.run(model)
# step may have been skipped for this model;
# turn back on for next model
self.outlier_detection.skip = False
else:
self.log.info('Outlier detection skipped for PSF\'s')

# Stack all the PSF images into a single CubeModel
psf_stack = self.stack_refs(psf_models)
psf_stack = self.stack_refs.run(psf_models)
psf_models.close()

# Save the resulting PSF stack
Expand All @@ -175,13 +175,13 @@ def process(self, user_input):

# Remove outliers from the target
if not skip_outlier_detection:
target = self.outlier_detection(target)
target = self.outlier_detection.run(target)
# step may have been skipped for this model;
# turn back on for next model
self.outlier_detection.skip = False

# Call align_refs
psf_aligned = self.align_refs(target, psf_stack)
psf_aligned = self.align_refs.run(target, psf_stack)

# Save the alignment results
self.save_model(
Expand All @@ -190,7 +190,7 @@ def process(self, user_input):
)

# Call KLIP
psf_sub = self.klip(target, psf_aligned)
psf_sub = self.klip.run(target, psf_aligned)
psf_aligned.close()

# Save the psf subtraction results
Expand All @@ -210,7 +210,7 @@ def process(self, user_input):
resample_library = ModelLibrary(resample_input, on_disk=False)

# Output is a single datamodel
result = self.resample(resample_library)
result = self.resample.run(resample_library)

# Blend the science headers
try:
Expand Down
34 changes: 17 additions & 17 deletions jwst/pipeline/calwebb_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@ def process(self, input):
# the steps are in a different order than NIR
log.debug('Processing a MIRI exposure')

input = self.group_scale(input)
input = self.dq_init(input)
input = self.emicorr(input)
input = self.saturation(input)
input = self.ipc(input)
input = self.firstframe(input)
input = self.lastframe(input)
input = self.reset(input)
input = self.linearity(input)
input = self.rscd(input)
input = self.group_scale.run(input)
input = self.dq_init.run(input)
input = self.emicorr.run(input)
input = self.saturation.run(input)
input = self.ipc.run(input)
input = self.firstframe.run(input)
input = self.lastframe.run(input)
input = self.reset.run(input)
input = self.linearity.run(input)
input = self.rscd.run(input)

else:

# process Near-IR exposures
log.debug('Processing a Near-IR exposure')

input = self.group_scale(input)
input = self.dq_init(input)
input = self.saturation(input)
input = self.ipc(input)
input = self.superbias(input)
input = self.refpix(input)
input = self.linearity(input)
input = self.group_scale.run(input)
input = self.dq_init.run(input)
input = self.saturation.run(input)
input = self.ipc.run(input)
input = self.superbias.run(input)
input = self.refpix.run(input)
input = self.linearity.run(input)

log.info('... ending calwebb_dark')

Expand Down
58 changes: 29 additions & 29 deletions jwst/pipeline/calwebb_detector1.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ def process(self, input):
# the steps are in a different order than NIR
log.debug('Processing a MIRI exposure')

input = self.group_scale(input)
input = self.dq_init(input)
input = self.emicorr(input)
input = self.saturation(input)
input = self.ipc(input)
input = self.firstframe(input)
input = self.lastframe(input)
input = self.reset(input)
input = self.linearity(input)
input = self.rscd(input)
input = self.dark_current(input)
input = self.refpix(input)
input = self.group_scale.run(input)
input = self.dq_init.run(input)
input = self.emicorr.run(input)
input = self.saturation.run(input)
input = self.ipc.run(input)
input = self.firstframe.run(input)
input = self.lastframe.run(input)
input = self.reset.run(input)
input = self.linearity.run(input)
input = self.rscd.run(input)
input = self.dark_current.run(input)
input = self.refpix.run(input)

# skip until MIRI team has figured out an algorithm
# input = self.persistence(input)
Expand All @@ -110,28 +110,28 @@ def process(self, input):
# process Near-IR exposures
log.debug('Processing a Near-IR exposure')

input = self.group_scale(input)
input = self.dq_init(input)
input = self.saturation(input)
input = self.ipc(input)
input = self.superbias(input)
input = self.refpix(input)
input = self.linearity(input)
input = self.group_scale.run(input)
input = self.dq_init.run(input)
input = self.saturation.run(input)
input = self.ipc.run(input)
input = self.superbias.run(input)
input = self.refpix.run(input)
input = self.linearity.run(input)

# skip persistence for NIRSpec
if instrument != 'NIRSPEC':
input = self.persistence(input)
input = self.persistence.run(input)

input = self.dark_current(input)
input = self.dark_current.run(input)

# apply the charge_migration step
input = self.charge_migration(input)
input = self.charge_migration.run(input)

# apply the jump step
input = self.jump(input)
input = self.jump.run(input)

# apply the clean_flicker_noise step
input = self.clean_flicker_noise(input)
input = self.clean_flicker_noise.run(input)

# save the corrected ramp data, if requested
if self.save_calibrated_ramp:
Expand All @@ -143,23 +143,23 @@ def process(self, input):
# objects, but when the step is skipped due to `skip = True`,
# only the input is returned when the step is invoked.
if self.ramp_fit.skip:
input = self.ramp_fit(input)
input = self.ramp_fit.run(input)
ints_model = None
else:
input, ints_model = self.ramp_fit(input)
input, ints_model = self.ramp_fit.run(input)

# apply the gain_scale step to the exposure-level product
if input is not None:
self.gain_scale.suffix = 'gain_scale'
input = self.gain_scale(input)
input = self.gain_scale.run(input)
else:
log.info("NoneType returned from ramp_fit. Gain Scale step skipped.")

# apply the gain scale step to the multi-integration product,
# if it exists, and then save it
if ints_model is not None:
self.gain_scale.suffix = 'gain_scaleints'
ints_model = self.gain_scale(ints_model)
ints_model = self.gain_scale.run(ints_model)
self.save_model(ints_model, 'rateints')

# setup output_file for saving
Expand All @@ -176,4 +176,4 @@ def setup_output(self, input):
if input.meta.cal_step.ramp_fit == 'COMPLETE':
self.suffix = 'rate'
else:
self.suffix = 'ramp'
self.suffix = 'ramp'
6 changes: 3 additions & 3 deletions jwst/pipeline/calwebb_guider.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def process(self, input):
input = datamodels.GuiderRawModel(input)

# Apply the steps
input = self.dq_init(input)
input = self.guider_cds(input)
input = self.flat_field(input)
input = self.dq_init.run(input)
input = self.guider_cds.run(input)
input = self.flat_field.run(input)

log.info('... ending calwebb_guider')

Expand Down
Loading

0 comments on commit ccc9905

Please sign in to comment.