NuRadioReco.detector package

Submodules

NuRadioReco.detector.amp module

NuRadioReco.detector.amp.get_amp_response(frequencies, amp_name)

Get measured amplifier responses. Very simple script for currently NTU amps.

NuRadioReco.detector.antennapattern module

class NuRadioReco.detector.antennapattern.AntennaPattern(antenna_model, path='/home/christoph/Software/NuRadioReco/NuRadioReco/detector/AntennaModels', interpolation_method='complex')

Bases: NuRadioReco.detector.antennapattern.AntennaPatternBase

utility class that handles access and buffering to simulated antenna pattern

class NuRadioReco.detector.antennapattern.AntennaPatternAnalytic(antenna_model, cutoff_freq=0.05)

Bases: NuRadioReco.detector.antennapattern.AntennaPatternBase

utility class that handles access and buffering to analytic antenna pattern

parametric_phase(freq, phase_type='theoretical')
class NuRadioReco.detector.antennapattern.AntennaPatternBase

Bases: object

base class of utility class that handles access and buffering to antenna pattern

get_antenna_response_vectorized(freq, zenith, azimuth, orientation_theta, orientation_phi, rotation_theta, rotation_phi)

get the antenna response for a specific frequency, zenith and azimuth angle

All angles are specified in the ARIANNA coordinate system. All units are in ARIANNA default units

freqfloat or array of floats

frequency

zenithfloat

zenith angle of incoming signal direction

azimuthfloat

azimuth angle of incoming signal direction

orientation_theta: float

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: float

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: float

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

rotation_phi: float

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

VEL: dictonary of complex arrays

theta and phi component of the vector effective length, both components are complex floats or arrays of complex floats of the same length as the frequency input

class NuRadioReco.detector.antennapattern.AntennaPatternProvider

Bases: object

load_antenna_pattern(name, **kwargs)

loads an antenna pattern and returns the antenna pattern class

name: string

the name of the antenna pattern

**kwargs: dict

key word arguments that are passed to the init function of the AntennaPattern class (see documentation of this class for further information)

NuRadioReco.detector.antennapattern.get_group_delay(vector_effective_length, df)

helper function to calculate the group delay from the vector effecitve length

vector_effective_length: complex float

the vector effective length of an antenna

df: float

the size of a frequency bin

Returns: float (the group delay)

NuRadioReco.detector.antennapattern.get_pickle_antenna_response(path)

opens and return the pickle file containing the preprocessed WIPL-D antenna simulation If the pickle file is not present on the local file system, or if the file is outdated (verified via a sha1 hash sum), the file will be downloaded from a central data server

path: string

the path to the pickle file

NuRadioReco.detector.antennapattern.interpolate_linear(x, x0, x1, y0, y1, interpolation_method='complex')

helper function to linearly interpolate between two complex numbers

x: float

the requested position

x0, y0: float, complex float

the first data point

x1, y1: float, complex float

the second data point

interpolation_method: string

specifies if interpolation is in * complex (default) i.e. real and imaginary part * magnitude and phase

Returns: compex float

the interpolated value

NuRadioReco.detector.antennapattern.interpolate_linear_vectorized(x, x0, x1, y0, y1, interpolation_method='complex')

Same as interpolate_linear but all parameters can be vectors

NuRadioReco.detector.antennapattern.parse_AERA_XML_file(path)
NuRadioReco.detector.antennapattern.parse_ARA_file(ara)

Helper function that parses the ARAsim ASCII files containig antenna responses

ara: string

path to the file

Returns:
  • ff: array of floats

    frequencies

  • thetas: array of floats

    zenith angle of inicdent electric field

  • phis: array of floats

    azimuth angle of inicdent electric field

  • gains: array of floats

    corresponding linear gain values

  • phases: array of floats

    corresponding phases

NuRadioReco.detector.antennapattern.parse_HFSS_file(hfss)

Helper function that parses the HFSS files containig antenna responses

hfss: string

path to the file

Returns:
  • ff: array of floats

    frequencies

  • thetas: array of floats

    zenith angle of inicdent electric field

  • phis: array of floats

    azimuth angle of inicdent electric field

  • magnitudes_theta: array of floats

    corresponding logarithmic magnitude values theta component

  • magnitudes_phi: array of floats

    corresponding logarithmic magnitude values phi component

  • phases_phi: array of floats

    corresponding phases phi component

  • phases_theta: array of floats

    corresponding phases theta component

