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

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_hybrid_information()

Get information about hybrid detector data stored in the event.

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_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_waveforms([station_id, channel_id])

Returns the waveforms stored within the event.

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.

register_module_event(instance, name, kwargs)

registers modules applied to this event

register_module_station(station_id, ...)

registers modules applied to this event

remove_parameter(key)

Remove a parameter

set_event_time(time[, format])

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

set_parameter(key, value)

Set a parameter

set_parameter_error(key, value)

Set the error of a parameter

deserialize

get_generator_info

get_id

get_run_number

get_station_ids

get_stations

has_generator_info

serialize

set_generator_info

set_id

set_station

register_module_event(instance, name, kwargs)[source]

registers modules applied to this event

Parameters:
instance: module instance

the instance of the module that should be registered

name: module name

the name of the module

kwargs:

the key word arguments of the run method

register_module_station(station_id, instance, name, kwargs)[source]

registers modules applied to this event

Parameters:
station_id: int

the station id

instance: module instance

the instance of the module that should be registered

name: module name

the name of the module

kwargs:

the key word arguments of the run method

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]
set_generator_info(key, value)[source]
has_generator_info(key)[source]
get_id()[source]
set_id(evt_id)[source]
get_run_number()[source]
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]
get_station_ids()[source]
set_station(station)[source]
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.

serialize(mode)[source]
deserialize(data_pkl)[source]
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