Skip to content

Commit

Permalink
initial attempt at fix
Browse files Browse the repository at this point in the history
  • Loading branch information
emolter committed Jun 25, 2024
1 parent 29046fc commit 5856a4b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 26 deletions.
7 changes: 3 additions & 4 deletions jwst/cube_build/cube_build_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,13 @@ def process(self, input):
if key in cube.meta.wcsinfo.instance:
del cube.meta.wcsinfo.instance[key]
if status_cube == 1:
self.skip = True
self.record_step_status(cube_container, "cube_build", success=False)

Check warning on line 399 in jwst/cube_build/cube_build_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/cube_build/cube_build_step.py#L399

Added line #L399 was not covered by tests
else:
self.record_step_status(cube_container, "cube_build", success=True)

t1 = time.time()
self.log.debug(f'Time to build all cubes {t1-t0}')

if status_cube == 1:
self.skip = True

input_table.close()
return cube_container
# ******************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions jwst/pipeline/calwebb_spec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def process_exposure_product(
# as DO_NOT_USE or NON_SCIENCE.
resampled = self.pixel_replace(resampled)
resampled = self.cube_build(resampled)
if not self.cube_build.skip:
if resampled[0].meta.cal_step.cube_build == 'COMPLETE':
self.save_model(resampled[0], suffix='s3d')
elif exp_type in ['MIR_LRS-SLITLESS']:
resampled = calibrated.copy()
Expand All @@ -346,7 +346,7 @@ def process_exposure_product(
# as DO_NOT_USE or NON_SCIENCE.
resampled = self.pixel_replace(resampled)
# Extract a 1D spectrum from the 2D/3D data
if exp_type in ['MIR_MRS', 'NRS_IFU'] and self.cube_build.skip:
if exp_type in ['MIR_MRS', 'NRS_IFU'] and resampled[0].meta.cal_step.cube_build == 'SKIPPED':
# Skip extract_1d for IFU modes where no cube was built
self.extract_1d.skip = True

Expand Down
2 changes: 1 addition & 1 deletion jwst/pipeline/calwebb_spec3.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def process(self, input):

# If the step is skipped, do the container splitting that
# would've been done in master_background
if self.master_background.skip:
if source_models[0].meta.cal_step.master_background == 'SKIPPED':

Check warning on line 151 in jwst/pipeline/calwebb_spec3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_spec3.py#L151

Added line #L151 was not covered by tests
source_models, bkg_models = split_container(input_models)
# we don't need the background members
bkg_models.close()
Expand Down
1 change: 0 additions & 1 deletion jwst/stpipe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def record_step_status(self, datamodel, cal_step, success=True):
status = 'COMPLETE'
else:
status = 'SKIPPED'
self.skip = True

if isinstance(datamodel, Sequence):
for model in datamodel:
Expand Down
24 changes: 6 additions & 18 deletions jwst/tweakreg/tweakreg_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ def process(self, input):
self.log.warning("At least two exposures are required for image "
"alignment.")
self.log.warning("Nothing to do. Skipping 'TweakRegStep'...")
self.skip = True
for model in images:
model.meta.cal_step.tweakreg = "SKIPPED"
self.record_step_status(input, "tweakreg", success=False)

Check warning on line 207 in jwst/tweakreg/tweakreg_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/tweakreg/tweakreg_step.py#L207

Added line #L207 was not covered by tests
return input

# === start processing images ===
Expand Down Expand Up @@ -311,10 +309,8 @@ def process(self, input):
self.log.warning("At least two exposures are required for "
"image alignment.")
self.log.warning("Nothing to do. Skipping 'TweakRegStep'...")
for model in images:
model.meta.cal_step.tweakreg = "SKIPPED"
self.record_step_status(images, "tweakreg", success=False)

Check warning on line 312 in jwst/tweakreg/tweakreg_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/tweakreg/tweakreg_step.py#L312

Added line #L312 was not covered by tests
if not align_to_abs_refcat:
self.skip = True
return images
local_align_failed = True
else:
Expand All @@ -329,9 +325,7 @@ def process(self, input):
"matched to a single reference source. Try to "
"adjust 'tolerance' and/or 'separation' parameters.")
self.log.warning("Skipping 'TweakRegStep'...")
self.skip = True
for model in images:
model.meta.cal_step.tweakreg = "SKIPPED"
self.record_step_status(images, "tweakreg", success=False)

Check warning on line 328 in jwst/tweakreg/tweakreg_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/tweakreg/tweakreg_step.py#L328

Added line #L328 was not covered by tests
return images
else:
raise e
Expand All @@ -341,9 +335,7 @@ def process(self, input):
self.log.warning("Skipping relative alignment (stage 1)...")
else:
self.log.warning("Skipping 'TweakRegStep'...")
self.skip = True
for model in images:
model.meta.cal_step.tweakreg = "SKIPPED"
self.record_step_status(images, "tweakreg", success=False)

Check warning on line 338 in jwst/tweakreg/tweakreg_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/tweakreg/tweakreg_step.py#L338

Added line #L338 was not covered by tests
return images

if align_to_abs_refcat:
Expand Down Expand Up @@ -461,9 +453,7 @@ def process(self, input):
)
if local_align_failed or n_groups == 1:
self.log.warning("Nothing to do. Skipping 'TweakRegStep'...")
for model in images:
model.meta.cal_step.tweakreg = "SKIPPED"
self.skip = True
self.record_step_status(images, "tweakreg", success=False)

Check warning on line 456 in jwst/tweakreg/tweakreg_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/tweakreg/tweakreg_step.py#L456

Added line #L456 was not covered by tests
return images
else:
raise e
Expand All @@ -482,9 +472,7 @@ def process(self, input):
)
if local_align_failed or n_groups == 1:
self.log.warning("Skipping 'TweakRegStep'...")
self.skip = True
for model in images:
model.meta.cal_step.tweakreg = "SKIPPED"
self.record_step_status(images, "tweakreg", success=False)

Check warning on line 475 in jwst/tweakreg/tweakreg_step.py

View check run for this annotation

Codecov / codecov/patch

jwst/tweakreg/tweakreg_step.py#L475

Added line #L475 was not covered by tests
return images
else:
raise e
Expand Down

0 comments on commit 5856a4b

Please sign in to comment.