NuRadioReco.detector.detector_base module

class NuRadioReco.detector.detector_base.DateTimeSerializer[source]

Bases: Serializer

helper class to serialize datetime objects with TinyDB

Methods

OBJ_CLASS

alias of datetime

decode(s)

Decode an object.

encode(obj)

Encode an object.

OBJ_CLASS

alias of datetime

encode(obj)[source]

Encode an object. :param obj: :return: :rtype: str

decode(s)[source]

Decode an object. :param s: :type s: str :return:

NuRadioReco.detector.detector_base.buffer_db(in_memory, filename=None)[source]

buffers the complete SQL database into a TinyDB object (either in memory or into a local JSON file)

Parameters:
in_memory: bool

if True: the mysql database will be buffered as a tiny tb object that only exists in memory if False: the mysql database will be buffered as a tiny tb object and saved in a local json file

filename: string

only relevant if in_memory = True: the filename of the json file of the tiny db object

class NuRadioReco.detector.detector_base.DetectorBase(*args, **kwargs)[source]

Bases: object

main detector class which provides access to the detector description

This class provides functions for all relevant detector properties.

Attributes:
antenna_by_depth

Getter function for the antenna_by_depth attribute

assume_inf

Getter function for the assume_inf attribute

Methods

get_absolute_position(station_id)

get the absolute position of a specific station

get_absolute_position_site(site)

get the absolute position of a specific station

get_amplifier_measurement(station_id, channel_id)

returns a unique reference to the amplifier measurement

get_amplifier_response(station_id, ...)

Returns the amplifier response for the amplifier of a given channel

get_amplifier_type(station_id, channel_id)

returns the type of the amplifier

get_antenna_deployment_time(station_id, ...)

returns the time of antenna deployment

get_antenna_model(station_id, channel_id[, ...])

determines the correct antenna model from antenna type, position and orientation of antenna

get_antenna_orientation(station_id, channel_id)

returns the orientation of a specific antenna

get_antenna_type(station_id, channel_id)

returns the antenna type

get_cable_delay(station_id, channel_id)

returns the cable delay of a channel

get_cable_type_and_length(station_id, channel_id)

