tasks — Tasks#
This module provide all the high-level simulation and analysis tasks of the package, each implemented as a single function with a precise signature, as well as the default values for their arguments.
More specifically, the following tasks are provided:
simulate(): simulate detector data from a source;reconstruct(): reconstruct detector data;display(): event display;quicklook(): quick-look analysis.
Module documentation#
Basic simulation, reconstruction and analysis tasks.
- hexsample.tasks.current_call() Tuple[str, dict][source]#
Return the name and arguments of the current function call.
- class hexsample.tasks.SimulationDefaults(num_events: int = 10000, output_file_path: str = PosixPath('/home/runner/hexsampledata/simulation.h5'), random_seed: int = None)[source]#
Default parameters for the simulation task.
This is a small helper dataclass to help ensure consistency between the main task definition in this Python module and the command-line interface.
- num_events: int = 10000#
- output_file_path: str = PosixPath('/home/runner/hexsampledata/simulation.h5')#
- random_seed: int = None#
- hexsample.tasks.simulate(source: Source, sensor: Sensor, readout: AbstractReadout, num_events: int = 10000, output_file_path: str = PosixPath('/home/runner/hexsampledata/simulation.h5'), random_seed: int = None, header_kwargs: dict = None) str[source]#
Run a simulation.
Warning
The last header_kwargs argument is a temporary workaround to allow passing some metadata to be stored in the output file header. This will go away once we have a proper mechanism to handle metadata.
Arguments#
- sourceSource
The X-ray source.
- sensorSensor
The sensor.
- readoutAbstractReadout
The readout chip.
- num_eventsint
The number of events to simulate.
- output_file_pathstr
The path to the output file.
- random_seedint
The random seed to use.
Returns#
- str
The path to the output file that the task has created.
- class hexsample.tasks.ReconstructionDefaults(suffix: str = 'recon', zero_sup_threshold: int = 0, num_neighbors: int = 2, max_neighbors: int = -1, pos_recon_algorithm: str = 'centroid', eta_2pix_rad: float = 0.127, eta_2pix_pivot: float = 0.04, eta_3pix_rad0: float = 0.513, eta_3pix_rad1: float = 0.141, eta_3pix_rad_pivot: float = 0.05, eta_3pix_theta0: float = 0.104)[source]#
Default parameters for the reconstruction task.
This is a small helper dataclass to help ensure consistency between the main task definition in this Python module and the command-line interface.
- suffix: str = 'recon'#
- zero_sup_threshold: int = 0#
- num_neighbors: int = 2#
- max_neighbors: int = -1#
- pos_recon_algorithm: str = 'centroid'#
- eta_2pix_rad: float = 0.127#
- eta_2pix_pivot: float = 0.04#
- eta_3pix_rad0: float = 0.513#
- eta_3pix_rad1: float = 0.141#
- eta_3pix_rad_pivot: float = 0.05#
- eta_3pix_theta0: float = 0.104#
- hexsample.tasks.reconstruct(input_file_path: str, suffix: str = 'recon', zero_sup_threshold: int = 0, num_neighbors: int = 2, max_neighbors: int = -1, pos_recon_algorithm: str = 'centroid', eta_2pix_rad: float = 0.127, eta_2pix_pivot: float = 0.04, eta_3pix_rad0: float = 0.513, eta_3pix_rad1: float = 0.141, eta_3pix_rad_pivot: float = 0.05, eta_3pix_theta0: float = 0.104, header_kwargs: dict = None) str[source]#
Run the reconstruction.
Warning
The last header_kwargs argument is a temporary workaround to allow passing some metadata to be stored in the output file header. This will go away once we have a proper mechanism to handle metadata.
Arguments#
- input_file_pathstr
The path to the input file.
- suffixstr
The suffix to append to the output file name.
- zero_sup_thresholdint
The zero-suppression threshold.
- num_neighborsint
The number of neighbor pixels to be used for the clustering.
- max_neighborsint
The maximum number of neighbor pixels to be used for the clustering. If max_neighbors is specified (i.e. different from -1), it has priority over num_neighbors.
- pos_recon_algorithmstr
The position reconstruction algorithm to use.
- eta_indexfloat
The eta index to use.
- class hexsample.tasks.DisplayDefaults[source]#
Default parameters for the display task.
This is a small helper dataclass to help ensure consistency between the main task definition in this Python module and the command-line interface.
- zero_sup_threshold: int = 30#
- num_neighbors: int = 6#
- event_id: int = None#
- hexsample.tasks.display(input_file_path: str, zero_sup_threshold: int = 30, event_id: int = None) None[source]#
Display events from a digi file.
Arguments#
- file_pathstr
The path to the digi file.
- zero_sup_thresholdint
The zero-suppression threshold to use when displaying the digi event.
- event_idint
The ID of the event to display. If None, display all events.