smiet.jax.synthesis module¶
-
class smiet.jax.synthesis.TemplateSynthesis(freq_ar: list =
[30, 500, 100], ce_linear: bool =True)¶ Bases:
objectThis class is the main interface for synthesising pulses.
The main workflow consists of creating an instance and reading in the spectral parameters from a particular file. Then one can pass a
SlicedShoweras an origin to theTemplateSynthesis.make_template()method, which construct all the necessary arrays to perform the synthesis. To perform the synthesis, you then call theTemplateSynthesis.map_template()method with aShowerinstance, which should be equipped with a longitudinal profile and the parameters from a Gaisser-Hillas fit.- Parameters:¶
- freq_ar : list, default=[30, 500, 100]¶
The frequency range (min, max, central) in MHz for which to load the spectral parameters. Currently available options are:
[30, 500, 100] : can be used for most general purposes and experiments
[30, 80, 50] : a smaller sub-band which can be used for experiments such as LOFAR, AERA, etc
The default value is [30, 500, 100].
NOTE: The frequency range provided should not be multiplied by units.MHz, as this is done internally!
- atm¶
The atmosphere model from the origin shower, used to make the template
- Type:¶
radiotools.atmosphere.models.Atmosphere
- spectral_params¶
The spectral coefficients with shape {GEO, CE} x VIEW x FREQ
- Type:¶
jax.typing.ArrayLike
- viewing_angles¶
The viewing angles (in units of Cherenkov angle) for which we have the spectral coefficients
- Type:¶
jax.typing.ArrayLike
- amplitudes¶
The amplitude spectrum for each antenna, frequency, slice, and emission component
- Type:¶
jax.typing.ArrayLike
- phases¶
The phase spectrum for each antenna, frequency, slice, and emission component
- Type:¶
jax.typing.ArrayLike
- frequency_range¶
The minimum, maximum and central frequency for which the spectral parameters where fitted. This is read from the HDF5 file containing the spectral parameters.
- Type:¶
tuple of float
- freq_range_mask¶
A boolean mask to select only the frequencies within the frequency range
- Type:¶
np.ndarray
- truncated_frequencies¶
The frequencies after truncating all frequencies outside the frequency range
- Type:¶
np.ndarray
- antenna_information¶
The antenna information, containing the time axis, position, position in the shower plane, and name of each antenna
- Type:¶
np.ndarray
- template_information¶
The information about the template, such as the name, geometry, magnetisation, \(X_{max}\), core and creation time
- Type:¶
dict
Notes
It is implicitly assumed that the origin shower’s longitudinal profile is sampled with the same step size as the antennas are configured to observe (i.e. if the antennas are set up to observer slices with a thickness of 5 g/cm2, the longitudinal profile should also be sampled with a step size of 5 g/cm2 - which is set using the LONGI keyword in the CORSIKA input file).
- calculate_arrival_times(shower: Shower) Array¶
Calculate the arrival times of the shower at each antenna.
This will calculate the difference in distance between the radio emission that is generated from the atmospheric slices in the target shower (emission distnaces) and from each antenna to each atmospheric slice from the origin shower (travel distance), and calculate the time difference.
- get_antenna_names() list[str]¶
Get the names of all internal antennas.
- get_time_axis() Array¶
Get the time axis for all antennas.
-
load_template(file_path, gdas_file: str | None =
None) None¶ Load the template from a saved state, as done by save_template().
- Parameters:¶
- file_path : str, default=None¶
the file path to load the template from.
- gdas_file : str, default=None¶
the GDAS file to use for the atmosphere model. If None, then the model number from the loaded template will be used as the atmosphere object. Otherwise the provided GDAS file will be used. THe model number must be the same as that from CORSIKA.
- make_template(origin: SlicedShower) None¶
Process a
SlicedShowerinto a template.- Parameters:¶
- origin : smiet.jax.io.sliced_shower.SlicedShower¶
The origin shower
- map_template(target: Shower) Array¶
Map the template to a target profile, represented in a target Shower.
Calculates the trace for every antenna present in the template.
- Parameters:¶
- target : smiet.jax.io.base_shower.Shower¶
The target Shower object, containing the longitudinal profile, zenith, azimuth, geomagnetic angle, xmax and nmax
- Returns:¶
total_synth – The synthesised geomagnetic & charge-excess trace for all antennas. Shape is {GEO, CE} x ANT x SAMPLES x 1
- Return type:¶
jax.Array
- map_template_to_slices(target: Shower) Array¶
Map the template to a target profile, represented in a target Shower.
Calculates the trace for every antenna present in the template at all slices.
- Parameters:¶
- target : smiet.jax.io.base_shower.Shower¶
The target Shower object, containing the longitudinal profile, zenith, azimuth, geomagnetic angle, xmax and nmax
- Returns:¶
total_synth – The synthesised geomagnetic & charge-excess trace for all antennas. Shape is {GEO, CE} x ANT x SAMPLES
- Return type:¶
jax.Array
-
read_spectral_file(filename: str, ce_linear: bool =
True) None¶ Read spectral parameters from a file with filename in the spectral_parameters/ directory.
-
remove_antennas(dcore_min: float =
15) None¶ Remove antennas from the template based on their names.
In the future, this should be removed and should be implemented in SlicedShower instead.
-
save_template(save_dir: str =
'/home/kwatanabe/Projects/radio-ift/smiet-cr-synthesis/smiet/jax/../templates/jax', template_file: None | str =None) None¶ Save the internal state of the synthesis class to disk.
-
truncate_atmosphere(starting_grammage: float =
200) None¶ Truncate the starting point of the atmosphere grid, and subsequent arrays used for the synthesis process.
-
smiet.jax.synthesis.amplitude_function(params: Array | ndarray | bool_ | number | bool | int | float | complex, frequencies: Array | ndarray | bool_ | number | bool | int | float | complex, d_noise: float =
0.0) Array¶ Calculate the amplitude frequency spectrum corresponding to the parameters params.
- Parameters:¶
- params : jax.typing.ArrayLike¶
The spectral parameters. If it is a multidimensional array, the first dimension must contain the parameters.
- frequencies : jax.typing.ArrayLike¶
The values of the frequencies to evaluate - remove central frequency beforehand!
- d_noise : float, default=0.0¶
The noise floor level
- Return type:¶
The evaluated amplitude frequency spectrum with shape VIEW x FREQ x SLICES
- smiet.jax.synthesis.get_correction_factors(spectral_params: Array | ndarray | bool_ | number | bool | int | float | complex, ant_v_angles: Array | ndarray | bool_ | number | bool | int | float | complex, v_angles_grid: list, outshape: tuple) Array¶
Get the correction factors from the spectral parameters.
- Parameters:¶
- spectral_params : jax.typing.ArrayLike¶
the spectral parameters for the geomagnetic and charge excess emission in shape {GEO x CE} x VIEW x FREQ x SLICES
- ant_v_angles : jax.typing.ArrayLike¶
the viewing angles for the particular geometry & atmosphere
- v_angles_grid : list, static¶
the grid of viewing angles used for interpolation
- outshape : tuple, static¶
the shape for the correction factor array shape should be {GEO x CE} x ANTS x FREQ x SLICES
- Returns:¶
correction_factors – the corrections factors in shape {GEO x CE} x ANTS x FREQ x SLICES
- Return type:¶
jax.typing.ArrayLike
- smiet.jax.synthesis.get_spectra(xmax: float, spectral_coeffs: Array | ndarray | bool_ | number | bool | int | float | complex, grammages: Array | ndarray | bool_ | number | bool | int | float | complex, frequencies: list) Array | ndarray | bool_ | number | bool | int | float | complex¶
Retrieve the amplitude spectra at the specified frequencies, for a given \(\Delta X_{max}\).
- Parameters:¶
- xmax : float¶
The maximum of the atmospheric depth in g/cm^2
- spectral_coeffs : jax.typing.ArrayLike¶
the spectral coefficients stored with shape {GEO, CE} x VIEW x FREQ
- grammages : jax.typing.ArrayLike¶
an array of atmospheric depths in g/cm^2
- frequencies : list¶
The list of frequencies at which to evaluate the spectra (after filtering)
- Returns:¶
spectrum – the amplitude spectrum in shape {GEo x CE} x VIEW x FREQ x SLICES
- Return type:¶
jax.typing.ArrayLik