Skip to content

Commit

Permalink
Merge pull request #164 from LSSTDESC/163-bug-when-saving-order2-if-i…
Browse files Browse the repository at this point in the history
…t-was-not-extracted

put zero arrays for second order if None when saving fits file
  • Loading branch information
jeremyneveu authored Dec 5, 2024
2 parents b92627a + 04dc5df commit ad23bfc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spectractor/extractor/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,13 @@ def save_spectrum(self, output_file_name, overwrite=False):
if extname == "SPEC_COV":
hdus[extname].data = self.cov_matrix
elif extname == "ORDER2":
hdus[extname].data = [self.lambdas, self.data_next_order, self.err_next_order]
if self.data_next_order is None:
data_next_order = np.zeros_like(self.data)
err_next_order = np.zeros_like(self.err)
else:
data_next_order = self.data_next_order
err_next_order = self.err_next_order
hdus[extname].data = [self.lambdas, data_next_order, err_next_order]
elif extname == "ORDER0":
hdus[extname].data = self.target.image
hdus[extname].header["IM_X0"] = self.target.image_x0
Expand Down

0 comments on commit ad23bfc

Please sign in to comment.