NuRadioReco.detector.antennapattern.parse_WIPLD_file(ad1, ra1, orientation, gen_num=1, s_parameters=None)

reads in WIPLD data

ad1: string

path to ad1 file

ra1: string

path to radiation pattern file

orientation: string

path to orientation file

gen_num: int

which antenna (one or two) to pull from

s_parameters: list of 2 ints

determines which s-parametr to extract (ex: [1,2] extracts S_12 parameter).

all parameters of the files

NuRadioReco.detector.antennapattern.preprocess_AERA(path)
NuRadioReco.detector.antennapattern.preprocess_ARA(path)

preprocess an antenna pattern in the ARASim ASCII file format. The vector effective length is calculated and the output is saved to the NuRadioReco pickle format.

path: string

the path to the file

NuRadioReco.detector.antennapattern.preprocess_HFSS(path)

preprocess an antenna pattern in the HFSS file format. The vector effective length is calculated and the output is saved in the NuRadioReco pickle format.

The vector effective length calculation still needs to be verified.

The frequencies, theta, phi, magnitude theta, magnitude phi, phase theta and phase phi are read from the csv file and than ordered according to the NuRadioReco format.

path: string

the path to the file

NuRadioReco.detector.antennapattern.preprocess_WIPLD(path, gen_num=1, s_parameters=None)

preprocesses WIPLD file

this function implements the older insufficient calculation of the vector effective length. This VEL only relates the incident electric field to the open circuit voltage and not the voltage in a 50 Ohm system.

path: string

path to folder containing ad1, ra1, and orientation files.

gen_num: int

which antenna (one or two) to pull from

s_parameters: list of 2 ints

determines which s-parametr to extract (ex: [1,2] extracts S_12 parameter).

  • 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

  • ff2: array of frequencies

  • theta: zenith angle of inicdent electric field

  • phi: azimuth angle of incident electric field

  • H_phi: the complex vector effective length of the ePhi polarization component

  • H_theta: the complex vector effective length of the eTheta polarization component

NuRadioReco.detector.antennapattern.preprocess_WIPLD_old(path, gen_num=1, s_parameters=None)

preprocesses WIPLD file

this function implements the older insufficient calculation of the vector effective length. This VEL only relates the incident electric field to the open circuit voltage and not the voltage in a 50 Ohm system.

path: string

path to folder containing ad1, ra1, and orientation files.

gen_num: int

which antenna (one or two) to pull from

s_parameters: list of 2 ints

determines which s-parametr to extract (ex: [1,2] extracts S_12 parameter).

  • 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

  • ff2: array of frequencies

  • theta: zenith angle of inicdent electric field

  • phi: azimuth angle of incident electric field

  • H_phi: the complex vector effective length of the ePhi polarization component

  • H_theta: the complex vector effective length of the eTheta polarization component

NuRadioReco.detector.antennapattern.preprocess_XFDTD(path)

preprocess an antenna pattern in the XFDTD file format. The vector effective length is calculated and the output is saved to the NuRadioReco pickle format.

path: string

the path to the file

NuRadioReco.detector.antennapattern.save_preprocessed_WIPLD(path)

saves preprocessed WIPLD files to a pickle file

path: string

path to folder containing ad1, ra1, and orientation files.

NuRadioReco.detector.antennapattern.save_preprocessed_WIPLD_forARA(path)

this function saves the realized gain in an ARASim readable format

path: string

path to folder containing ad1, ra1, and orientation files.

NuRadioReco.detector.antennapattern.save_preprocessed_WIPLD_old(path)

saves preprocessed WIPLD files to a pickle file

path: string

path to folder containing ad1, ra1, and orientation files.

NuRadioReco.detector.detector module

class NuRadioReco.detector.detector.DateTimeSerializer

Bases: tinydb_serialization.Serializer

helper class to serialize datetime objects with TinyDB

OBJ_CLASS

alias of datetime.datetime

decode(s)

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

encode(obj)

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

class NuRadioReco.detector.detector.Detector(source='json', json_filename='ARIANNA/arianna_detector_db.json', dictionary=None, assume_inf=True, antenna_by_depth=True)

Bases: object

main detector class which provides access to the detector description

This class provides functions for all relevant detector properties.

get_absolute_position(station_id)

