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.

class lsl.misc.geodesy.EOP(mjd=0.0, x=0.0, y=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]
  • 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.
fromMAIA(line)

Given a line from a MAIA standard rapiod 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.

lsl.misc.geodesy.getEOPRange(start=None, stop=None, timeout=120)

Return a list of orientation parameter objects that span the start and stop (inclusive) MJDs provided. Values of ‘None’ indicate 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.

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