NuRadioReco.framework.event module

class NuRadioReco.framework.event.Event(run_number, event_id)[source]

Bases: ParameterStorage

Parameters:
parameter_typesparameter class or list of classes

The parameter classes are defined in NuRadioReco.framework.parameters

Methods

add_parameter_type(parameter_type)

Add a parameter class to the list of allowed parameter classes.

add_particle(particle)

Adds a MC particle to the event

add_shower(shower)

Adds a radio shower to the event

add_sim_emitter(sim_emitter)

Add a simulated emitter to the event

add_sim_shower(sim_shower)

Add a simulated shower to the event

deserialize(data_pkl)

Deserializes the event from a byte stream.

get_event_time()

Returns the event time (as astropy.time.Time object).

get_first_shower([ids])

Returns only the first shower stored in the event.

get_first_sim_emitter([ids])

Returns only the first sim emitter stored in the event.

get_first_sim_shower([ids])

Returns only the first sim shower stored in the event.

get_generator_info(key)

Deprecated.

get_hybrid_information()

Get information about hybrid detector data stored in the event.

get_id()

Returns the event ID (Event Number).

get_interaction_products(parent_particle[, ...])

Return all the daughter particles and showers generated in the interaction of the <parent_particle>

get_parameter(key)

Get a parameter

get_parameter_error(key)

Get the error of a parameter

get_parameters()

Get all parameters

get_parent(particle_or_shower)

returns the parent of a particle or a shower

get_particle(particle_id)

returns a specific MC particle identified by its unique id

get_particles()

Returns an iterator over the MC particles stored in the event

get_primary()

returns a first MC particle

get_run_number()

Returns the run number associated with the event.

get_shower(shower_id)

returns a specific shower identified by its unique id

get_showers([ids])

Returns an iterator over the showers stored in the event

get_sim_emitter(emitter_id)

returns a specific emitter identified by its unique id

get_sim_emitters()

Get an iterator over all simulated emitters in the event

get_sim_shower(shower_id)

returns a specific shower identified by its unique id

get_sim_showers()

Get an iterator over all simulated showers in the event

get_station([station_id])

Returns the station for a given station id.

get_station_ids()

Returns a list of all station IDs in the event.

get_stations()

Returns an iterator over all stations in the event.

get_waveforms([station_id, channel_id])

Returns the waveforms stored within the event.

has_generator_info(key)

Deprecated.

has_parameter(key)

Returns True if the parameter key is present, False otherwise

has_parameter_error(key)

Returns True if an uncertainty for the parameter key is present, False otherwise

has_particle([particle_id])

Returns true if at least one MC particle is stored in the event

has_shower([shower_id])

Returns true if at least one shower is stored in the event

has_sim_emitter([emitter_id])

Returns true if at least one simulated emitter is stored in the event

has_sim_shower([shower_id])

Returns true if at least one simulated shower is stored in the event

has_triggered([trigger_name])

Returns true if any station has been triggered.

iter_modules([station_id])

returns an interator that loops over all modules.

remove_parameter(key)

Remove a parameter

serialize(mode)

Serializes the event object and all its contents.

set_event_time(time[, format])

Set the (absolute) event time (will be stored as astropy.time.Time).

set_generator_info(key, value)

Deprecated.

set_id(evt_id)

Sets the event ID.

set_parameter(key, value)

Set a parameter

set_parameter_error(key, value)

Set the error of a parameter

set_station(station)

Adds a station to the event.

get_id()[source]

Returns the event ID (Event Number).

Returns:
int

The event ID / number.

set_id(evt_id)[source]

Sets the event ID.

Parameters:
evt_idint

The event ID to set.

get_run_number()[source]

Returns the run number associated with the event.

Returns:
int

The run number.

get_waveforms(station_id=None, channel_id=None)[source]

Returns the waveforms stored within the event.

You can specify the station and channel id to get specific waveforms. If you do not specify anything you will get all waveforms.

Parameters:
station_id: int (Default: None)

The station id of the station for which the waveforms should be returned. If None, the waveforms of all stations are returned.

channel_id: int or list of ints (Default: None)

The channel id(s) of the channel(s) for which the waveforms should be returned. If None, the waveforms of all channels are returned.

Returns:
times: np.ndarray(nr_stations, nr_channels, nr_samples)

A numpy array containing the times of the waveforms. The returned array is squeezed: (1, 10, 2048) -> (10, 2048) or (2, 1, 2048) -> (2, 2048).

waveforms: np.ndarray(nr_stations, nr_channels, nr_samples)

A numpy array containing the waveforms. The returned array is squeezed (see example for times).

get_station(station_id=None)[source]

Returns the station for a given station id.

Parameters:
station_id: int

Id of the station you want to get. If None and event has only one station return it, otherwise raise error. (Default: None)

Returns:
station: NuRadioReco.framework.station
set_event_time(time, format=None)[source]

Set the (absolute) event time (will be stored as astropy.time.Time).

Parameters:
time: astropy.time.Time or datetime.datetime or float

If “time” is a float, you have to specify its format.

format: str (Default: None)

Only used when “time” is a float. Format to interpret “time”.

get_event_time()[source]

Returns the event time (as astropy.time.Time object).

If the event time is not set, an error is raised. The event time is often only used in simulations and typically the same a station.get_station_time().

Returns:
event_timeastropy.time.Time

The event time.

get_stations()[source]

