Skip to content
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

Remove all (including pipeline) uses of Step.__call__ #8945

Merged
merged 5 commits into from
Nov 8, 2024
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/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.
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 @@ -235,10 +235,10 @@
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)

Check warning on line 241 in jwst/master_background/master_background_mos_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/master_background/master_background_mos_step.py#L238-L241

Added lines #L238 - L241 were not covered by tests

# Create the 1D, fully calibrated master background.
if user_background:
Expand Down Expand Up @@ -269,9 +269,9 @@
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)

Check warning on line 275 in jwst/master_background/master_background_mos_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/master_background/master_background_mos_step.py#L272-L275

Added lines #L272 - L275 were not covered by tests

return master_background, mb_multislit
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 @@

# 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)

Check warning on line 77 in jwst/pipeline/calwebb_ami3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_ami3.py#L77

Added line #L77 was not covered by tests

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

# 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)

Check warning on line 93 in jwst/pipeline/calwebb_ami3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_ami3.py#L93

Added line #L93 was not covered by tests

# Save the LG analysis results to a file
result1.meta.asn.pool_name = asn['asn_pool']
Expand All @@ -104,7 +104,7 @@
# 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)

Check warning on line 107 in jwst/pipeline/calwebb_ami3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_ami3.py#L107

Added line #L107 was not covered by tests
# 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 @@
# 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)

Check warning on line 154 in jwst/pipeline/calwebb_coron3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_coron3.py#L154

Added line #L154 was not covered by tests
# 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)

Check warning on line 162 in jwst/pipeline/calwebb_coron3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_coron3.py#L162

Added line #L162 was not covered by tests
psf_models.close()

# Save the resulting PSF stack
Expand All @@ -175,13 +175,13 @@

# Remove outliers from the target
if not skip_outlier_detection:
target = self.outlier_detection(target)
target = self.outlier_detection.run(target)

Check warning on line 178 in jwst/pipeline/calwebb_coron3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_coron3.py#L178

Added line #L178 was not covered by tests
# 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)

Check warning on line 184 in jwst/pipeline/calwebb_coron3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_coron3.py#L184

Added line #L184 was not covered by tests

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

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

Check warning on line 193 in jwst/pipeline/calwebb_coron3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_coron3.py#L193

Added line #L193 was not covered by tests
psf_aligned.close()

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

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

Check warning on line 213 in jwst/pipeline/calwebb_coron3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_coron3.py#L213

Added line #L213 was not covered by tests

# 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 @@
# 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)

Check warning on line 79 in jwst/pipeline/calwebb_dark.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_dark.py#L70-L79

Added lines #L70 - L79 were not covered by tests

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)

Check warning on line 92 in jwst/pipeline/calwebb_dark.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_dark.py#L86-L92

Added lines #L86 - L92 were not covered by tests

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 @@
# 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)

Check warning on line 103 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L92-L103

Added lines #L92 - L103 were not covered by tests

# skip until MIRI team has figured out an algorithm
# input = self.persistence(input)
Expand All @@ -110,28 +110,28 @@
# 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)

Check warning on line 119 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L113-L119

Added lines #L113 - L119 were not covered by tests

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

Check warning on line 123 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L123

Added line #L123 was not covered by tests

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

Check warning on line 125 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L125

Added line #L125 was not covered by tests

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

Check warning on line 128 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L128

Added line #L128 was not covered by tests

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

Check warning on line 131 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L131

Added line #L131 was not covered by tests

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

Check warning on line 134 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L134

Added line #L134 was not covered by tests

# save the corrected ramp data, if requested
if self.save_calibrated_ramp:
Expand All @@ -143,23 +143,23 @@
# 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)

Check warning on line 146 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L146

Added line #L146 was not covered by tests
ints_model = None
else:
input, ints_model = self.ramp_fit(input)
input, ints_model = self.ramp_fit.run(input)

Check warning on line 149 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L149

Added line #L149 was not covered by tests

# 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)

Check warning on line 154 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L154

Added line #L154 was not covered by tests
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)

Check warning on line 162 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L162

Added line #L162 was not covered by tests
self.save_model(ints_model, 'rateints')

# setup output_file for saving
Expand All @@ -176,4 +176,4 @@
if input.meta.cal_step.ramp_fit == 'COMPLETE':
self.suffix = 'rate'
else:
self.suffix = 'ramp'
self.suffix = 'ramp'

Check warning on line 179 in jwst/pipeline/calwebb_detector1.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_detector1.py#L179

Added line #L179 was not covered by tests
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 @@
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)

Check warning on line 57 in jwst/pipeline/calwebb_guider.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_guider.py#L55-L57

Added lines #L55 - L57 were not covered by tests

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

Expand Down
10 changes: 5 additions & 5 deletions jwst/pipeline/calwebb_image2.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,20 @@
self.bkg_subtract.save_results = True

# Call the background subtraction step
input = self.bkg_subtract(input, members_by_type['background'])
input = self.bkg_subtract.run(input, members_by_type['background'])

Check warning on line 153 in jwst/pipeline/calwebb_image2.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_image2.py#L153

Added line #L153 was not covered by tests

# work on slope images
input = self.assign_wcs(input)
input = self.flat_field(input)
input = self.photom(input)
input = self.assign_wcs.run(input)
input = self.flat_field.run(input)
input = self.photom.run(input)

# Resample individual exposures, but only if it's one of the
# regular 2D science image types
if input.meta.exposure.type.upper() in self.image_exptypes and \
len(input.data.shape) == 2:
self.resample.save_results = self.save_results
self.resample.suffix = 'i2d'
self.resample(input)
self.resample.run(input)

# That's all folks
self.log.info(
Expand Down
16 changes: 8 additions & 8 deletions jwst/pipeline/calwebb_image3.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,24 @@
is_moving = is_moving_target(model)
input_models.shelve(model, 0, modify=False)
if is_moving:
input_models = self.assign_mtwcs(input_models)
input_models = self.assign_mtwcs.run(input_models)

Check warning on line 87 in jwst/pipeline/calwebb_image3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_image3.py#L87

Added line #L87 was not covered by tests
else:
input_models = self.tweakreg(input_models)
input_models = self.tweakreg.run(input_models)

input_models = self.skymatch(input_models)
input_models = self.outlier_detection(input_models)
input_models = self.skymatch.run(input_models)
input_models = self.outlier_detection.run(input_models)

elif self.skymatch.skymethod == 'match':
self.log.warning("Turning 'skymatch' step off for a single "
"input image when 'skymethod' is 'match'")

else:
input_models = self.skymatch(input_models)
input_models = self.skymatch.run(input_models)

Check warning on line 99 in jwst/pipeline/calwebb_image3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_image3.py#L99

Added line #L99 was not covered by tests

result = self.resample(input_models)
result = self.resample.run(input_models)
del input_models
if isinstance(result, datamodels.ImageModel) and result.meta.cal_step.resample == 'COMPLETE':
self.source_catalog(result)
self.source_catalog.run(result)

Check warning on line 104 in jwst/pipeline/calwebb_image3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_image3.py#L104

Added line #L104 was not covered by tests


def _load_input_as_library(self, input):
Expand All @@ -128,4 +128,4 @@
elif isinstance(input, datamodels.JwstDataModel):
return ModelLibrary([input], asn_exptypes=['science'], on_disk=not self.in_memory)
else:
raise TypeError(f"Input type {type(input)} not supported.")
raise TypeError(f"Input type {type(input)} not supported.")

Check warning on line 131 in jwst/pipeline/calwebb_image3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_image3.py#L131

Added line #L131 was not covered by tests
Loading
Loading