XEvtData

class XEvtData[source]

Bases: object

standard container for ECLAIRs’ event or data file

constructor : init with an empty, photons table

Attributes Summary

nb_row

Methods Summary

construct_images(t_window, t_step[, method]) construct a suite of images from the data event table
create_movie(name_file[, erase_images])
extract_image(t_1, t_2[, photon_sum, …]) extract one image from the data event table
read(filename[, add_data]) read an event from a fits file and save it into the tb_evts attribute
save_images(images_path[, t_window, t_step, …]) 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
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 fits file

Attributes Documentation

nb_row

Methods Documentation

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

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

create_movie(name_file, erase_images=True)[source]
extract_image(t_1, t_2, photon_sum='energy', energy_band=[0, 1023])[source]

extract one image from the data event table

The image is build with photons between t_1 and t_2, and within ‘energy_band’.

Parameters:
  • t_1 (float in 'time' format) – start time to integrate the image
  • t_2 (float in "time" format) – end time for the integration
  • photon_sum (string) – column name to use to sum photons in the pixels image. Default=’energy’.
  • energy_band ([int, int]) – energy band to sum the photon within. Default=[0, 1023].
Returns:

the image integrated between t_1 and t_2, within ‘energy_band’

Return type:

float array

read(filename, add_data=False)[source]

read an event from a fits file and save it into the tb_evts attribute

the events are sorted according to arrival time

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(images_path, t_window=1.0, t_step=0.5, method='sliding_window', title='')[source]

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)[source]

set the data event table with the input array

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

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

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

save the event in a fits file

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