smiet.jax.io package

class smiet.jax.io.CoreasShower(file_path: str, gdas_file: str = '')

Bases: Shower

Class to read in showers from CoREAS simulations stored in HDF5 files.

Parameters:
file_path : str

Path to the HDF5 file containing the CoREAS simulation data.

gdas_file : str, optional

If provided, the atmosphere will be created using this GDAS file. This will take precedence over the atmosphere model specified in the simulation settings.

property delta_t : float

Time resolution of the trace.

Returns:

delta_t – The time resolution in ns.

Return type:

float

fit_gaisser_hillas()

Fit a Gaisser-Hillas function to the currently loaded longitudinal profile, to determine the parameters like \(X_{max}\) and \(N_{max}\).

Returns:

popt – The parameters of the Gaisser-Hillas function, in the order [N, X0, Xmax, p0, p1, p2] (p0,p1,p2 are the polynomial coefficients in denominator for lambda)

Return type:

np.ndarray

Notes

The Gaisser-Hillas function is defined as:

\[f(X) = N \left( \frac{X - X_0}{X_{max} - X_0} \right)^{\frac{X_{max} - X_0}{\lambda}} \exp\left( \frac{X_{max} - X}{\lambda} \right)\]
get_antenna_position() ndarray

Get the antenna positions on the ground.

Returns:

ant_position_ground – The antenna positions on the ground, transformed to the NRR system.

Return type:

np.ndarray

get_antenna_position_showerplane(ant_names=None) ndarray

Get the antenna positions in shower plane.

ant_nameslist, optional

Dummy argument to match argument shape as in numpy version.

Returns:

ant_position_vB_vvB – The antenna positions in the shower plane, transformed to the NRR system.

Return type:

jax.typing.ArrayLike

get_traces_geoce(bandpass: list = [0.03, 0.5]) ndarray

Get the traces from traces at the ground to GEO/CE components.

Parameters:
bandpass : list, default = [30 * units.MHz, 500 * units.MHz]

The frequency bandpass in MHz to apply to the traces. Defaults to 30-500 MHz, which is the bandwidth in which SMIET is applicable in.

Returns:

traces_geo_ce – The traces in the shower plane, transformed to GEO and CE components. Shape is (2, Nant, Nsamples), where Nant is the number of antennas and Nsamples is the number of samples.

When called with SlicedShower, the shape is (2, Nant, Nsamples, Nslices).

Return type:

np.ndarray

get_traces_onsky() ndarray

Get the traces from traces at the ground to on-sky components.

NOTE: the radial component (er) is set to zero manually here.

Returns:

traces_onsky – The traces in the shower plane, transformed to on-sky components (er, etheta, ephi). Shape is (3, Nant, Nsamples), where Nant is the number of antennas and Nsamples is the number of samples.

When called with SlicedShower, the shape is (3, Nant, Nsamples, Nslices).

Return type:

np.ndarray

get_traces_raw() ndarray

Get all traces for all antennas on the ground plane.

Returns:

traces_ground – the traces at ground in xyz coordinates. Shape is (3, Nant, Nsamples), where Nant is the number of antennas and Nsamples is the number of samples.

When called with SlicedShower, the shape is (3, Nant, Nsamples, Nslices).

Return type:

jax.typing.ArrayLike

get_traces_vB_vvB(bandpass: list = [0.03, 0.5]) ndarray

Get the traces from traces at the ground to vB/vvB components.

Parameters:
bandpass : list, default = [30 * units.MHz, 500 * units.MHz]

The frequency bandpass in MHz to apply to the traces. Defaults to 30-500 MHz, which is the bandwidth in which SMIET is applicable in.

Returns:

traces_vB_vvB – The traces in the shower plane, transformed to vxB and vxvxB components. Shape is (3, Nant, Nsamples), where Nant is the number of antennas and Nsamples is the number of samples.

When called with SlicedShower, the shape is (3, Nant, Nsamples, Nslices).

Return type:

np.ndarray

remove_antennas(ant_idx_min: int = 0, ant_idx_max: int = 90) None

Remove antennas from the data traces.

Parameter:

ant_idx_minfloat

remove all antennas below this antenna index

ant_idx_maxfloat

remove all antennas above this antenna index

property trace_length : int

Length of the trace.

Returns:

trace_length – The number of samples in the trace.

Return type:

int

class smiet.jax.io.Shower

Bases: object

Base class to contain the shower parameters.

