EclairsCalEvtData

class EclairsCalEvtData(nb_line=None)[source]

Bases: common.io.events.XEvtData

standard container for ECLAIRs’ calibrated event data

constructor : init with an empty counts table

Attributes Summary

nb_row

Methods Summary

add_evt(eced)
construct_images(t_window, t_step[, method]) construct a suite of images from the data event table
extract_image(t_1, t_2[, energy_range]) extract one image from the data event table
extract_images(t_1, t_2, energy_ranges) extract images according to the time and energy ranges in input
read(filename[, add_data]) read an event from a fits file (in IJdet convention) and save it into the tb_evts attribute
save_images(t_window, t_step, images_path[, …]) construct and save a suite of images from the data event table
set_evt(data_table) set the data event table with the input array
set_evt_from_std_array(data_table) set the data event table with the input array (time, y, z, pha)
sort_with_time() sort the event table according to the arrival time of each photon
write(filename, creator[, t_start, t_stop, …]) save the event in a ECLAIRs calibrated event fits file
write_L1(filename, creator[, t_start, …]) save the event in a ECLAIRs single event energy coded fits file

Attributes Documentation

nb_row

Methods Documentation

add_evt(eced)[source]
construct_images(t_window, t_step, method='sliding_window')

construct a suite of images from the data event table

images integrated during time = t_window with time step = t_step
  • if t_window == t_step: images are successives
  • if t_window == t_max - t_min: return one stacked array
2 construct methods : sliding_window or cumulative
  • sliding_window : images are independently computed
  • cumulative : images are added with the precedent one

Note

may be some data not included from the end of the event file

Parameters:
  • t_window (float) – integration window of the images, in ‘time’ format. Must be < t_max - t_min.
  • t_step (float) – step between two beginning time of windows in ‘time’ format
  • method (string) – construction method: ‘sliding_window’ or ‘cumulative’. Default=’sliding_window’
Returns:

constructed images

Return type:

float np.array

extract_image(t_1, t_2, energy_range=[0, 1023])[source]

extract one image from the data event table

extract image by summing the PHA of photons in the pixels of the image

Parameters:
  • t_1 (float in 'time' format) – start time to integrate the image
  • t_2 (float in "time" format) – end time for the integration
  • energy_range ([int, int]) – energy band to sum the photon within. Default=[0,1023].
Returns:

the image integrated between t_1 and t_2, and within the energy range

Return type:

float array

extract_images(t_1, t_2, energy_ranges)[source]

extract images according to the time and energy ranges in input

Parameters:
  • t_1 (float in 'time' format) – start time to integrate the image
  • t_2 (float in "time" format) – end time for the integration
  • energy_ranges ([[int, int]]) – different energy ranges (in PI) to extract the images [[low_energy, high_energy],[]]
Returns:

extracted images between t_1 and t_2, and within the energy ranges

Return type:

list(array)

read(filename, add_data=False)[source]

read an event from a fits file (in IJdet convention) and save it into the tb_evts attribute

Parameters:
  • filename (string) – PATH/name of the event file to read
  • add_data (bool) – replace or add to precedent data. Default is False
save_images(t_window, t_step, images_path, method='sliding_window')

construct and save a suite of images from the data event table

2 construct methods : sliding_window or cumulative
  • sliding_window : images are independently computed
  • cumulative : integration time of images increase of t_step each step (t_window == size of the initial time window)
images integrated during time = t_window with time step = t_step
  • if t_window == t_step: images are successives
  • if t_window == t_max: return one stacked array
Parameters:
  • t_window (float) – integration window of the images, in ‘time’ format. Must be < t_max - t_min.
  • t_step (float) – step between two beginning time of windows in ‘time’ format
  • images_path (string (PATH)) – path to the directory to save images into
  • method (string) – construction method: ‘sliding_window’ or ‘cumulative’. Default=’sliding_window’
set_evt(data_table)

set the data event table with the input array

Parameters:data_table (array) – input data array to read from
set_evt_from_std_array(data_table)[source]

set the data event table with the input array (time, y, z, pha)

Parameters:data_table (array) – input data table [time, y, z, pha]
sort_with_time()

sort the event table according to the arrival time of each photon

write(filename, creator, t_start=0, t_stop=0, proc_id='01')[source]

save the event in a ECLAIRs calibrated event fits file

Common keywords are added to the header.

Parameters:
  • filename (string) – PATH/name of the file to save to
  • start_time (float) – events start time in s from MJDREF
  • t_stop (float) – events end time in s from MJDREF
  • creator (string (default='unknown')) – program that generated the file
write_L1(filename, creator, t_start=0, t_stop=0, proc_id='01')[source]

save the event in a ECLAIRs single event energy coded fits file

Common keywords are added to the header.

Parameters:
  • filename (string) – PATH/name of the file to save to
  • start_time (float) – events start time in s from MJDREF
  • t_stop (float) – events end time in s from MJDREF
  • creator (string (default='unknown')) – program that generated the file