Skip to content

Commit 78dc510

Browse files
committed
Fix intermediate filenames and empty error extensions
1 parent 693ae3d commit 78dc510

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

jwst/adaptive_trace_model/adaptive_trace_model_step.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,19 @@ def process(self, input_data):
138138
model.meta.cal_step.adaptive_trace_model = "COMPLETE"
139139
if self.save_intermediate_results:
140140
_, full_spline, used_spline, linear, residual = results
141-
basepath = model.meta.filename
142141

143-
outpath = self.make_output_path(basepath=basepath, suffix="spline_full")
142+
outpath = self.make_output_path(suffix="spline_full")
144143
full_spline.save(outpath)
145144
full_spline.close()
146145
log.info(f"Saved full spline model in {outpath}")
147146

148-
outpath = self.make_output_path(basepath=basepath, suffix="spline_used")
147+
outpath = self.make_output_path(suffix="spline_used")
149148
used_spline.save(outpath)
150149
used_spline.close()
151150
log.info(f"Saved spline model for compact sources in {outpath}")
152151

153152
if linear is not None:
154-
outpath = self.make_output_path(basepath=basepath, suffix="linear_interp")
153+
outpath = self.make_output_path(suffix="linear_interp")
155154
linear.save(outpath)
156155
linear.close()
157156
log.info(f"Saved linearly interpolated data in {outpath}")
@@ -160,7 +159,7 @@ def process(self, input_data):
160159
f"No linearly interpolated data to save for oversample={self.oversample}"
161160
)
162161
if residual is not None:
163-
outpath = self.make_output_path(basepath=basepath, suffix="spline_residual")
162+
outpath = self.make_output_path(suffix="spline_residual")
164163
residual.save(outpath)
165164
residual.close()
166165
log.info(f"Saved spline residuals in {outpath}")

jwst/adaptive_trace_model/trace_model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def fit_2d_spline_trace(
137137

138138
# Scale the flux for fitting
139139
if fit_scale is not None:
140-
scaled_flux = flux / fit_scale
140+
with warnings.catch_warnings():
141+
warnings.filterwarnings("ignore", category=RuntimeWarning)
142+
scaled_flux = flux / fit_scale
141143
else:
142144
scaled_flux = flux
143145

@@ -1320,7 +1322,11 @@ def _intermediate_models(model, data_arrays):
13201322
else:
13211323
new_model = model_type(data=data)
13221324
new_model.update(model_for_update)
1325+
1326+
# prevent empty error arrays
13231327
new_model.err = None
1328+
new_model.meta.bunit_err = None
1329+
13241330
new_models.append(new_model)
13251331

13261332
if model_for_update is not model:

0 commit comments

Comments
 (0)