returns the cable type (e.g.

get_channel(station_id, channel_id)

returns a dictionary of all channel parameters

get_channel_group_id(station_id, channel_id)

returns the group ID of a channel

get_channel_ids(station_id)

get the channel ids of a station

get_detector_time()

Returns the time that the detector is currently set to

get_device(station_id, device_id)

returns a dictionary of all device parameters

get_device_ids(station_id)

get the device ids of a station

get_noise_RMS(station_id, channel_id[, stage])

returns the noise RMS that was precomputed from forced triggers

get_noise_temperature(station_id, channel_id)

returns the noise temperature of the channel

get_number_of_channels(station_id)

Get the number of channels per station

get_number_of_devices(station_id)

Get the number of devices per station

get_number_of_samples(station_id, channel_id)

returns the number of samples of a channel

get_parallel_channels(station_id)

get a list of parallel antennas

get_relative_position(station_id, channel_id)

get the relative position of a specific channels/antennas with respect to the station center

get_sampling_frequency(station_id, channel_id)

returns the sampling frequency

get_site(station_id)

get the site where the station is deployed (e.g.

get_site_coordinates(station_id)

get the (latitude, longitude) coordinates (in degrees) for a given detector site.

get_station_ids()

returns a sorted list of all station ids present in the database

get_unique_time_periods(station_id)

returns the time periods in which the station configuration (including all channels) was constant

has_station(station_id)

checks if a station is present in the database

is_channel_noiseless(station_id, channel_id)

returns true if the detector description has the field noiseless and if this field is True.

update(time)

updates the detector description to a new time

get_station

Initialize the stations detector properties. By default, a new detector instance is only created of none exists yet, otherwise the existing instance is returned. To force the creation of a new detector instance, pass the additional keyword parameter create_new=True to this function. For more details, check the documentation for the Singleton metaclass.

Parameters:
sourcestr

‘json’, ‘dictionary’ or ‘sql’ default value is ‘json’ if dictionary is specified, the dictionary passed to __init__ is used if ‘sql’ is specified, the file ‘detector_sql_auth.json’ file needs to be present in this folder that specifies the sql server credentials (see ‘detector_sql_auth.json.sample’ for an example of the syntax)

json_filenamestr

the path to the json detector description file (if first checks a path relative to this directory, then a path relative to the current working directory of the user) default value is ‘ARIANNA/arianna_detector_db.json’

assume_infBool

Default to True, if true forces antenna models to have infinite boundary conditions, otherwise the antenna madel will be determined by the station geometry.

antenna_by_depth: bool (default True)

if True the antenna model is determined automatically depending on the depth of the antenna. This is done by appending e.g. ‘_InfFirn’ to the antenna model name. if False, the antenna model as specified in the database is used.

create_new: bool (default:False)

Can be used to force the creation of a new detector object. By default, the __init__ will only create a new object if none already exists.

Attributes:
antenna_by_depth

Getter function for the antenna_by_depth attribute

assume_inf

Getter function for the assume_inf attribute

Methods

get_absolute_position(station_id)

get the absolute position of a specific station

get_absolute_position_site(site)

get the absolute position of a specific station

get_amplifier_measurement(station_id, channel_id)

returns a unique reference to the amplifier measurement

get_amplifier_response(station_id, ...)

Returns the amplifier response for the amplifier of a given channel

get_amplifier_type(station_id, channel_id)

returns the type of the amplifier

get_antenna_deployment_time(station_id, ...)

returns the time of antenna deployment

get_antenna_model(station_id, channel_id[, ...])

determines the correct antenna model from antenna type, position and orientation of antenna

get_antenna_orientation(station_id, channel_id)

returns the orientation of a specific antenna

get_antenna_type(station_id, channel_id)

returns the antenna type

get_cable_delay(station_id, channel_id)

returns the cable delay of a channel

get_cable_type_and_length(station_id, channel_id)

returns the cable type (e.g.

get_channel(station_id, channel_id)

returns a dictionary of all channel parameters

get_channel_group_id(station_id, channel_id)

returns the group ID of a channel

get_channel_ids(station_id)

get the channel ids of a station

get_detector_time()

Returns the time that the detector is currently set to

get_device(station_id, device_id)

returns a dictionary of all device parameters

get_device_ids(station_id)

get the device ids of a station

get_noise_RMS(station_id, channel_id[, stage])

returns the noise RMS that was precomputed from forced triggers

get_noise_temperature(station_id, channel_id)

returns the noise temperature of the channel

get_number_of_channels(station_id)

Get the number of channels per station

get_number_of_devices(station_id)

Get the number of devices per station

get_number_of_samples(station_id, channel_id)

returns the number of samples of a channel

get_parallel_channels(station_id)

get a list of parallel antennas

get_relative_position(station_id, channel_id)

get the relative position of a specific channels/antennas with respect to the station center

get_sampling_frequency(station_id, channel_id)

returns the sampling frequency

get_site(station_id)

get the site where the station is deployed (e.g.

get_site_coordinates(station_id)

get the (latitude, longitude) coordinates (in degrees) for a given detector site.

get_station_ids()

returns a sorted list of all station ids present in the database

get_unique_time_periods(station_id)

returns the time periods in which the station configuration (including all channels) was constant

has_station(station_id)

checks if a station is present in the database

is_channel_noiseless(station_id, channel_id)

returns true if the detector description has the field noiseless and if this field is True.

update(time)

updates the detector description to a new time

get_station

property assume_inf

Getter function for the assume_inf attribute

property antenna_by_depth

Getter function for the antenna_by_depth attribute

get_station_ids()[source]

returns a sorted list of all station ids present in the database

get_station(station_id)[source]
has_station(station_id)[source]

checks if a station is present in the database

Parameters:
station_id: int

the station id

Returns bool
get_unique_time_periods(station_id)[source]

returns the time periods in which the station configuration (including all channels) was constant

Parameters:
station_id: int

the station id

Returns datetime tuple
update(time)[source]

updates the detector description to a new time

Parameters:
time: astropy.time.Time

the time to update the detector description to for backward compatibility datetime is also accepted, but astropy.time is prefered

get_detector_time()[source]

Returns the time that the detector is currently set to

get_channel(station_id, channel_id)[source]

returns a dictionary of all channel parameters

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns:
dict of channel parameters
get_device(station_id, device_id)[source]

returns a dictionary of all device parameters

Parameters:
station_id: int

the station id

device_id: int

the device id

Returns:
dict of device parameters
get_absolute_position(station_id)[source]

get the absolute position of a specific station

Parameters:
station_id: int

the station id

Returns:
3-dim array of absolute station position in easting, northing and depth wrt. to snow level at
time of measurement
get_absolute_position_site(site)[source]

get the absolute position of a specific station

Parameters:
site: string

the position identifier e.g. “G”

Returns:
3-dim array of absolute station position in easting, northing and depth wrt. to snow level at
time of measurement
get_relative_position(station_id, channel_id, mode='channel')[source]

get the relative position of a specific channels/antennas with respect to the station center

Parameters:
station_id: int

the station id

channel_id: int

the channel id

mode_id: str

specify if relative position of a channel or a device is asked for

Returns:
3-dim array of relative station position
get_site(station_id)[source]

get the site where the station is deployed (e.g. MooresBay or South Pole)

Parameters:
station_id: int

the station id

Returns string
get_site_coordinates(station_id)[source]

get the (latitude, longitude) coordinates (in degrees) for a given detector site.

Parameters:
station_id: int

the station ID

get_number_of_channels(station_id)[source]

Get the number of channels per station

Parameters:
station_id: int

the station id

Returns int
get_channel_ids(station_id)[source]

get the channel ids of a station

Parameters:
station_id: int

the station id

Returns list of ints
get_parallel_channels(station_id)[source]

get a list of parallel antennas

Parameters:
station_id: int

the station id

Returns list of list of ints
get_number_of_devices(station_id)[source]

Get the number of devices per station

Parameters:
station_id: int

the station id

Returns int
get_device_ids(station_id)[source]

get the device ids of a station

Parameters:
station_id: int

the station id

Returns list of ints
get_cable_delay(station_id, channel_id)[source]

returns the cable delay of a channel

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns float (delay time)
get_cable_type_and_length(station_id, channel_id)[source]

returns the cable type (e.g. LMR240) and its length

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns tuple (string, float)
get_antenna_type(station_id, channel_id)[source]

returns the antenna type

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns string
get_antenna_deployment_time(station_id, channel_id)[source]

returns the time of antenna deployment

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns datetime
get_antenna_orientation(station_id, channel_id)[source]

returns the orientation of a specific antenna

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns:
tuple of floats
  • orientation theta: orientation of the antenna, as a zenith angle (0deg is the zenith, 180deg is straight down); for LPDA: outward along boresight; for dipoles: upward along axis of azimuthal symmetry

  • orientation phi: orientation of the antenna, as an azimuth angle (counting from East counterclockwise); for LPDA: outward along boresight; for dipoles: upward along axis of azimuthal symmetry

  • rotation theta: rotation of the antenna, is perpendicular to ‘orientation’, for LPDAs: vector perpendicular to the plane containing the the tines

  • rotation phi: rotation of the antenna, is perpendicular to ‘orientation’, for LPDAs: vector perpendicular to the plane containing the the tines

get_amplifier_type(station_id, channel_id)[source]

returns the type of the amplifier

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns string
get_amplifier_measurement(station_id, channel_id)[source]

returns a unique reference to the amplifier measurement

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns string
get_amplifier_response(station_id, channel_id, frequencies)[source]

Returns the amplifier response for the amplifier of a given channel

Parameters:
station_id: int

The ID of the station

channel_id: int

The ID of the channel

frequencies: array of floats

The frequency array for which the amplifier response shall be returned

get_sampling_frequency(station_id, channel_id)[source]

returns the sampling frequency

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns float
get_number_of_samples(station_id, channel_id)[source]

returns the number of samples of a channel

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns int
get_antenna_model(station_id, channel_id, zenith=None)[source]

determines the correct antenna model from antenna type, position and orientation of antenna

so far only infinite firn and infinite air cases are differentiated

Parameters:
station_id: int

the station id

channel_id: int

the channel id

zenith: float or None (default)

the zenith angle of the incoming signal direction

Returns string
get_channel_group_id(station_id, channel_id)[source]

returns the group ID of a channel

Parameters:
station_id: int

the station id

channel_id: int

the channel id

Returns:
group_idint

the channel group ID

get_noise_RMS(station_id, channel_id, stage='amp')[source]

returns the noise RMS that was precomputed from forced triggers

Parameters:
station_id: int

station id

channel_id: int

the channel id, not used at the moment, only station averages are computed

stage: string (default ‘amp’)

specifies the stage of reconstruction you want the noise RMS for, stage can be one of

  • ‘raw’ (raw measured trace)

  • ‘amp’ (after the amp was deconvolved)

  • ‘filt’ (after the trace was highpass with 100MHz

Returns:
RMS: float

the noise RMS (actually it is the standard deviation but as the mean should be zero its the same)

get_noise_temperature(station_id, channel_id)[source]

returns the noise temperature of the channel

Parameters:
station_id: int

station id

channel_id: int

the channel id

is_channel_noiseless(station_id, channel_id)[source]

returns true if the detector description has the field noiseless and if this field is True.

Allows to run a noiseless simulation on specific channels (for example to simulate a single-antenna proxy along with the phased array)

Parameters:
station_id: int

station id

channel_id: int

the channel id