Source code for ecpi.analysis.pipeline.create_bkg_file

'''
Created on 8 july 2019

@author: Catalano CNRS/IN2P3/APC

script to build a file with a CXB model
'''

import logging
from astropy.io import fits

from ecpi.simu.lib.sources import ModelCxbShapeBasedEnergy
from ecpi.common import add_path_data_ref_eclairs


[docs]def create_cxb_file(): logging.info('creation of CXB background file from Moretti formula') cxb = ModelCxbShapeBasedEnergy() nb_channel = cxb.mdl_effect.chan_nb() prihdr = fits.Header() prihdu = fits.PrimaryHDU(header=prihdr) hdu_list = [prihdu] for idx_chan in range(nb_channel): logging.info(f'cxb for channel {idx_chan}') cxb.set_idx_channel(idx_chan) shadowgram = cxb.get_model(1) hdu = fits.ImageHDU(shadowgram) hdu.name = 'CXB_chan_{}'.format(idx_chan) hdu_list.append(hdu) thdulist = fits.HDUList(hdu_list) filename = add_path_data_ref_eclairs('instru/cxb_model_per_channel_1s.fits') thdulist.writeto(filename, overwrite=True) logging.info(f'cxb file in {filename}')
if __name__ == '__main__': create_cxb_file()