From 04dc5dfbecc73cb3f0a6b3f00a7bc2327075a2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Neveu?= Date: Wed, 4 Dec 2024 10:25:04 +0000 Subject: [PATCH] put zero arrays for second order if None when saving the spectrum fits file --- spectractor/extractor/spectrum.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spectractor/extractor/spectrum.py b/spectractor/extractor/spectrum.py index 88c3b87e..07262fed 100644 --- a/spectractor/extractor/spectrum.py +++ b/spectractor/extractor/spectrum.py @@ -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