Skip to content

Commit 01a7086

Browse files
authored
suppress adding (combining) of cal-spectra on fits file level (#457)
1 parent 558ea83 commit 01a7086

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

stixcore/processing/L1toL2.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,20 @@ def process_type(files, *, processor, soopmanager, spice_kernel_path, config):
104104
for l2 in tmp.from_level1(
105105
l1, parent=complete_file_name, idlprocessor=idlprocessor, ecc_manager=ecc_manager
106106
):
107-
new_files = processor.write_fits(l2)
108-
all_files.extend(new_files)
107+
try:
108+
new_files = processor.write_fits(l2)
109+
all_files.extend(new_files)
110+
# we have to check in the for loop as some products might create
111+
# multiple files and some of them might be combinable and some not
112+
except NotCombineException as nc:
113+
logger.warning(nc)
114+
109115
# if a batch of X files have summed up run the IDL processing
110116
if idlprocessor.opentasks >= max_idlbatch:
111117
all_files.extend(idlprocessor.process())
112118
idlprocessor = SSWIDLProcessor(processor)
113119
except (NoMatchError, KeyError):
114120
logger.warning("No L2 product match for product %s", l1)
115-
except NotCombineException as nc:
116-
logger.info(nc)
117121
except Exception as e:
118122
logger.error("Error processing file %s", file, exc_info=True)
119123
logger.error("%s", e)

stixcore/products/CAL/energy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from stixcore.calibration.ecc_post_fit import ecc_post_fit_on_fits
1414
from stixcore.calibration.elut_manager import ELUTManager
1515
from stixcore.config.config import CONFIG
16+
from stixcore.products.level0.scienceL0 import NotCombineException
1617
from stixcore.products.product import EnergyChannelsMixin, GenericProduct, L2Mixin
1718
from stixcore.time import SCETimeRange
1819
from stixcore.util.logging import get_logger
@@ -412,3 +413,6 @@ def from_level1(cls, l1product, parent="", idlprocessor=None, ecc_manager=None):
412413
# end of for each spectrum
413414

414415
return products
416+
417+
def __add__(self, other):
418+
raise NotCombineException(f"Tried to combine 2 cal_energy products: \n{self} and \n{other}")

0 commit comments

Comments
 (0)