get the absolute position of a specific station

station_id: int

the station id

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)

get the absolute position of a specific station

site: string

the position identifier e.g. “G”

3-dim array of absolute station position in easting, northing and depth wrt. to snow level at time of measurement

get_amplifier_measurement(station_id, channel_id)

returns a unique reference to the amplifier measurement

station_id: int

the station id

channel_id: int

the channel id

Returns string

get_amplifier_type(station_id, channel_id)

returns the type of the amplifier

station_id: int

the station id

channel_id: int

the channel id

Returns string

get_antenna_deployment_time(station_id, channel_id)

returns the time of antenna deployment

station_id: int

the station id

channel_id: int

the channel id

Returns datetime

get_antenna_model(station_id, channel_id, zenith=None)

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

so far only infinite firn and infinite air cases are differentiated

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_antenna_orientation(station_id, channel_id)

returns the orientation of a specific antenna

station_id: int

the station id

channel_id: int

the channel id

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_antenna_type(station_id, channel_id)

returns the antenna type

station_id: int

the station id

channel_id: int

the channel id

Returns string

get_cable_delay(station_id, channel_id)

returns the cable delay of a channel

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)

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

station_id: int

the station id

channel_id: int

the channel id

Returns tuple (string, float)

get_channel(station_id, channel_id)

returns a dictionary of all channel parameters

station_id: int

the station id

channel_id: int

the channel id

dict of channel parameters

get_channel_ids(station_id)

get the channel ids of a station

station_id: int

the station id

Returns list of ints

get_detector_time()

Returns the time that the detector is currently set to

get_noise_RMS(station_id, channel_id, stage='amp')

returns the noise RMS that was precomputed from forced triggers

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

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)

returns the noise temperature of the channel

station_id: int

station id

channel_id: int

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

get_number_of_channels(station_id)

Get the number of channels per station

station_id: int

the station id

Returns int

get_number_of_samples(station_id, channel_id)

returns the number of samples of a channel

station_id: int

the station id

channel_id: int

the channel id

Returns int

get_parallel_channels(station_id)

get a list of parallel antennas

station_id: int

the station id

Returns list of list of ints

get_relative_position(station_id, channel_id)

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

station_id: int

the station id

channel_id: int

the channel id

3-dim array of relative station position

get_sampling_frequency(station_id, channel_id)

returns the sampling frequency

station_id: int

the station id

channel_id: int

the channel id

Returns float

get_site(station_id)

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

station_id: int

the station id

Returns string

get_station(station_id)
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

station_id: int

the station id

Returns datetime tuple

has_station(station_id)

checks if a station is present in the database

station_id: int

the station id

Returns bool

update(time)

updates the detector description to a new time

time: astropy.time.Time

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

class NuRadioReco.detector.detector.Singleton

Bases: type

NuRadioReco.detector.detector.buffer_db(in_memory, filename=None)

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

NuRadioReco.detector.detector_sql module

class NuRadioReco.detector.detector_sql.Detector

Bases: object

get_absolute_position_site(pos)

returns the UTM coordinates

pos: string

the position identifier (e.g. “A” or “X”)

  • easting (float)

  • northing (float)

  • UTM zone (string)

  • altitude

  • measurement time

get_amplifier_type(station_id, channel_id)
get_antenna_deployment_time(station_id, channel_id)
get_antenna_model(station_id, channel_id)

determine correct antenna model from antenna type, position and orientation of antenna

so far only infinite firn and infinite air cases are differentiated

get_antenna_orientation(station_id, channel_id)

returns the orientation of a specific antenna * orientation theta: boresight direction (zenith angle, 0deg is the zenith, 180deg is straight down) * orientation phi: boresight direction (azimuth angle counting from East counterclockwise) * rotation theta: rotation of the antenna, vector in plane of tines pointing away from connector * rotation phi: rotation of the antenna, vector in plane of tines pointing away from connector

