NuRadioReco.detector.antennapattern module
- NuRadioReco.detector.antennapattern.interpolate_linear(x, x0, x1, y0, y1, interpolation_method='complex')[source]
helper function to linearly interpolate between two complex numbers
- Parameters:
- 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:
- y: complex float
the interpolated value
- NuRadioReco.detector.antennapattern.interpolate_linear_vectorized(x, x0, x1, y0, y1, interpolation_method='complex')[source]
Same as
interpolate_linear
but all parameters can be vectors
- NuRadioReco.detector.antennapattern.get_group_delay(vector_effective_length, df)[source]
helper function to calculate the group delay from the vector effecitve length
- Parameters:
- vector_effective_length: complex float
the vector effective length of an antenna
- df: float
the size of a frequency bin
- Returns:
- dt: float
the group delay
- NuRadioReco.detector.antennapattern.parse_RNOG_XFDTD_file(path_gain, path_phases, encoding=None)[source]
” reads in XFDTD data
- Parameters:
- path_gain: string
path to gain file
- path_phases:
path to phases file
- Returns:
- all paramters of the file as numpy arrays
- NuRadioReco.detector.antennapattern.preprocess_RNOG_XFDTD(path_gain, path_phases, outputfilename, n_index=1.74, encoding=None)[source]
” Preprocess an antenna pattern in XFDTD file format. The vector effective length is calculated and the output is saved to the NuRadioReco pickle format.
This conversion function ASSUMES THAT THE XFDTD SIMULATION IS DONE IN AIR! HERE WE DO A FIRST ORDER RESCALING TO A DIFFERENT INDEX OF REFRACTION by just rescaling the frequencies by f -> f/n.
- Parameters:
- path_gain: string
path to gain file
- path_phases: string
path to phases file
- outputfilename: string
path to outputfilename
- n_index: float
refractive index for requested antenna file. The method assumes that simulations are done in air (n = 1)
- NuRadioReco.detector.antennapattern.parse_WIPLD_file(ad1, ra1, orientation, gen_num=1, s_parameters=None)[source]
reads in WIPLD data
- Parameters:
- 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).
- Returns:
- all parameters of the files
- NuRadioReco.detector.antennapattern.preprocess_WIPLD_old(path, gen_num=1, s_parameters=None)[source]
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.
- Parameters:
- 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).
- Returns:
- 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
- ff2: array of floats
array of frequencies
- theta: float
zenith angle of inicdent electric field
- phi: float
azimuth angle of incident electric field
- H_phi: float
the complex realized vector effective length of the ePhi polarization component
- H_theta: float
the complex realized vector effective length of the eTheta polarization component
- NuRadioReco.detector.antennapattern.save_preprocessed_WIPLD_old(path)[source]
saves preprocessed WIPLD files to a pickle file
- Parameters:
- path: string
path to folder containing ad1, ra1, and orientation files.
- NuRadioReco.detector.antennapattern.preprocess_WIPLD(path, gen_num=1, s_parameters=None)[source]
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.
- Parameters:
- 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).
- Returns:
- 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
- ff2: array of floats
array of frequencies
- theta: float
zenith angle of inicdent electric field
- phi: float
azimuth angle of incident electric field
- H_phi: float
the complex realized vector effective length of the ePhi polarization component
- H_theta: float
the complex realized vector effective length of the eTheta polarization component
- NuRadioReco.detector.antennapattern.save_preprocessed_WIPLD(path)[source]
saves preprocessed WIPLD files to a pickle file
- Parameters:
- path: string
path to folder containing ad1, ra1, and orientation files.
- NuRadioReco.detector.antennapattern.save_preprocessed_WIPLD_forARA(path)[source]
this function saves the realized gain in an ARASim readable format
- Parameters:
- path: string
path to folder containing ad1, ra1, and orientation files.
- NuRadioReco.detector.antennapattern.get_pickle_antenna_response(path)[source]
opens and return the pickle file containing the preprocessed e.g. WIPL-D antenna simulation in NuRadioReco conventions.
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
- Parameters:
- path: string
the path to the pickle file
- Returns:
- res: 9 lists
list containing the following elements:
- 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
- ff: array of floats
array of frequencies
- thetas: array of floats
zenith angle of inicdent electric field
- phis: array of floats
azimuth angle of incident electric field
- H_phi: array of floats
the complex realized vector effective length of the ePhi polarization component
- H_theta: array of floats
the complex realized vector effective length of the eTheta polarization component
- NuRadioReco.detector.antennapattern.parse_ARA_file(ara)[source]
Helper function that parses the ARAsim ASCII files containig antenna responses
- Parameters:
- 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.preprocess_ARA(path)[source]
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.
- Parameters:
- path: string
the path to the file
- NuRadioReco.detector.antennapattern.parse_HFSS_file(hfss)[source]
Helper function that parses the HFSS files containig antenna responses
- Parameters:
- 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.preprocess_HFSS(path)[source]
preprocess an antenna pattern in the HFSS file format. The realized 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.
- Parameters:
- path: string
the path to the file
- NuRadioReco.detector.antennapattern.preprocess_XFDTD(path)[source]
preprocess an antenna pattern in the XFDTD file format. The realized vector effective length is calculated and the output is saved to the NuRadioReco pickle format.
- Parameters:
- path: string
the path to the file
- NuRadioReco.detector.antennapattern.parse_LOFAR_txt_file(path_theta, path_phi)[source]
Extract the values from a simulation file for the LOFAR LBA antenna model.
- Parameters:
- path_thetastr
Path to the file containing the values for the theta component
- path_phistr
Path to the file containing the values for the phi component
- NuRadioReco.detector.antennapattern.preprocess_LOFAR_txt(directory, ant='LBA')[source]
Function to parse the LOFAR antenna model simulation files in TXT format. It extracts the vector effective length for all simulated frequencies, azimuth and zenith angles and dumps them into a pickle file according to the NuRadioReco specification.
- Parameters:
- directorystr
The path to the directory where the TXT files are stored
- antstr, default=’LBA’
The antenna type
- class NuRadioReco.detector.antennapattern.AntennaPatternBase[source]
Bases:
object
base class of utility class that handles access and buffering to antenna pattern
Methods
get_antenna_response_vectorized
(freq, ...)get the antenna response for a specific frequency, zenith and azimuth angle
- get_antenna_response_vectorized(freq, zenith, azimuth, orientation_theta, orientation_phi, rotation_theta, rotation_phi)[source]
get the antenna response for a specific frequency, zenith and azimuth angle
All angles are specified in the NuRadio coordinate system. All units are in NuRadio default units
- Parameters:
- 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
- Returns:
- 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.AntennaPattern(antenna_model, path='/home/runner/work/NuRadioMC/NuRadioMC/NuRadioReco/detector/AntennaModels', interpolation_method='complex')[source]
Bases:
AntennaPatternBase
Utility class that handles access and buffering to simulated antenna pattern. The class accesses the NuRadioReco pickle format file which contains the preprocessed antenna pattern.
The pickle file contains 9 lists of the following elements:
- 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
- ff: array of floats
array of frequencies
- thetas: array of floats
zenith angle of inicdent electric field
- phis: array of floats
azimuth angle of incident electric field
- H_phi: array of floats
the complex realized vector effective length of the ePhi polarization component
- H_theta: array of floats
the complex realized vector effective length of the eTheta polarization component
Methods
get_antenna_response_vectorized
(freq, ...)get the antenna response for a specific frequency, zenith and azimuth angle
- Parameters:
- antenna_model: string
name of antenna model
- path: string
path to folder containing the antenna models
- interpolation_mode: string
specify in which domain the interpolation should be performed, can be either
‘complex’ (default) interpolate real and imaginary part of vector effective length
‘magphase’ interpolate magnitude and phase of vector effective length
Methods
get_antenna_response_vectorized
(freq, ...)get the antenna response for a specific frequency, zenith and azimuth angle
- 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 NuRadio coordinate system. All units are in NuRadio default units
- Parameters:
- 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
- Returns:
- 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.AntennaPatternAnalytic(antenna_model, cutoff_freq=0.05)[source]
Bases:
AntennaPatternBase
utility class that handles access and buffering to analytic antenna pattern
Methods
get_antenna_response_vectorized
(freq, ...)get the antenna response for a specific frequency, zenith and azimuth angle
parametric_phase
Methods
get_antenna_response_vectorized
(freq, ...)get the antenna response for a specific frequency, zenith and azimuth angle
parametric_phase
- 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 NuRadio coordinate system. All units are in NuRadio default units
- Parameters:
- 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
- Returns:
- 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(*args, **kwargs)[source]
Bases:
object
Provider class for antenna pattern. The usage of antenna pattern through this class ensures that an antenna pattern is loaded only once into memory which takes a significant time and occupies a significant amount of memory.
Methods
load_antenna_pattern
(name, **kwargs)loads an antenna pattern and returns the antenna pattern class
- load_antenna_pattern(name, **kwargs)[source]
loads an antenna pattern and returns the antenna pattern class
- Parameters:
- 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)