Previous topic

pycrtools.tasks.beamformer2

Next topic

pycrtools.tasks.commands

This Page

pycrtools.tasks.calibratefm

CalibrateFM([ws, parfile]) Description:
Task([ws, parfile]) Base class from which all tasks should be derived.
getMultiFreqDelay(lines, freqs, ...) Get multi-frequency delay.
getOneSampleShifts(timeDiff, ...) Scan the array of time differences.
vectorAverage(directions) Takes a list of (az, el) tuples

Task:

Calibrate delays between antennas, and especially inter-station delays, using narrow-band radio transmitters. Especially transmitters with a known location are useful, e.g. the FM tower in Smilde (GPS long = 6.403565 E, lat = 52.902671 N).

Uses the phases (average and rms) obtained in the FindRFI Task; or will re-run that task if no phases are given as input.

Module author: Arthur Corstanje <a.corstanje@astro.ru.nl>

class pycrtools.tasks.calibratefm.CalibrateFM(ws=None, parfile=None, **kwargs)

Description:

Calibrate antenna delays, especially inter-station delays, by using FM transmitter RFI in the data.

Usage:

See also:

plotfootprint

Example:

filefilter="/Volumes/Data/sandertv/VHECR/LORAtriggered/results/VHECR_LORA-20110716T094509.665Z/"
crfootprint=cr.trun("plotfootprint",filefilter=filefilter,pol=polarization)

Input parameters

blocksize [default value: 8000 ]
Blocksize of timeseries data, for FFTs. Only used when no phase_average are given. Take e.g. 8000 to match radio station frequencies.
correctOneSampleShifts [default value: False ]
Automatically correct for +/- 5 ns shifts in the data. Only works correctly if the direction fit / the reference transmitter GPS is good. Output is in oneSampleShifts list.
directionFromAllStations [default value: False ]
Set True if you want to use all stations together to calculate the incoming direction. Otherwise, it is done per station and the results are averaged.
direction_resolution [default value: [1, 15] ]
Resolution in degrees [az, el] for direction search
doplot [default value: True ]
Produce output plots
f [default value: None ]
File object.
filefilter [default value: None ]
File filter for multiple data files in one event, e.g. ‘/my/data/dir/L45472_D20120206T030115.786Z*.h5’
filelist [default value: None ]
List of filenames in one event.
filetype [default value: “pdf” ]
extension/type of plot output files
flagged_antennas [default value: None ]
Antenna indices flagged as BAD (e.g. power outliers, zero power etc.)
freq_range [default value: [30, 70] ]
Frequency range in which to search for calibration sources
lines [default value: None ]
(List of) RF line(s) to use, by frequency channel index
maxPhaseError [default value: 1.0 ]
Maximum allowed phase error in ns^2 (added from all antennas) to call it a good fit and set calibrationStatus to ‘OK’.
median_phase_spreads [default value: None ]
Output from FindRFI: Median (over all antennas) standard-deviation, per frequency channel. 1-D array with length blocksize/2 + 1.
nofblocks [default value: 100 ]
Max. number of blocks to process
phase_RMS [default value: None ]
Phase RMS from FindRFI Task.
phase_average [default value: None ]
Average phase spectrum per antenna, as output from FindRFI Task. Optional, if not given ‘filefilter’ or ‘filelist’ will be used to (re)run FindRFI.
plot_prefix [default value: “” ]
Prefix for plots
plot_title [default value: True ]
Plot with or without title (for publication)
plot_type [default value: “png” ]
Plot type (e.g. png, jpeg, pdf)
plotlist [default value: [] ]
List of plots
pol [default value: 0 ]
0 or 1 for even or odd polarization. Only used when re-running FindRFI.
refant [default value: 0 ]
Reference antenna from FindRFI.
referenceTransmitterGPS [default value: None ]
GPS [long, lat] in degrees (N, E is positive) for a known transmitter. Typically used when tuning to a known frequency. The Smilde tower is at (6.403565, 52.902671).
save_images [default value: False ]
Enable if images should be saved to disk in default folder
save_plots [default value: False ]
Store plots
testplots [default value: False ]
Produce testing plots for calibration on RF lines
verbose [default value: True ]
Print output or not.

Output parameters

bestFrequency [default value: None ]
The frequency with the smallest phase_RMS, from the range specified in the freq_range parameter
bestPhaseRMS [default value: None ]
PhaseRMS for the best frequency
caldelays [default value: None ]
Output calibration delays as found from RF transmitter phases. Fixed 5 ns offsets if correctOneSampleShifts was set.
calibrationStatus [default value: None ]
Output status string.
dirtychannels [default value: None ]
Output array of dirty channels, based on stability of relative phases from consecutive data blocks. Deviations from uniform-randomness are quite small, unless there is an RF transmitter present at a given frequency.
fittedDirections [default value: None ]
Output dict with for each station [az, el] = the direction of the strongest transmitter. Output in degrees
interStationDelays [default value: None ]
Output dict containing station name - delay value pairs.
nofantennas
Number of antennas.
nofchannels [default value: -1 ]
nof channels
oneSampleShifts [default value: None ]
Output array containing the 5 ns-shifts per antenna, if they occur. Output contains integer number of samples the data is shifted. To correct for it, shift data _forward_ by this number of samples.
phaseError [default value: None ]
Phase error for the first station in the list. Used to check if the fit is good, e.g. when using fixed reference transmitter
timestamp [default value: None ]
Unix timestamp of input file(s)
pycrtools.tasks.calibratefm.getMultiFreqDelay(lines, freqs, phase_average, median_phase_spreads, modelTimes)

Get multi-frequency delay.

Properties

Parameter Description
lines
freqs
phase_average
median_phase_spreads
modelTimes
pycrtools.tasks.calibratefm.getOneSampleShifts(timeDiff, stationStartIndex, interStationDelays)

Scan the array of time differences.

Properties

Parameter Description
timeDiff
stationStartIndex
interStationDelays

Description:

Scan the array of time differences (between measured phases and the modeled incoming wave) for presence of offsets that are a multiple of 5 ns. Note: due to the modulo-2pi from the phases, only small multiples (effectively +/- 1) can be reliably corrected.

Input stationStartIndex contains the starting points in the array for each station. interStationDelays are subtracted here.

Returns array oneSampleShifts, containing integer # samples by which the data is shifted. So when it returns [0, 0, 1, 0, -1, ...] a positive number means that the data has to be advanced 1 sample i.e. sample 0 <– sample 1 Negative number the other way round.

(NB. check!)

pycrtools.tasks.calibratefm.vectorAverage(directions)

Takes a list of (az, el) tuples Converts to cartesian vectors, sums them up to average Converts average back to (az, el) returns average (az, el)