get_antenna_type(station_id, channel_id)
get_cable_delay(station_id, channel_id)
get_cable_type_and_length(station_id, channel_id)
get_everything(station_id)
get_everything_channels()
get_everything_positions()
get_everything_stations()
get_number_of_channels(station_id)
get_number_of_samples(station_id, channel_id)
get_relative_position(station_id, channel_id)
get_relative_positions(station_id)
get_sampling_frequency(station_id, channel_id)
get_site(station_id)
update(timestamp)
NuRadioReco.detector.detector_sql.get_amplifier_type(station_id, channel)
NuRadioReco.detector.detector_sql.get_antenna_model_file(station_type)
NuRadioReco.detector.detector_sql.get_antenna_type(station_type, channel)
NuRadioReco.detector.detector_sql.get_cable_delays(station_id)
NuRadioReco.detector.detector_sql.get_number_of_channels(station_type)
NuRadioReco.detector.detector_sql.get_relative_position(station, channel)
NuRadioReco.detector.detector_sql.get_relative_positions(station)
NuRadioReco.detector.detector_sql.get_station_type(station_id, time)

NuRadioReco.detector.filterresponse module

NuRadioReco.detector.filterresponse.get_filter_response(frequencies, filter_name)

Get measured filter responses.

NuRadioReco.detector.filterresponse.get_filter_response_mini_circuits(frequencies, filter_name)

Simple minicircuits filters. Check filter directory for available filters.

NuRadioReco.detector.filterresponse.get_filter_response_mini_circuits2(frequencies, filter_name)

Simple minicircuits filters. Check filter directory for available filters. Parse input file and convert to default units

NuRadioReco.detector.generic_detector module

class NuRadioReco.detector.generic_detector.GenericDetector(json_filename, default_station, default_channel=None, source='json', dictionary=None, assume_inf=True, antenna_by_depth=True)

Bases: NuRadioReco.detector.detector.Detector

Used the same way as the main detector class, but works with incomplete detector descriptions. The user can define a default station. If any property is missing from one of the other station, the value from the default station will be used instead. If no channels are specified for a station, the channels from the default station will be used instead. For cases when the station design has a lot of channels, a default channel can also be defined. The default channel has to be part of the default station. It works the same way as the default station: Any property missing from one of the other channels will be taken from the default channel. The GenericDetector also ignores commission and decommision times and should therefore not be used for real data, but only for simulation studies. This detector only accepts json detector descriptions or dictionary.

add_generic_station(station_dict)

Add a generic station to the detector. The station is treated like a generic station in the original detector description file, i.e. all missing properties and all channels will be taken from the default station. If a station with the same ID already exists, this function does nothing.

station_dict: dictionary

dictionary containing the station properties. Needs to at least include a station_id, any other missing parameters will be taken from the default station

add_station_properties_for_event(properties, station_id, run_number, event_id)

Adds an entry to the list of event-specific changes to the detector description.

properties: dictionary

Dictionary of the properties that should be changed, with keys being any of the property names in the detector description and values the values that these properties should be changed to

station_id: integer

ID of the station whose properties should be changed

run_number: integer

Run number of the event for which the changes are valid

event_id: integer

Event ID of the event for which the changes are valid

get_default_channel()

Get the properties of the default channel

get_default_channel_id()

Get the ID of the default channel

get_default_station()

Get the properties of the default station

get_default_station_id()

Get the ID of the default station

get_raw_channel(station_id, channel_id)

Get the properties of a channel as they are in the original detector description, i.e. without missing properties being replaced by those from the default channel.

station_id: integer

ID of the requested channel’s station

channel_id: integer

ID of the requested channel

get_raw_station(station_id)

Get the properties of a station as they are in the original detector description, i.e. without missing properties being replaced by those from the default station. Event-specific changes are also ignored.

station_id: integer

ID of the requested station

get_station_properties_for_event(run_number, event_id, station_id=None)

Returns all event-specific changes that have been stored in the detector description for a given station and event

run_number: integer

Run number of the event for which the changes should be returned

event_id: integer

Event ID of the event for which the changes should be returned

station_id: integer or None

ID of the station for which the changes should be returned If station_id is None, changes for all stations are returned

has_station(station_id)

checks if a station is present in the database

station_id: int

the station id

Returns bool

set_event(run_number, event_id)

Sets the run number and event ID for which the detector description should be returned. This is needed if event-specific changes to the detector description have been stored. If run_number or event_id are not set (or are set to None), event-specific changes to the detector will be ignored

run_number: integer

Run number of the event the detector should be set to

event_id: integer

ID of the event the detector should be set to

update(time)

updates the detector description to a new time

time: astropy.time.Time

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

NuRadioReco.detector.sql_to_json module

NuRadioReco.detector.test_detector_db module

Module contents