Returns an iterator over all stations in the event.

get_station_ids()[source]

Returns a list of all station IDs in the event.

set_station(station)[source]

Adds a station to the event.

Parameters:
stationNuRadioReco.framework.station.Station

The station object to add.

has_triggered(trigger_name=None)[source]

Returns true if any station has been triggered.

Parameters:
trigger_name: string or None (default None)
  • if None: The function returns False if not trigger was set. If one or multiple triggers were set,

    it returns True if any of those triggers triggered

  • if trigger name is set: return if the trigger with name ‘trigger_name’ has a trigger

Returns:
has_triggeredbool
add_particle(particle)[source]

Adds a MC particle to the event

Parameters:
particleNuRadioReco.framework.particle.Particle

The MC particle to be added to the event

get_particles()[source]

Returns an iterator over the MC particles stored in the event

get_particle(particle_id)[source]

returns a specific MC particle identified by its unique id

get_primary()[source]

returns a first MC particle

get_parent(particle_or_shower)[source]

returns the parent of a particle or a shower

has_particle(particle_id=None)[source]

Returns true if at least one MC particle is stored in the event

If particle_id is given, it checks if this particular MC particle exists

get_interaction_products(parent_particle, showers=True, particles=True)[source]

Return all the daughter particles and showers generated in the interaction of the <parent_particle>

Parameters:
showers: bool

Include simulated showers in the list

showers: bool

Include simulated particles in the list

add_shower(shower)[source]

Adds a radio shower to the event

Parameters:
shower: RadioShower object

The shower to be added to the event

get_showers(ids=None)[source]

Returns an iterator over the showers stored in the event

Parameters:
ids: list of integers

A list of station IDs. Only showers that are associated with all stations in the list are returned

get_shower(shower_id)[source]

returns a specific shower identified by its unique id

has_shower(shower_id=None)[source]

Returns true if at least one shower is stored in the event

If shower_id is given, it checks if this particular shower exists

get_first_shower(ids=None)[source]

Returns only the first shower stored in the event. Useful in cases when there is only one shower in the event.

Parameters:
ids: list of integers

A list of station IDs. The first shower that is associated with all stations in the list is returned

add_sim_shower(sim_shower)[source]

Add a simulated shower to the event

Parameters:
sim_shower: RadioShower object

The shower to be added to the event

get_sim_showers()[source]

Get an iterator over all simulated showers in the event

Returns:
sim_showers: iterator

An iterator over all simulated showers in the event

get_sim_shower(shower_id)[source]

returns a specific shower identified by its unique id

get_first_sim_shower(ids=None)[source]

Returns only the first sim shower stored in the event. Useful in cases when there is only one shower in the event.

Parameters:
ids: list of integers

A list of station IDs. The first shower that is associated with all stations in the list is returned

has_sim_shower(shower_id=None)[source]

Returns true if at least one simulated shower is stored in the event

If shower_id is given, it checks if this particular shower exists

add_sim_emitter(sim_emitter)[source]

Add a simulated emitter to the event

Parameters:
sim_emitter: SimEmitter object

The emitter to be added to the event

get_sim_emitters()[source]

Get an iterator over all simulated emitters in the event

get_sim_emitter(emitter_id)[source]

returns a specific emitter identified by its unique id

get_first_sim_emitter(ids=None)[source]

Returns only the first sim emitter stored in the event. Useful in cases when there is only one emitter in the event.

Parameters:
station_ids: list of integers

A list of station IDs. The first emitter that is associated with all stations in the list is returned

has_sim_emitter(emitter_id=None)[source]

Returns true if at least one simulated emitter is stored in the event

If emitter_id is given, it checks if this particular emitter exists

get_hybrid_information()[source]

Get information about hybrid detector data stored in the event.

iter_modules(station_id=None)[source]

returns an interator that loops over all modules. If a station id is provided it loops over all modules that are applied on event or station level (on this particular station). If no station_id is provided, the loop is only over the event modules. The order follows the sequence these modules were applied

get_generator_info(key)[source]

Deprecated. Use get_parameter instead.

Parameters:
keystr

The key for the generator info.

Returns:
valueany

The value associated with the key.

set_generator_info(key, value)[source]

Deprecated. Use set_parameter instead.

Parameters:
keystr

The key for the generator info.

valueany

The value to set.

has_generator_info(key)[source]

Deprecated. Use has_parameter instead.

Parameters:
keystr

The key for the generator info.

Returns:
bool

True if the key exists, False otherwise.

serialize(mode)[source]

Serializes the event object and all its contents.

Parameters:
modestr

The serialization mode.

Returns:
bytes

The serialized event as a byte stream.

deserialize(data_pkl)[source]

Deserializes the event from a byte stream.

Parameters:
data_pklbytes

The serialized event as a byte stream.

add_parameter_type(parameter_type)

Add a parameter class to the list of allowed parameter classes.

Parameters:
parameter_typeparameter class

The parameter class is defined in NuRadioReco.framework.parameters

get_parameter(key)

Get a parameter

get_parameter_error(key)

Get the error of a parameter

get_parameters()

Get all parameters

has_parameter(key)

Returns True if the parameter key is present, False otherwise

has_parameter_error(key)

Returns True if an uncertainty for the parameter key is present, False otherwise

remove_parameter(key)

Remove a parameter

set_parameter(key, value)

Set a parameter

set_parameter_error(key, value)

Set the error of a parameter