DL1Writer¶
-
class
ctapipe.io.
DL1Writer
(**kwargs)[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 DL1Writer(parent=self) as write_dl1: for event in source: calibrate(event) process_images(event) write_dl1(event)
Attributes Summary
An int trait.
An enum of strings where the case should be ignored.
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 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
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.
-
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.
- Parameters
- 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.
-
write_images
¶ A boolean (True, False) trait.
-
write_index_tables
¶ A boolean (True, False) trait.
-
write_parameters
¶ A boolean (True, False) trait.
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
TODO: this needs to be fixed, since it currently requires access to the low-level _file attribute of the SimTelEventSource. Instead, SimTelEventSource should provide this as header info, like
source.simulation_config
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.
-