NuRadioReco.modules.channelGenericNoiseAdder module
- class NuRadioReco.modules.channelGenericNoiseAdder.channelGenericNoiseAdder[source]
Bases:
object
Module that generates noise in some generic fashion (not based on measured data), which can be added to data.
Methods
add_random_phases
(amps, n_samples_time_domain)Adding random phase information to given amplitude spectrum.
bandlimited_noise
(min_freq, max_freq, ...[, ...])Generating noise of n_samples in a bandwidth [min_freq,max_freq].
Generating noise of n_samples in a bandwidth [min_freq,max_freq].
Adding random phase information to given amplitude spectrum.
Generating noise of n_samples in a bandwidth [min_freq,max_freq].
run
(event, station, detector[, amplitude, ...])Add noise to given event.
begin
end
- add_random_phases(amps, n_samples_time_domain)[source]
Adding random phase information to given amplitude spectrum.
- Parameters:
- amps: array of floats
Data that random phase is added to.
- n_samples_time_domain: int
number of samples in the time domain to differentiate between odd and even number of samples
- fftnoise_fullfft(f)[source]
Adding random phase information to given amplitude spectrum.
- Parameters:
- f: array of floats
Data that random phase is added to.
- bandlimited_noise(min_freq, max_freq, n_samples, sampling_rate, amplitude, type='perfect_white', time_domain=True, bandwidth=None)[source]
Generating noise of n_samples in a bandwidth [min_freq,max_freq].
- Parameters:
- min_freq: float
Minimum frequency of passband for noise generation min_freq = None: Only the DC component is removed. If the DC component should be included, min_freq = 0 has to be specified
- max_freq: float
Maximum frequency of passband for noise generation If the maximum frequency is above the Nquist frequencey (0.5 * sampling rate), the Nquist frequency is used max_freq = None: Frequencies up to Nyquist freq are used.
- n_samples: int
number of samples in the time domain
- sampling_rate: float
desired sampling rate of data
- amplitude: float
desired voltage of noise as V_rms (only roughly, since bandpass limited)
- type: string
perfect_white: flat frequency spectrum rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution # white: flat frequency spectrum with random jitter
- time_domain: bool (default True)
if True returns noise in the time domain, if False it returns the noise in the frequency domain. The latter might be more performant as the noise is generated internally in the frequency domain.
- bandwidth: float or None (default)
if this parameter is specified, the amplitude is interpreted as the amplitude for the bandwidth specified here Otherwise the amplitude is interpreted for the bandwidth of min(max_freq, 0.5 * sampling rate) - min_freq If bandwidth is larger then (min(max_freq, 0.5 * sampling rate) - min_freq) it has the same effect as None
Notes
Note that by design the max frequency is the Nyquist frequency, even if a bigger max_freq is implemented (RL 17-Sept-2018)
Add ‘multi_white’ noise option on 20-Sept-2018 (RL)
- precalculate_bandlimited_noise_parameters(min_freq, max_freq, n_samples, sampling_rate, amplitude, type='perfect_white', bandwidth=None)[source]
Generating noise of n_samples in a bandwidth [min_freq,max_freq].
- Parameters:
- min_freq: float
Minimum frequency of passband for noise generation min_freq = None: Only the DC component is removed. If the DC component should be included, min_freq = 0 has to be specified
- max_freq: float
Maximum frequency of passband for noise generation If the maximum frequency is above the Nquist frequencey (0.5 * sampling rate), the Nquist frequency is used max_freq = None: Frequencies up to Nyquist freq are used.
- n_samples: int
number of samples in the time domain
- sampling_rate: float
desired sampling rate of data
- amplitude: float
desired voltage of noise as V_rms (only roughly, since bandpass limited)
- type: string
perfect_white: flat frequency spectrum rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution # white: flat frequency spectrum with random jitter
- time_domain: bool (default True)
if True returns noise in the time domain, if False it returns the noise in the frequency domain. The latter might be more performant as the noise is generated internally in the frequency domain.
- bandwidth: float or None (default)
if this parameter is specified, the amplitude is interpreted as the amplitude for the bandwidth specified here Otherwise the amplitude is interpreted for the bandwidth of min(max_freq, 0.5 * sampling rate) - min_freq If bandwidth is larger then (min(max_freq, 0.5 * sampling rate) - min_freq) it has the same effect as None
Notes
Note that by design the max frequency is the Nyquist frequency, even if a bigger max_freq is implemented (RL 17-Sept-2018)
Add ‘multi_white’ noise option on 20-Sept-2018 (RL)
- bandlimited_noise_from_precalculated_parameters(type='perfect_white', time_domain=True)[source]
Generating noise of n_samples in a bandwidth [min_freq,max_freq].
- Parameters:
- min_freq: float
Minimum frequency of passband for noise generation min_freq = None: Only the DC component is removed. If the DC component should be included, min_freq = 0 has to be specified
- max_freq: float
Maximum frequency of passband for noise generation If the maximum frequency is above the Nquist frequencey (0.5 * sampling rate), the Nquist frequency is used max_freq = None: Frequencies up to Nyquist freq are used.
- n_samples: int
number of samples in the time domain
- sampling_rate: float
desired sampling rate of data
- amplitude: float
desired voltage of noise as V_rms (only roughly, since bandpass limited)
- type: string
perfect_white: flat frequency spectrum rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution # white: flat frequency spectrum with random jitter
- time_domain: bool (default True)
if True returns noise in the time domain, if False it returns the noise in the frequency domain. The latter might be more performant as the noise is generated internally in the frequency domain.
- bandwidth: float or None (default)
if this parameter is specified, the amplitude is interpreted as the amplitude for the bandwidth specified here Otherwise the amplitude is interpreted for the bandwidth of min(max_freq, 0.5 * sampling rate) - min_freq If bandwidth is larger then (min(max_freq, 0.5 * sampling rate) - min_freq) it has the same effect as None
Notes
Note that by design the max frequency is the Nyquist frequency, even if a bigger max_freq is implemented (RL 17-Sept-2018)
Add ‘multi_white’ noise option on 20-Sept-2018 (RL)
- run(event, station, detector, amplitude=0.001, min_freq=0.05, max_freq=2.0, type='perfect_white', excluded_channels=None, bandwidth=None)[source]
Add noise to given event.
- Parameters:
- event
- station
- detector
- amplitude: float or dict of floats
desired voltage of noise as V_rms for the specified bandwidth a dict can be used to specify a different amplitude per channel, the key is the channel_id
- min_freq: float
Minimum frequency of passband for noise generation
- max_freq: float
Maximum frequency of passband for noise generation If the maximum frequency is above the Nquist frequencey (0.5 * sampling rate), the Nquist frequency is used
- type: string
perfect_white: flat frequency spectrum rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution
- excluded_channels: list of ints
the channels ids of channels where no noise will be added, default is that no channel is excluded
- bandwidth: float or None (default)
if this parameter is specified, the amplitude is interpreted as the amplitude for the bandwidth specified here Otherwise the amplitude is interpreted for the bandwidth of min(max_freq, 0.5 * sampling rate) - min_freq If bandwidth is larger then (min(max_freq, 0.5 * sampling rate) - min_freq) it has the same effect as None