NuRadioReco.utilities.noise module

NuRadioReco.utilities.noise.rolled_sum_roll(traces, rolling)[source]

calculates rolled sum via np.roll

Parameters:
traces: list

list containing 1D traces

rolling: list

list of offsets per trace for rolling

Returns:
sumtr: np.array

1D array of summed traces

NuRadioReco.utilities.noise.rolling_indices(traces, rolling)[source]

pre calculates rolling index array for rolled sum via take

Parameters:
traces: list

list containing (at least one) 1D trace

rolling: list

list of offsets per trace for rolling

NuRadioReco.utilities.noise.rolled_sum_take(traces, rolling_indices)[source]

calculates rolled sum via np.take

Parameters:
traces: list

list containing 1D traces

rolling_indices: list

list of pre-calculated 1D index arrays for rolled sum

Returns:
sumtr: np.array

1D array of summed traces

NuRadioReco.utilities.noise.rolled_sum_slicing(traces, rolling)[source]

calculates rolled sum via slicing

Parameters:
traces: list

list containing 1D traces

rolling: list

list of offsets per trace for rolling

Returns:
sumtr: np.array

1D array of summed traces

class NuRadioReco.utilities.noise.thermalNoiseGenerator(n_samples, sampling_rate, Vrms, threshold, time_coincidence, n_majority, time_coincidence_majority, n_channels, trigger_time, filt, noise_type='rayleigh', keep_full_band=False)[source]

Bases: object

Efficient algorithms to generate thermal noise fluctuations that fulfill a high/low trigger + a majority coincidence logic (as used by ARIANNA)

Parameters:
n_samples: int

the number of samples of the trace

sampling_rate: float

the sampling rate

Vrms: float

the RMS noise

threshold: float

the trigger threshold (assuming a symmetric high and low threshold)

time_coincidence: float

the high/low coincidence time

n_majority: int

specifies how many channels need to have a trigger

time_coincidence_majority: float

multi channel coincidence window

n_channels: int

number of channels to generate

trigger_time: float

the trigger time (time when the trigger completes)

filt: array of floats

the filter that should be applied after noise generation (needs to match frequency binning)

noise_type: string

the type of the noise, can be * “rayleigh” (default) * “noise”

keep_full_band: bool

Flag to keep the full-band waveform instead of the one with the filter applied. Allows for triggering on a different (i.e. filt) band than what is returned, (default is False)

Methods

generate_noise()

generates noise traces for all channels that will cause a high/low majority logic trigger

generate_noise()[source]

generates noise traces for all channels that will cause a high/low majority logic trigger

Returns np.array of shape (n_channels, n_samples)

class NuRadioReco.utilities.noise.thermalNoiseGeneratorPhasedArray(detector_filename, station_id, triggered_channels, Vrms, threshold, ref_index, noise_type='rayleigh', log_level=0, pre_trigger_time=100, trace_length=512, filt=None, upsampling=2, window_length=16, step_size=8, main_low_angle=-1.039338088856046, main_high_angle=1.039338088856046, n_beams=11, quantize=True)[source]

Bases: object

Efficient algorithms to generate thermal noise fluctuations that fulfill a phased array trigger

Parameters:
detector_filename: string

the filename to the detector description

station_id: int

the station id of the station from the detector file

triggered_channels: array of ints

list of channel ids that are part of the trigger

Vrms: float

the RMS noise

threshold: float

the trigger threshold (assuming a symmetric high and low threshold)

ref_index: float

reference refractive index for calculating time delays of the beams

Other Parameters:
noise_type: string

the type of the noise, can be * “rayleigh” (default) * “noise”

log_level: logging enum, default warn

the print level for this module

pre_trigger_time: float, default 100 ns

the time in the trace before the trigger happens

trace_length: float, default 512 ns

the total trace length

filt: array of complex values, default None

the filter that should be applied after noise generation (needs to match frequency binning in upsampled domain) if None, a default filter is calculated from 96 to 220 MHz

upsampling: int, default 2

factor by which the waveforms will be upsampled before calculating time delays and beamforming

window_length: float, default 16 ns

time interval of the integration window

step_size: float, default 8 ns

duration of a stride between window calcuations

main_low_angle: float, default -59.5 deg

angle (radians) of the lowest beam

main_high_angle: float 59.5 deg

angle (radians) of the highest beam

n_beams: int, default 11

number of beams to calculate

quantize: bool, default True

If set to true, the conversion to and from ADC will be performed to mimic digitizations

Methods

generate_noise([phasing_mode, trigger_mode, ...])

generates noise traces for all channels that will cause a high/low majority logic trigger

generate_noise2([debug])

generates noise traces for all channels that will cause a high/low majority logic trigger This implementation is slow due to nested python loops each rolling the trace over and over again

generate_noise(phasing_mode='slice', trigger_mode='binned_sum', debug=False)[source]

generates noise traces for all channels that will cause a high/low majority logic trigger

Parameters:
phasing_mode: string (default: “slice”)

“slice” or “roll”, two implementations for phasing by either slicing the array or using np.roll. The default shows better performance, but “roll” is kept as an alternative

trigger_mode: string (default: “binned_sum”)

“binned_sum” or “stride”, two implementations for triggering The default shows better performance, but “stride” is kept as an alternative

debug:

generate debug plot

Returns
——-
np.array of shape (n_channels, n_samples), index of triggered bin, index of triggered beam
generate_noise2(debug=False)[source]

generates noise traces for all channels that will cause a high/low majority logic trigger This implementation is slow due to nested python loops each rolling the trace over and over again

Returns np.array of shape (n_channels, n_samples)