RF Antenna Parameters

A collection of utilities to help convert RF engineering/communications terms into radio astronomy terms. This module is geared toward taking antenna parameters in dBi or dBd and converting them into meaningful RA gains in K/Jy and then using those to get a system equivalent flux density.

New in version 1.0.3.

lsl.misc.rfutil.dBd2dBi(dBd)

Convert an antenna gain in dBb (gain relative to the maximum gain of a half-wave dipole) into a gain in dBi (gain relative to an isotropic antenna).

lsl.misc.rfutil.dBd2dBi(dBd)

Convert an antenna gain in dBb (gain relative to the maximum gain of a half-wave dipole) into a gain in dBi (gain relative to an isotropic antenna).

lsl.misc.rfutil.dBi2gain(dBi, frequency)

Convert an antenna gain in dBi (gain relative to an isotropic antenna) at a particular frequency in Hz into a gain in K/Jy.

lsl.misc.rfutil.dBd2gain(dBd, frequency)

Convert an antenna gain in dBd (gain relative to the maximum gain of a half-wave dipole) at a particular frequency in Hz into a gain in K/Jy

lsl.misc.rfutil.gain2dBi(gain, frequency)

Convert an antenna gain in K/Jy at a particular frequency in Hz into a gain in dBi (gain relative to an isotropic antenna).

lsl.misc.rfutil.gain2dBd(gain, frequency)

Convert an antenna gain in K/Jy at a particular frequency in Hz into a gain in dBd (gain relative to the maximum gain of a half-wave dipole).

lsl.misc.rfutil.calculateSEFD(Tsys, gain=None, area=None, efficiency=None)

Given a variety of parameters, calculate the system equivalent flux density in Jy for an antenna. The parameters are:

  • Tsys - system temperature in K - required
  • gain - antenna gain in K/Jy - optional
  • area - antenna collecting area in m^2 - optional
  • efficiency - aperture efficiency - optional

Of the optional parameters either ‘gain’ needs to be supplied or both ‘area’ and ‘efficiency’.

lsl.misc.rfutil.calculateEffectiveArea(gain)

Given the gain of an antenna in K/Jy, calculate the effective collecting area in square meters.

lsl.misc.rfutil.Jy2dBm(flux, bandwidth, gain)

Convert a flux density in Jy into a received signal strength in dBm under the assumptions of:

  • signal bandwidth in Hz
  • antenna gain in K/Jy
lsl.misc.rfutil.dBm2Jy(dBm, bandwidth, gain)

Convert a received signal strength in dBm into a flux density in Jy under the assumptions of:

  • signal bandwidth in Hz
  • antenna gain in K/Jy

Simulated Stand Response

This module contains a set of convenience functions to parse the output of NEC2, modify the input (.nec) file, and rerun NEC as necessary. NEC2 is the Numerical Electromagnetics Code, developed at LLNL. The version of NEC2 this code currently assumes is here.

Several NEC files are included with the LSL distribution for modeling the dipoles. See the README.NEC file included in the LSL data directory for more information about what is included.

lsl.sim.nec_util.CloseTo(x, y, epsilon=0.005)

Return True if two numbers are within a specified fractional, not absolute, tolerance of each other. Tolerance epsilon is a keyword parameter with a default of 0.005.

lsl.sim.nec_util.open_and_get_nec_freq(fname)

Open a NEC output file and return a tuple containing the open file object and the first frequency found in the file (MHz).

lsl.sim.nec_util.change_nec_freq(necname, freq)

Modify the FR card in a NEC input file to run at freq.

lsl.sim.nec_util.calcIME(necname, myfreqs=None, zpre=100)

Compute the impedance mismatch efficiency (IME), for a given NEC run and write out the results in a file. Assumes a default preamplifier input impedance of 100 ohms, unless overridden by the zpre keyword argument. Returns the frequencies calculated by NEC, unless myfreqs is set, in which case it interpolates onto that frequency grid.

class lsl.sim.nec_util.NECImpedance(necname)

NECImpedance: Python class to read an array of impedance values from a NEC2 .out file The .nec file should loop over a range of frequencies with an FR card like this:

FR 0 91 0 0 10.0 1.0

The RP card should be minimal to keep the runtime and output file size from growing huge. For example:

RP 0,91,1,1000,0.,0.,1.0,1.0
class lsl.sim.nec_util.NECPattern(necname, freq, rerun=True)

NECPattern: Python class to read the pattern from a NEC2 .out file. Note that the .nec file should have an RP card to run over the full pattern, like this:

RP 0,91,360,1000,0.,0.,1.0,1.0,0.

The FR card should be a simple single frequency run:

FR 0,1,0,0,74.0,1
lsl.sim.nec_util.whichNEC4()

Return the path to the nec4d executable if it can be found in the current path. None otherwise. This is useful for making sure that NEC is installed before trying to run something.

Geodesy

New in version 0.3.

Module for querying the earth orientation parameters for a given date/list of dates.

