Source code for ecpi.common.sky.background

'''
Created on 11 févr. 2019
@author: Catalano Camille, APC/IN2P3/CNRS

.. warning:: dead code ??

'''

import numpy as np

from ecpi.common.io.fits_tools import read_fits
from ecpi.common import add_path_data_ref_eclairs


[docs]def flat_internal_noise(noise_level=0.003, pix_area=0.4*0.4, e_min=4, e_max=120, det_shape=(80,80)): """ compute the flat internal noise value in a detector shape image The internal noise is independent from wavelength :param noise_level: internal noise level in cts/s/cm2/keV (default is 0.003) :type noise_level: float :param pix_area: area of a pixel of the instrument in cm2 :type pix_area: float :param e_min: energy min to integrate in keV (default is 4) :type e_min: float :param e_max: energy max to integrate in keV (default is 120) :type e_max: float :param det_shape: shape of detector :type det_shape: tuple :return: internal noise detector image in cts/s :rtype: array(float) """ noise_rate = noise_level * pix_area * (e_max - e_min) return np.ones(det_shape) * noise_rate
[docs]def flat_cxb_nospectr(cxb_level=1, pix_area=0.4*0.4, det_shape=(80,80)): """ Compute a flat CXB detector image :param cxb_level: intensity of CXB :type cxb_level: float [count/cm2/s] :param pix_area: area of a pixel of the instrument in cm2 :type pix_area: float :param det_shape: shape of detector :type det_shape: tuple :return: cxb value detector image in cts/s :rtype: array(float) """ cxb_rate = cxb_level * pix_area return np.ones(det_shape) * cxb_rate
[docs]def shapebased_cxb_nospectr(cxb_level=3035, solidangle_filename=add_path_data_ref_eclairs('instru/pixels_solid_angle.fits')): """ Compute a CXB detector image based on a solid angle per pixel fits image :param cxb_level: intensity of CXB in cts/s :type cxb_level: float :param solidangle_filename: PATH/filename of the solid angle image :type solidangle_filename: string :return: cxb rate detector image in cts/s :rtype: array(float) """ solid_angle = read_fits(solidangle_filename, ugts_standard=1) cxb_rate = cxb_level * solid_angle / solid_angle.sum() return cxb_rate