smiet.numpy.io.sliced_shower module¶
-
class smiet.numpy.io.sliced_shower.SlicedShower(file_path, gdas_file=
None)¶ Bases:
CoreasShowerThis class can be used to read in an HDF5 file of sliced CoREAS simulation.
It can read in the traces of all slices for a given antenna and return them in a Numpy array. Note that the implementation assumes that the antenna’s in each slice have the same physical position and are named identically apart from a suffix ‘xN’, where N is the grammage at the bottom of the slice. The antenna names are inferred by splitting the antenna names on the ‘x’ character, taking the first part and adding them all to a set to removes doubles. The number of slices is then calculated as the number of observers in the file, divided by the number of unique antenna names (i.e. the length of the set). Finally, the antenna positions are added to a structured array by looping over all unique antenna names, adding x{slice_grammage} (of which the value is inferred from the longitudinal profiel) at the end and looking at the position attribute. This structured array is then sorted by distance to the core, to ensure consistency across read-ins.
- Parameters:¶
- antenna_array¶
A structured array containing for each antenna the name and position on ground. It contains the fields ‘name’ and ‘position’.
- Type:¶
np.ndarray
-
get_trace_geoce(ant_name: str, bandpass: list =
[0.03, 0.5], return_start_time: bool =False) tuple[ndarray, ndarray] | tuple[ndarray, ndarray, ndarray]¶ Get the traces from all slices for a given antenna, in GEO/CE components.
Notes
The traces are converted to GEO/CE components.
- Parameters:¶
- ant_name : str¶
The name of the antenna. Must be the same as the key in the HDF5!
- bandpass : list, default=[30, 500]¶
If not None, the traces are bandpass filtered between the given frequencies (in MHz)
- return_start_time : bool, default=False¶
If True, an array containing the time of the first sample of each slice is returned
- Returns:¶
traces_geo (np.ndarray) – The geomagnetic traces, shaped as (slices, samples)
traces_ce (np.ndarray) – The charge-excess traces, shaped as (slices, samples)
traces_start_times (np.ndarray (returned only if return_start_times is True)) – The time of the first sample of each trace
-
get_trace_slice_geoce(ant_name, slice_value, bandpass, return_start_time=
False)¶ Similar to
get_trace(), but only gets the traces for a single slice in GEO/CE components.
-
get_trace_slice_on_sky(ant_name, slice_value, return_start_time=
False)¶ Similar to
get_trace_slice(), but the traces are converted to on-sky components instead of GEO/CE components.
-
class smiet.numpy.io.sliced_shower.SlicedShowerCherenkov(file_path, gdas_file=
None)¶ Bases:
CoreasShowerThis class can be used to read in an HDF5 file of sliced CoREAS simulation, where every slice has the same number of antennas.
It differs from
SlicedShowerin that it does not assume that all observers have the same position. Rather, it only assumes that each slice has the same number of observers. The antenna names are taken to be all observer names in HDF5 (they are still stored in a set, but this should not change anything because the observer names in CoREAS should be unique). Theantenna_arrayis created by looping over all antenna names and extracting the position attribute. It is also sorted by distance to the core, to ensure it is always the same when reading in a shower. To calculate the number of slices, it divides the number of observers by the number of observers whose name ends with the slice grammage extracted from the longitudinal profile.Its primary use case is for sliced simulation where the antennas where all place under the same Cherenkov angle in each slice.
- Parameters:¶
- antenna_array¶
A structured array containing for each antenna the name and position on ground. It contains the fields ‘name’ and ‘position’.
- Type:¶
np.ndarray
-
get_trace_slice(ant_name, slice_gram=
None, return_start_time=False)¶ Retrieves the traces for an observer and converts them to GEO/CE components.
- Parameters:¶
- ant_name : str¶
The name of the observer as used in the HDF5 file
- slice_gram : None¶
This variable is not used, but is kept to mirror the method of SlicedShower, which allows this class to be used in TemplateSynthesis
- return_start_time : bool, default=False¶
If True, an array containing the time of the first sample of each slice is returned
- Returns:¶
trace_geo (np.ndarray) – The geomagnetic trace
trace_ce (np.ndarray) – The charge-excess trace
trace_start_time (np.ndarray (returned only if return_start_times is True)) – The time of the first sample of the trace