Changed in version 1.0.3: Added a fallback to the backup MAIA server ‘toshi.nofs.navy.mil’ if the primary server at ‘toshi.nofs.navy.mil’ cannot be reached

Changed in version 1.0.0: Added caching of MAIA results to speed up subsequent calls to getEOP(). Removed getEOPRange() since getEOP() can do the same thing.

class lsl.misc.geodesy.EOP(mjd=0.0, x=0.0, y=0.0, dx=0.0, dy=0.0, utDiff=0.0, type='final')

Object for storing the geodetic parameters relevant for DiFX input files:

  • mjd - modified Julian Date of the measurement/prediction
  • x - difference between the celestial ephemeric pole (CEP) and the international reference pole (IRP) in the direction of the IERS meridian [arc seconds]
  • y - difference between the CEP and IRP in the direction of 90 degrees west longitude [arc seconds]
  • dx - dX with respect to IAU2000A Nutation [arc seconds]
  • dy - dY with respect to IAU2000A Nutation [arc seconds]
  • UT1-UTC - difference between rotation angle about the pole and UTC [seconds]
  • type - whether the values for the given MJD are observed (final/IERS) or predicted.

Changed in version 1.0.0: Added extra attributes to store dX (dx) and dY (dy) in arc seconds.

fromMAIA(line)

Given a line from a MAIA standard rapid EOP data (IAU2000) file, fill in the object’s values with the needed information.

lsl.misc.geodesy.getEOP(mjd=None, timeout=120)

Return a list of earth orientation parameter objects for the specified MJDs. A MJD of ‘None’ returns the values for today’s date.

Changed in version 0.5.2: Added the `timeout’ keyword to deal with failures download EOP data. The default value is 120 seconds.

Changed in version 1.0.0: Added caching of EOP values to speed up subsequent calls.

Ionospheric and Geomagnetic Field Models

New in version 1.1.0.

A collection of utilities for retrieving parameters that may be relevant for ionospheric corrections.

lsl.misc.ionosphere.getMagneticField(lat, lng, elev, mjd=None, ecef=False)

Given a geodetic location described by a latitude in degrees (North positive), a longitude in degrees (West negative), an elevation in meters and an MJD value, compute the Earth’s magnetic field in that location and return a three-element tuple of the magnetic field’s components in nT. By default these are in topocentric coordinates of (North, East, Up). To return values in ECEF, set the ‘ecef’ keyword to True. If the MJD file is None, the current time is used.

Note

The convention used for the topocentric coordinates differs from what the IGRF uses in the sense that the zenith direction points up rather than down.

lsl.misc.ionosphere.computeMagneticDeclination(Bn, Be, Bz)

Given the topocentric output of getMagneticField(), compute and return the magnetic declination (deviation between magnetic north and true north) in degrees.

Note

The declination is poorly defined (NaN) around the magnetic poles where the horizontal field strength is less than 100 nT.

lsl.misc.ionosphere.computeMagneticInclination(Bn, Be, Bz)

Given the topocentric output of getMagneticField(), compute and return the magnetic inclination or magnetic dip (angle between the magnetic field and the horizontal) in degrees.

lsl.misc.ionosphere.getTECValue(mjd, lat=None, lng=None, includeRMS=False, timeout=120, type='IGS')

Given an MJD value and, optionally, a latitude and longitude in degrees, compute the TEC value in TECU above that location using data from the IGS or CODE (depending on the value of the ‘type’ keyword). If the ‘includeRMS’ keyword is set to True, also return the RMS in the TEC value.

lsl.misc.ionosphere.getIonosphericPiercePoint(site, az, el, height=450000.0, verbose=False)

Given a site and a pointing direction (azimuth and elevation in degrees), compute the location of the ionospheric pierce point. Since the height assumed for the ionosphere is model-dependent the ‘height’ keyword sets the elevation to use in meters. Returns a three-element tuple of latitude (degrees, North is positive), longitude (degrees, East is positive), and elevation (meters).

Autostereograms

New in version 0.5.3.

Module for taking a 2-D numpy array and turning it into an autostereogram (http://en.wikipedia.org/wiki/Autostereogram). This module also takes auto- stereograms and returns the depth maps.

New in version 0.5.3.

lsl.misc.autostereogram.getASG(data, patternWidth=100, patternPad=1, maxDepth=30)

Given a 2-D numpy array of data (image, elevation, etc.), convert the data into a random dot autostereogram. The options control the size of the pattern in the final image, the amount of padding around the image, and how the input data is converted to a depth map. The output is a three-element tuple of the depth map, input random dot image, and auto- stereogram.

Note

The output autostereogram is a 3-D numpy array with width, depth, and color channel.

lsl.misc.autostereogram.getDepthMap(final)

Given an autostereogram image (width x heigth x color channel), determine the depth map and return it. This function uses the padding area around the input image to determine the pattern width and then uses that width to look for relative shifts.

Table Of Contents

Previous topic

Fake Data

Next topic

General Utilities

This Page