NuRadioReco.framework.base_trace module

class NuRadioReco.framework.base_trace.BaseTrace[source]

Bases: object

Methods

apply_time_shift(delta_t[, silent])

Uses the fourier shift theorem to apply a time shift to the trace Note that this is a cyclic shift, which means the trace will wrap around, which might lead to problems, especially for large time shifts.

get_filtered_trace(passband[, filter_type, ...])

Returns the trace after applying a filter to it.

get_number_of_samples()

returns the number of samples in the time domain

get_sampling_rate()

returns the sampling rate of the trace

get_trace()

returns the time trace.

set_frequency_spectrum(frequency_spectrum, ...)

Sets the frequency spectrum

set_trace(trace, sampling_rate)

Sets the time trace

add_trace_start_time

deserialize

get_frequencies

get_frequency_spectrum

get_hilbert_envelope

get_hilbert_envelope_mag

get_times

get_trace_start_time

resample

serialize

set_trace_start_time

get_trace()[source]

returns the time trace.

If the frequency spectrum was modified before, an ifft is performed automatically to have the time domain representation up to date.

Returns:
trace: np.array of floats

the time trace

get_filtered_trace(passband, filter_type='butter', order=10, rp=None)[source]

Returns the trace after applying a filter to it. This does not change the stored trace.

Parameters:
passband: list of floats

lower and upper bound of the filter passband

filter_type: string

type of the applied filter. Options are rectangular, butter and butterabs

order: int

Order of the Butterworth filter, if the filter types butter or butterabs are chosen

get_frequency_spectrum()[source]
set_trace(trace, sampling_rate)[source]

Sets the time trace

Parameters:
tracenp.array of floats

The time series

sampling_ratefloat or str

The sampling rate of the trace, i.e., the inverse of the bin width. If sampling_rate=”same”, sampling rate is not changed (requires previous initialisation).

set_frequency_spectrum(frequency_spectrum, sampling_rate)[source]

Sets the frequency spectrum

Parameters:
frequency_spectrumnp.array of floats

The frequency spectrum

sampling_ratefloat or str

The sampling rate of the trace, i.e., the inverse of the bin width. If sampling_rate=”same”, sampling rate is not changed (requires previous initialisation).

get_sampling_rate()[source]

returns the sampling rate of the trace

Returns:
sampling_rate: float

sampling rate, i.e., the inverse of the bin width

get_times()[source]
set_trace_start_time(start_time)[source]
add_trace_start_time(start_time)[source]
get_trace_start_time()[source]
get_frequencies()[source]
get_hilbert_envelope()[source]
get_hilbert_envelope_mag()[source]
get_number_of_samples()[source]

returns the number of samples in the time domain

Returns:
n_samples: int

number of samples in time domain

apply_time_shift(delta_t, silent=False)[source]

Uses the fourier shift theorem to apply a time shift to the trace Note that this is a cyclic shift, which means the trace will wrap around, which might lead to problems, especially for large time shifts.

Parameters:
delta_t: float

Time by which the trace should be shifted

silent: boolean (default:False)

Turn off warnings if time shift is larger than 10% of trace length Only use this option if you are sure that your trace is long enough to acommodate the time shift

resample(sampling_rate)[source]
serialize()[source]
deserialize(data_pkl)[source]