Source code for ecpi.process.dpco.dpco_with_files

"""
@author: BACON Philippe, APC/IN2P3/CNRS
"""
import logging

from ecpi.common import add_path_current_module
from ecpi.process.generic.composant import GenericComposantProcessing
from ecpi.process.bube.bube_with_files import ProcessBubeWithFiles
from ecpi.process.dpco.io.outputs import save_cal_events

s_logger = logging.getLogger(__name__)

DPCO_FILE_SCHEME = add_path_current_module(__file__, "io/dpco_schema.json")  


[docs]class ProcessDpcoWithFiles(ProcessBubeWithFiles): """ High level handling of DPCO module. """ def __init__(self): """**Constructor** """ s_logger.info("Starting DPCO module") GenericComposantProcessing.__init__(self, DPCO_FILE_SCHEME) self.name = "dpco" self.error_range = 300 dict_comp = { 10: "error in ECL-EVT-CAL product generation", } self.d_status.update(dict_comp) def _create_output_files(self): """Create ECL-EVT-CAL files. """ s_logger.debug('Running _create_output_files [dpco]') if self.status != 0: return False workdir_in = self.d_pars['working_in'] workdir_out = self.d_pars['working_out'] if self.d_pars['out_files'] == 'ECL-EVT-CAL': try: save_cal_events(workdir_in, workdir_out) except Exception: self.status = 10 return False return True def _process_composant(self): """Run DPCO module. """ s_logger.debug('Running _process_composant [dpco]') if self.status != 0: return False return True def _check_extra(self): """Check parameters specific to the DPCO module in parameter INI file. """ s_logger.debug('Running _check_extra [dpco]') if self.status != 0: return False return True
[docs]class ProcessDpcoWithFiles_TBC(GenericComposantProcessing): """ High level handling of DPCO module. TBC """ def __init__(self): """**Constructor** """ s_logger.info("Starting DPCO module") super().__init__(DPCO_FILE_SCHEME) self.name = "dpco" self.error_range = 300 dict_comp = { 10: "error in ECL-EVT-CAL product generation", } self.d_status.update(dict_comp) def _load_check_file_in(self): """XXX """ s_logger.debug('Running _load_check_file_in [dpco]') if not GenericComposantProcessing._load_check_file_in(self): return False return True def _create_output_files(self): """Create ECL-EVT-CAL files. """ s_logger.debug('Running _create_output_files [dpco]') if self.status != 0: return False workdir_in = self.d_pars['working_in'] workdir_out = self.d_pars['working_out'] if self.d_pars['out_files'] == 'ECL-EVT-CAL': try: save_cal_events(workdir_in, workdir_out) except Exception: self.status = 10 return False return True def _process_composant(self): """Run DPCO module. """ s_logger.debug('Running _process_composant [dpco]') if self.status != 0: return False return True def _check_extra(self): """Check parameters specific to the DPCO module in parameter INI file. """ s_logger.debug('Running _check_extra [dpco]') if self.status != 0: return False return True