ecpi.simu.lib.eclairs_channel module

Section author: ECLAIRs GP team

High-level class to simulate the sources of the sky seen by the ECLAIRs instrument during a stable pointing period.

Warning

SimuEclairsEnergyChannel is not a simulation script. It is a library allowing to create different types of simulation according to your needs.

SimuEclairsEnergyChannel features:

The library simulate the number of photon/count in ECLAIRs detector in each energy channel, so the data structure of simulation is a 3D array nb_channelx80x80. This array is stored in chan_shadows attribut. Library can take in account:

  • Energy channel

  • Sky sources model

    • punctual source from

      • catalog (SWIFT, user in equatorial coordinate, user in FOV coordinate)

      • define by user in FOV

      • include projection effect (with IRF or only “cos theta” term)

    Note

    All method for punctual sources begin by add_src_point_xxx()

    • Cosmic X Background (CXB) with or without earth in field of view

    • simulation for a selection of sources is possible with parameter l_src of the method simu_src()

    Note

    If you want create a new type of sky source implement it as a derivation of AbstractModelSrc and add to simulation with add_src() method.

  • Noise

  • Detector effects

  • Attitude and position of satellite

    • to select source in field of view from astronomical catalog

    • to take into account the occultation of the CXB by the earth

Outputs available:

  • detector image on each energy channel in count/photon with chan_shadows attribut

  • file events with write_events()

  • file detector image with write_shadowgrams()

  • plot detector image by energy channel plot_shadow()

Context of simulation:

Position, attitude, time, data calibration detector, geometry instrument, … all the information common and necessary for simulation models is called the context, stored in context attribut. It’s in fact a global instance of ContextSimulator class, share with design pattern singleton.

Warning

If a model change the context, it is modified for all other models.

Summary

Classes:

SimuEclairsEnergyChannel

ECLAIRs simulation by energy channel

Class diagram:

Reference

class SimuEclairsEnergyChannel(mdl_effect=None)[source]

Bases: object

ECLAIRs simulation by energy channel

add_src(src_obj)[source]

Add a sky source to the simulation

Parameters

src_obj (subclass of AbstractModelSrc) – object

Returns

status of add

Return type

boolean

add_src_astroparticule()[source]

Add to the simulation a model of astroparticules flux on the detector.

Note

Current model is defined by ModelInternalNoise

Returns

status of add

Return type

boolean

add_src_cxb(cxb_mode='shape_moretti')[source]

Add CXB source with keyword available in AVAILABLE_CXB_MODES list

Parameters

cxb_mode (string) – keyword defining the model of CXB

Returns

status of add

Return type

boolean

add_src_point_with_catalog_astro(cat_astro, use_irf=False)[source]

Add all sources in catalog cat_astro in J2000 that are in current field of view of ECLAIRs. If you not used IRF a simple model of geometric effect (cos theta) is apply.

Parameters
add_src_point_with_catalog_fov(cat_fov, use_irf=False)[source]

Add all sources in catalog cat_astro in field of view (direction, elevation) angle that are in current field of view to the simulation. If you not used IRFa simple model of geometric effect (cos theta) is apply.

Parameters
  • cat_fov (subclass of CatalogFovBasic) – sources catalog with energy

  • use_irf (bool) – use file calibration IRF for geometric effect

add_src_point_with_catalog_swift(use_irf)[source]

Add all sources in catalog SWIFT that are in current field of view of ECLAIRs. If you not used IRF a simple model of geometric effect (cos theta) is apply.

Parameters

use_irf (bool) – use file calibration IRF for geometric effect

add_src_point_with_custom_catalog(path_cat, use_irf)[source]

Add all sources from FITS catalog that are in current field of view of ECLAIRs. If you not used IRF a simple model of geometric effect (cos theta) is apply.

Parameters
  • path_cat – path to custom source catalog

  • use_irf (bool) – use file calibration IRF for geometric effect

create_evts()[source]

From each image detector create an instance of EclairsCalEvtData to store events. For each events a time of detection is defined.

del_src(name_src)[source]

Delete the source with name name_src from list of sky source.

Parameters

name_src (string) – name in current sky source list

del_src_all()[source]

Delete all sky source

get_list_src()[source]

List sky source

Returns

list with name of sky source in current simulation

get_shadow_by_channel(num_chan)[source]

Return image detector of channel num_chan

Parameters

num_chan (int) – channel number

Returns

image detector of channel with number num_chan

Return type

array 2D

get_shadow_by_idx(idx)[source]

Return image detector of channel idx

Parameters

idx (int) – number channel

Returns

image detector of channel idx

Return type

array 2D

plot_channel(idx, p_mes='')[source]

Create a figure of image detector for channel idx

Parameters
  • idx (int) – number channel

  • p_mes (string) – Title of the figure

print_total_count()[source]

Print total number of photon/count for each channel

reset_chan_shadows()[source]

Reset all image detector at zero

set_chan_shadows(chan_shadows)[source]

Set all image detector by chan_shadows

Parameters

chan_shadows (array 3D (nb channel, image detector)) – image detector by channel

set_range_channel(start_chan, end_chan)[source]

Set energy range [start_chan, end_chan] of simulation

Parameters
  • start_chan (integer) – first channel in range

  • end_chan (integer) – last channel in range

Returns

True if start_chan, end_chan are acceptable

Return type

bool

simu_arf_binomial()[source]

Apply ARF on images detector with binomial processus where mean is quantum efficiency

Note

Use it only when images detector have integer value, like after simu_noise_poisson()

simu_arf_mean()[source]

Apply ARF on images detector by multiplication with quantum efficiency

simu_noise_poisson()[source]

Simulation of random Poisson noise for each shadowgram (ie. each energy channel)

simu_nonuniformity(factor=0.8)[source]

Simulation of non-uniformity on all channel

Note

#TODO: ref ADD TBD

Parameters

factor (float) – non uniformity factor

simu_src(idx_chan=None, l_src=None)[source]

Simulation of sky sources on image detector

Parameters
  • idx_chan (int) – index channel where apply simulation

  • l_src (string) – restriction of the simulation to the source list

write_events(working_directory, observation)[source]

Write event FITS file

Note

#TODO: remove observation parameters and use context

Parameters
  • working_directory (string) – directory where file is written

  • observation (EclairsObservation) – observation parameters

write_shadowgrams(working_directory, simulation_id, limit_shadowgrams=50)[source]

Write image detector FITS file

Parameters
  • working_directory (string) – directory where file is written

  • simulation_id (int) – simulation identification