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.

lsl.sim.nec_util.CloseTo(x, y, epsilon=0.0050000000000000001)
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)
Return a list of earth orientation parameter objects for the specified MJDs. A MJD of ‘None’ returns the values for today’s date.
lsl.misc.geodesy.getEOPRange(start=None, stop=None)
Return a list of orientation parameter objects that span the start and stop (inclusive) MJDs provided. Values of ‘None’ indicate today’s date.

S60 Data

New in version 0.3.

Reader

Python module for reading data in from S60 files. Unlike TBW or TBN data, the S60 data consists of only packed binary values. Thus, the functions for reading in the S60 data do not return objects describing each frame but rather return numpy arrays of the data. The two reading functions defined are:

readFrame
return a complex array containing the data from one UDP packet (734 samples)
readChunk
return a complex array containing a specified number of samples, i.e., the ‘chunk’ size.

In addition to the two readers, there is also a function, getBandpassModel, which reads in Joe Craig’s model of the S60 bandpass. See the S60 data page for information about the model.

lsl.reader.s60.readFrame(filehandle)
Function to read in a single S60 frame and return the data as a numpy single-precision complex array with 734 elements.
lsl.reader.s60.readChunk(filehandle, Chunk=4096)
Function to read a certain number of chunks (samples) from the input file- handle and return them as a single-precision complex numpy array. The output is in samples so twice as many bytes need to be read in as samples.
lsl.reader.s60.getBandpassModel()
Read in Joe’s model for the S60 badpass that is posted on the wiki.

Writer

Python module for creating creating and writing simulated S60 frames to a file.

lsl.sim.s60.frame2frame(s60Data)
Convert a complex numpy array with the same length as a S60 frame to a raw S60 frame.
lsl.sim.s60.chunk2frame(s60Data)
Convert a complex numpy array to a raw S60 frame.

Table Of Contents

Previous topic

Fake Data

Next topic

General Utilities

This Page