The Shower class is used to hold the geometric information for a shower, like the zenith/azimuth, as well as the longitudinal profile. It can be used to specify the target parameters for a shower in template synthesis.

property GH_parameters : dict

Get the Gaisser-Hillas parameters as a dictionary.

property azimuth : float

The azimuthal angle in radians.

property core : Array

The core (x, y, z in NRR CS) where the EAS hit in the simulation.

property geomagnetic_angle : float

The angle between the magnetic field vector and the shower axis.

property geometry : Array

Store the zenith and azimuth. These must be provided in the internal units system.

get_transformer()

Get the transformer from jax_radio_tools that contains the coordinate transformations from shower to ground frame, as well to on-sky coordinates.

Returns:

transformer – The coordinate transformer from jax_radio_tools.

Return type:

cstrafo

property grammages : Array

Array of atmospheric slices in g/cm^2.

property long_profile : float

The longitudinal profile of electrons and positrons in each atmospheric slice.

property magnet : float

Magnetic field vector in the NRR coordinate system.

property nmax : float

The $N_{max}$ of the shower, from fitting a GH to the longitudinal profile.

property nr_slices : int

The number of slices in the array.

set_parameters(grammages: Array | ndarray | bool_ | number | bool | int | float | complex, long_profile: Array | ndarray | bool_ | number | bool | int | float | complex, xmax: Array | ndarray | bool_ | number | bool | int | float | complex, nmax: Array | ndarray | bool_ | number | bool | int | float | complex, zenith: Array | ndarray | bool_ | number | bool | int | float | complex, azimuth: Array | ndarray | bool_ | number | bool | int | float | complex, magnetic_field: Array | ndarray | bool_ | number | bool | int | float | complex, core: Array | ndarray | bool_ | number | bool | int | float | complex) None

Set the parameters of the shower model from a dictionary of parameters.

This is a convenience function to set all parameters at once.

Parameters:
grammages : jax.typing.ArrayLike

an array of atmospheric depth in g/cm^2

long_profile : jax.typing.ArrayLike

an array of the longitudinal profile of the shower

xmax : jax.typing.ArrayLike

depth of shower maximum in g/cm^2

nmax : jax.typing.ArrayLike

number of particles at shower maximum

zenith : jax.typing.ArrayLike

zenith angle in radians

azimuth : jax.typing.ArrayLike

azimuthal angle in radians

magnetic_field : jax.typing.ArrayLike

magnetic field vector in Gauss. Must be a 3-vector

core : jax.typing.ArrayLike

core position in meters. Must be a 3-vector

property slice_grammage : float

The spacing between each grammage in g/cm^2.

transform_profile_to_origin(origin_grammages: Array | ndarray | bool_ | number | bool | int | float | complex) None

Transform the longitudinal profile to match those of the origin shower.

This is needed such that the grammages of the origin and target match.

Parameters:
origin_grammages : jax.typing.ArrayLike

The grammages of the origin shower.

property xmax : float

The $X_{max}$ of the shower, from fitting a GH to the longitudinal profile.

property zenith : float

The zenith angle in radians.

class smiet.jax.io.SlicedShower(file_path: str, slicing_grammage: int = 5, gdas_file: str = '')

Bases: CoreasShower

Class to read in showers from each slice from CoREAS simulations, inherited from CoreasShower.

Parameters:
file_path : str

The filepath to the simulation to read.

slicing_grammage : int, default=5

The width between atmospheric slices in g/cm^2

gdas_file : str, optional

If provided, the atmosphere will be created using this GDAS file. This will take precedence over the atmosphere model specified in the simulation settings.

get_coreas_settings() dict

Get specific configurations from the CoREAS simulation that is useful for the synthesis.

Returns:

coreas_settings – A dictionary containing important information about the configuration of the CoREAS simulation

Return type:

dict

get_traces_geoce(bandpass: list = [0.03, 0.5]) ndarray

Get the traces from traces at the ground to GEO/CE components.

Parameters:
bandpass : list, default = [30 * units.MHz, 500 * units.MHz]

The frequency bandpass in MHz to apply to the traces. Defaults to 30-500 MHz, which is the bandwidth in which SMIET is applicable in.

Returns:

traces_geo_ce – The traces in the shower plane, transformed to GEO and CE components. Shape is (2, Nant, Nsamples), where Nant is the number of antennas and Nsamples is the number of samples.

When called with SlicedShower, the shape is (2, Nant, Nsamples, Nslices).

Return type:

np.ndarray

Submodules