NuRadioReco.framework.sim_channel module

class NuRadioReco.framework.sim_channel.SimChannel(channel_id, shower_id, ray_tracing_id, channel_group_id=None)[source]

Bases: Channel

Object to store simulated channels.

This class is the same as the regular channel trace but has apart from the channel id (and possible group id) also a shower and ray tracing solution id

Methods

add_to_trace(channel)

Adds the trace of another channel to the trace of this channel.

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_frequencies([window_mask])

Returns the frequencies of the frequency spectrum.

get_frequency_spectrum([window_mask])

Returns the frequency spectrum.

get_group_id()

channel group id If no group id is specified, the channel id is returned.

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.

get_unique_identifier()

returns a unique identifier consisting of the tuple channel_id, shower_id and ray_tracing_id

set_frequency_spectrum(frequency_spectrum, ...)

Sets the frequency spectrum.

set_trace(trace, sampling_rate)

Sets the time trace.

add_trace_start_time

deserialize

get_hilbert_envelope

get_hilbert_envelope_mag

get_id

get_parameter

get_parameters

get_ray_tracing_solution_id

get_shower_id

get_times

get_trace_start_time

has_parameter

resample

serialize

set_parameter

set_trace_start_time

Initializes SimChannel object

Parameters:
channel_id: int

id of channel

shower_id: int or None

the id of the corresponding shower object

ray_tracing_id: int or None

the id of the corresponding ray tracing solution

channel_group_id: int (default: None)

optionally, several channels can belong to a “channel group”. Use case is to identify the channels of a single dual or triple polarized antenna as common in air shower arrays.

Methods

add_to_trace(channel)

Adds the trace of another channel to the trace of this channel.

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_frequencies([window_mask])

Returns the frequencies of the frequency spectrum.

get_frequency_spectrum([window_mask])

Returns the frequency spectrum.

get_group_id()

channel group id If no group id is specified, the channel id is returned.

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.

get_unique_identifier()

returns a unique identifier consisting of the tuple channel_id, shower_id and ray_tracing_id

set_frequency_spectrum(frequency_spectrum, ...)

Sets the frequency spectrum.

set_trace(trace, sampling_rate)

Sets the time trace.

add_trace_start_time

deserialize

get_hilbert_envelope

get_hilbert_envelope_mag

get_id

get_parameter

get_parameters

get_ray_tracing_solution_id

get_shower_id

get_times

get_trace_start_time

has_parameter

resample

serialize

set_parameter

set_trace_start_time

get_shower_id()[source]
get_ray_tracing_solution_id()[source]
get_unique_identifier()[source]

returns a unique identifier consisting of the tuple channel_id, shower_id and ray_tracing_id

serialize(save_trace)[source]
deserialize(data_pkl)[source]
add_to_trace(channel)

Adds the trace of another channel to the trace of this channel. The trace is only added within the time window of “this” channel. If this channel is an empty trace with a defined _sampling_rate and _trace_start_time, and a _time_trace containing zeros, this function can be seen as recording a channel in the specified readout window.

Parameters:
channel: BaseTrace

The channel whose trace is to be added to the trace of this channel.

add_trace_start_time(start_time)
apply_time_shift(delta_t, silent=False)

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

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

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_frequencies(window_mask=None)

Returns the frequencies of the frequency spectrum.

Parameters:
window_mask: array of bools (default: None)

If not None, used to determine the number of samples in the time domain used for the frequency spectrum.

Returns:
frequencies: np.array of floats

The frequencies of the frequency spectrum.

get_frequency_spectrum(window_mask=None)

Returns the frequency spectrum.

Parameters:
window_mask: array of bools (default: None)

If not None, specifies the time window to be used for the FFT. Has to have the same length as the trace.

Returns:
frequency_spectrum: np.array of floats

The frequency spectrum.

get_group_id()

channel group id If no group id is specified, the channel id is returned. This allows using modules that use the group_id feature also on detector setups that don’t use this feature.

get_hilbert_envelope()
get_hilbert_envelope_mag()
get_id()
get_number_of_samples()

Returns the number of samples in the time domain.

Returns:
n_samples: int

number of samples in time domain

get_parameter(key)
get_parameters()
get_sampling_rate()

Returns the sampling rate of the trace.

Returns:
sampling_rate: float

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

get_times()
get_trace()

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_trace_start_time()
has_parameter(key)
resample(sampling_rate)
set_frequency_spectrum(frequency_spectrum, sampling_rate)

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).

set_parameter(key, value)
set_trace(trace, sampling_rate)

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_trace_start_time(start_time)