DataWriter¶
-
class
ctapipe.io.
DataWriter
(**kwargs: Any)[source]¶ Bases:
ctapipe.core.component.Component
Serialize a sequence of events into a HDF5 DL1 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
An int trait.
An enum of strings where the case should be ignored.
A trait whose value must be an instance of a specified class.
returns a list of data levels requested
A trait for unicode strings.
An int trait.
A float trait.
A path Trait for input/output files.
A boolean (True, False) trait.
A trait for unicode strings.
An int trait.
A float trait.
An enum of strings where the case should be ignored.
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.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
Methods Summary
__call__
(event)Write a single event to the output file.
finish
()called after all events are done
table_name
(tel_id, tel_type)construct dataset table names depending on chosen split method
write_simulation_histograms
(event_source)Write the distribution of thrown showers
Attributes Documentation
-
compression_level
¶ An int trait.
-
compression_type
¶ An enum of strings where the case should be ignored.
-
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
-
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.
-
output_path
¶ A path Trait for input/output files.
- Attributes
- exists: boolean or None
If True, path must exist, if False path must not exist
- directory_ok: boolean
If False, path must not be a directory
- file_ok: boolean
If False, path must not be a file
-
overwrite
¶ A boolean (True, False) trait.
-
peak_time_dtype
¶ A trait for unicode strings.
-
peak_time_offset
¶ An int trait.
-
peak_time_scale
¶ A float trait.
-
split_datasets_by
¶ An enum of strings where the case should be ignored.
-
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
¶ A boolean (True, False) trait.
-
write_index_tables
¶ A boolean (True, False) trait.
-
write_mono_shower
¶ A boolean (True, False) trait.
-
write_parameters
¶ A boolean (True, False) trait.
-
write_raw_waveforms
¶ A boolean (True, False) trait.
-
write_stereo_shower
¶ A boolean (True, False) trait.
-
write_waveforms
¶ A boolean (True, False) trait.
Methods Documentation
-
__call__
(event: ctapipe.containers.ArrayEventContainer)[source]¶ Write a single event to the output file.
-
table_name
(tel_id, tel_type)[source]¶ construct dataset table names depending on chosen split method
-
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.
-