NuRadioReco.utilities.trace_utilities module

NuRadioReco.utilities.trace_utilities.get_efield_antenna_factor(station, frequencies, channels, detector, zenith, azimuth, antenna_pattern_provider)[source]

Returns the antenna response to a radio signal coming from a specific direction

Parameters:
station: Station
frequencies: array of complex

frequencies of the radio signal for which the antenna response is needed

channels: array of int

IDs of the channels

detector: Detector
zenith, azimuth: float, float

incoming direction of the signal. Note that refraction and reflection at the ice/air boundary are taken into account

antenna_pattern_provider: AntennaPatternProvider
NuRadioReco.utilities.trace_utilities.get_channel_voltage_from_efield(station, electric_field, channels, detector, zenith, azimuth, antenna_pattern_provider, return_spectrum=True)[source]

Returns the voltage traces that would result in the channels from the station’s E-field.

Parameters:
station: Station
electric_field: ElectricField
channels: array of int

IDs of the channels for which the expected voltages should be calculated

detector: Detector
zenith, azimuth: float

incoming direction of the signal. Note that reflection and refraction at the air/ice boundary are already being taken into account.

antenna_pattern_provider: AntennaPatternProvider
return_spectrum: boolean

if True, returns the spectrum, if False return the time trace

NuRadioReco.utilities.trace_utilities.get_electric_field_energy_fluence(electric_field_trace, times, signal_window_mask=None, noise_window_mask=None)[source]
NuRadioReco.utilities.trace_utilities.upsampling_fir(trace, original_sampling_frequency, int_factor=2, ntaps=128)[source]

This function performs an upsampling by inserting a number of zeroes between samples and then applying a finite impulse response (FIR) filter.

Parameters:
trace: array of floats

Trace to be upsampled

original_sampling_frequency: float

Sampling frequency of the input trace

int_factor: integer

Upsampling factor. The resulting trace will have a sampling frequency int_factor times higher than the original one

ntaps: integer

Number of taps (order) of the FIR filter

Returns:
upsampled_trace: array of floats

The upsampled trace

NuRadioReco.utilities.trace_utilities.butterworth_filter_trace(trace, sampling_frequency, passband, order=8)[source]

Filters a trace using a Butterworth filter.

Parameters:
trace: array of floats

Trace to be filtered

sampling_frequency: float

Sampling frequency

passband: (float, float) tuple

Tuple indicating the cutoff frequencies

order: integer

Filter order

Returns:
filtered_trace: array of floats

The filtered trace

NuRadioReco.utilities.trace_utilities.apply_butterworth(spectrum, frequencies, passband, order=8)[source]

Calculates the response from a Butterworth filter and applies it to the input spectrum

Parameters:
spectrum: array of complex

Fourier spectrum to be filtere

frequencies: array of floats

Frequencies of the input spectrum

passband: (float, float) tuple

Tuple indicating the cutoff frequencies

order: integer

Filter order

Returns:
filtered_spectrum: array of complex

The filtered spectrum

NuRadioReco.utilities.trace_utilities.delay_trace(trace, sampling_frequency, time_delay, delayed_samples=None)[source]

Delays a trace by transforming it to frequency and multiplying by phases. Since this method is cyclic, the trace has to be cropped. It only accepts positive delays, so some samples from the beginning are thrown away and then some samples from the end so that the total number of samples is equal to the argument delayed samples.

Parameters:
trace: array of floats

Array containing the trace

sampling_frequency: float

Sampling rate for the trace

time_delay: float

Time delay used for transforming the trace. Must be positive or 0

delayed_samples: integer or None

Number of samples that the delayed trace must contain if None: the trace is not cut

Returns:
delayed_trace: array of floats

The delayed, cropped trace