DataWriter¶
-
class
ctapipe.io.
DataWriter
(**kwargs: Any)[source]¶ Bases:
ctapipe.core.component.Component
Serialize a sequence of events into a HDF5 file, in the correct format
Examples
inside a Tool:
with DataWriter(parent=self) as write_data: for event in source: calibrate(event) process_images(event) write_data(event)
Attributes Summary
compression level, 0=None, 9=maximum
compressor algorithm to use.
A trait whose value must be an instance of a specified class.
Additional metadata keywords and values that describe this data.
returns a list of data levels requested
A trait for unicode strings.
An int trait.
A float trait.
A trait whose value must be an instance of a specified class.
output filename
overwrite output file if it exists
A trait for unicode strings.
An int trait.
A float trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A trait for unicode strings.
An int trait.
A float trait.
Store DL1 Images if available
Generate PyTables index datasets for all tables that contain an event_id or tel_id.
Store muon parameters if available
Store DL1 image parameters if available
Store R0 waveforms if available
Store DL2 stereo shower parameters if available
Store R1 waveforms if available
Methods Summary
__call__
(event)Write a single event to the output file.
finish
()called after all events are done
table_name
(tel_id)construct dataset table names depending on chosen split method
write_simulation_histograms
(event_source)Write the distribution of thrown showers
Attributes Documentation
-
compression_level
¶ compression level, 0=None, 9=maximum
-
compression_type
¶ compressor algorithm to use.
-
contact_info
¶ A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
-
context_metadata
¶ Additional metadata keywords and values that describe this data. This should be a dictionary where the keys will be appended to the CONTEXT section of the output file’s attributes. Keys can be hierarchical by using a space between each level, e.g.
SIMULATION PRODUCTION
would make a key PRODUCTION grouped under the key SIMULATION
-
datalevels
¶ returns a list of data levels requested
-
image_dtype
¶ A trait for unicode strings.
-
image_offset
¶ An int trait.
-
image_scale
¶ A float trait.
-
instrument_info
¶ A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
-
output_path
¶ output filename
-
overwrite
¶ overwrite output file if it exists
-
peak_time_dtype
¶ A trait for unicode strings.
-
peak_time_offset
¶ An int trait.
-
peak_time_scale
¶ A float trait.
-
transform_image
¶ A boolean (True, False) trait.
-
transform_peak_time
¶ A boolean (True, False) trait.
-
transform_waveform
¶ A boolean (True, False) trait.
-
waveform_dtype
¶ A trait for unicode strings.
-
waveform_offset
¶ An int trait.
-
waveform_scale
¶ A float trait.
-
write_images
¶ Store DL1 Images if available
-
write_index_tables
¶ Generate PyTables index datasets for all tables that contain an event_id or tel_id. These speed up in-kernel pytables operations,but add some overhead to the file. They can also be generated and attached after the file is written
-
write_muon_parameters
¶ Store muon parameters if available
-
write_parameters
¶ Store DL1 image parameters if available
-
write_raw_waveforms
¶ Store R0 waveforms if available
-
write_showers
¶ Store DL2 stereo shower parameters if available
-
write_waveforms
¶ Store R1 waveforms if available
Methods Documentation
-
__call__
(event: ctapipe.containers.ArrayEventContainer)[source]¶ Write a single event to the output file.
-
write_simulation_histograms
(event_source)[source]¶ Write the distribution of thrown showers
Notes
this only runs if this is a simulation file. The current implementation is a bit of a hack and implies we should improve SimTelEventSource to read this info.
Currently the histograms are at the end of the simtel file, so if max_events is set to non-zero, the end of the file may not be read, and this no histograms will be found.
-