losoto.operations package

Submodules

losoto.operations.abs module

losoto.operations.abs.run(soltab)

Take absolute value. Needed before smooth if amplitudes are negative! WEIGHT: no need to be weight compliant

Parameters

soltab (soltab obj) – Solution table.

losoto.operations.bandpasstec module

losoto.operations.bandpasstec.run(soltab, soltabOutTEC='tec000', soltabOutBP='phase000', refAnt='')

Isolate BP from TEC in a calibrator (uGMRT data)

Parameters
  • soltabOutTEC (str, optional) – output TEC table name (same solset), by deault “tec000”.

  • soltabOutBP (str, optional) – output bandpass table name (same solset), by deault “phase000”.

  • refAnt (str, optional) – Reference antenna, by default get the closest for each antenna.

losoto.operations.clip module

losoto.operations.clip.run(soltab, axesToClip=None, clipLevel=5.0, log=False, mode='median')

Clip solutions around the median by a factor specified by the user. WEIGHT: flag compliant, putting weights into median is tricky

Parameters
  • axesToClip (list of str) – axes along which to calculate the median (e.g. [time,freq]).

  • clipLevel (float, optional) – factor above/below median at which to clip, by default 5.

  • log (bool, optional) – clip is done in log10 space, by default False.

  • mode (str, optional) – if “median” then flag at rms*clipLevel times away from the median, if it is “above”, then flag all values above clipLevel, if it is “below” then flag all values below clipLevel. By default median.

losoto.operations.clocktec module

losoto.operations.clocktec.run(soltab, tecsoltabOut='tec000', clocksoltabOut='clock000', offsetsoltabOut='phase_offset000', tec3rdsoltabOut='tec3rd000', flagBadChannels=True, flagCut=5.0, chi2cut=3000.0, combinePol=False, removePhaseWraps=True, fit3rdorder=False, circular=False, reverse=False, invertOffset=False, nproc=10)

Separate phase solutions into Clock and TEC. The Clock and TEC values are stored in the specified output soltab with type ‘clock’, ‘tec’, ‘tec3rd’.

Parameters
  • flagBadChannels (bool, optional) – Detect and remove bad channel before fitting, by default True.

  • flagCut (float, optional) –

chi2cut : float, optional

combinePolbool, optional

Find a combined polarization solution, by default False.

removePhaseWrapsbool, optional

Detect and remove phase wraps, by default True.

fit3rdorderbool, optional

Fit a 3rd order ionospheric ocmponent (usefult <40 MHz). By default False.

circularbool, optional

Assume circular polarization with FR not removed. By default False.

reversebool, optional

Reverse the time axis. By default False.

invertOffsetbool, optional

Invert (reverse the sign of) the phase offsets. By default False. Set to True if you want to use them with the residuals operation.

losoto.operations.deleteaxis module

losoto.operations.deleteaxis.run(soltab, axisDelete, fromCell)

Delete an axis only keeping the values of a certain slice.

Parameters
  • axisDelete (str) – Axis to delete.

  • fromCell (str) – A cell value in axisDelete from which to keep the data values. If it is the string “first”/”last” then uses the first/last element of the axis.

losoto.operations.directionscreen module

losoto.operations.directionscreen.run(soltab, outSoltab='tecscreen', height=200000.0, order=12, beta=1.6666666666666667, ncpu=0)

Fits a screen to TEC + scalaraphase values.

The results of the fit are stored in the soltab parent solset in “outSoltab” and the residual phases (actual-screen) are stored in “outsoltabresid”. These values are the screen phase values per station per pierce point per solution interval. The pierce point locations are stored in an auxiliary array in the output soltabs.

Screens can be plotted with the PLOTSCREEN operation.

Parameters
  • soltab (solution table) – Soltab containing phase solutions

  • outSoltab (str, optional) – Name of output soltab

  • height (float, optional) – Height in m of screen

  • order (int, optional) – Order of screen (i.e., number of KL base vectors to keep).

  • beta (float, optional) – Power-law index for phase structure function (5/3 => pure Kolmogorov turbulence)

  • ncpu (int, optional) – Number of CPUs to use. If 0, all are used

  • niter (int, optional) – Number of iterations to do when determining weights

  • nsigma (float, optional) – Number of sigma above which directions are flagged

losoto.operations.duplicate module

losoto.operations.duplicate.run(soltab, soltabOut='', overwrite=False)

Duplicate a table

Parameters
  • soltabOut (str, optional) – Output table name. By default choose next available from table type.

  • overwrite (bool, optional) – Overwrite soltabOut if it already exists?

losoto.operations.example module

losoto.operations.example.run(soltab, opt1, opt2=[1.0, 2.0, 3.0], opt3=0)

Generic unspecified step for easy expansion.

Parameters
  • opt1 (float) – Is a mandatory parameter.

  • opt2 (int, optional) – Is optional, by default [1.,2.,3.]

  • opt2 – Is optional, by default 0.

losoto.operations.faraday module

losoto.operations.faraday.costfunctionRM(RM, wav, phase)
losoto.operations.faraday.run(soltab, soltabOut='rotationmeasure000', refAnt='', maxResidual=1.0, ncpu=0)

losoto.operations.flag module

losoto.operations.flag.run(soltab, axesToFlag, order, maxCycles=5, maxRms=5.0, maxRmsNoise=0.0, fixRms=0.0, fixRmsNoise=0.0, windowNoise=11, replace=False, preflagzeros=False, mode='smooth', refAnt='', ncpu=0)

This operation for LoSoTo implement a flagging procedure WEIGHT: compliant

Parameters
  • axesToFlag (array of str) – Axes along which to smooth+find outlier (e.g. [‘time’, ‘freq’]), max 2 values.

  • order (array of int) – Order of the function fitted during detrending. Array must have same size of axesToFlag. If mode=smooth these are the window of the running median (0=all axis).

  • maxCycles (int, optional) – Max number of independent flagging cycles, by default 5.

  • maxRms (float, optional) – Rms to clip outliers, by default 5.

  • maxRmsNoise (float, optional) – Do a running rms and then flag those regions that have a rms higher than MaxRmsNoise*rms_of_rmses, by default 0 (ignored).

  • fixRms (float, optional) – Instead of calculating rms use this value, by default 0 (ignored).

  • fixRmsNoise (float, optional) – Instead of calculating rms of the rmses use this value (it will not be multiplied by the MaxRmsNoise), by default 0 (ignored).

  • windowNoise (int, optional) – Window size for the running rms, by default 11.

  • replace (bool, optional) – Replace bad values with the interpolated ones, instead of flagging them. By default False.

  • preflagzeros (bool, optional) – Flag zeros/ones (bad solutions in BBS/DPPP). They should be flagged at import time. By default False.

  • mode (str, optional) – Detrending/fitting algorithm: smooth / poly / spline. By default smooth.

  • refAnt (str, optional) – Reference antenna, by default None.

  • ncpu (int, optional) – Number of cpu to use, by default all available.

losoto.operations.flagextend module

losoto.operations.flagextend.run(soltab, axesToExt, size, percent=50.0, maxCycles=3, ncpu=0)

This operation for LoSoTo implement a extend flag procedure It can work in multi dimensional space and for each datum check if the surrounding data are flagged to a certain %, then flag also that datum The size of the surrounding footprint can be tuned WEIGHT: compliant

Parameters
  • axesToExt (list of str) – Axes used to find close flags.

  • size (list of int) – Size of the window (diameter), per axis. If 0 is given then the entire length of the axis is assumed. Must be a vector of same length of Axes.

  • percent (float, optional) – Percent of flagged data around the point to flag it, by default 50.

  • maxCycles (int, optional) – Number of independent cycles of flag expansion, by default 3.

  • ncpu (int, optional) – Number of CPU used, by default all available.

losoto.operations.flagstation module

losoto.operations.flagstation.run(soltab, mode, maxFlaggedFraction=0.5, nSigma=5.0, maxStddev=None, ampRange=None, telescope='lofar', skipInternational=False, refAnt='', soltabExport='', ncpu=0)

This operation for LoSoTo implements a station-flagging procedure. Flags are time-independent. WEIGHT: compliant

Parameters
  • mode (str) – Fitting algorithm: bandpass or resid. Bandpass mode clips amplitudes relative to a model bandpass (only LOFAR is currently supported). Resid mode clips residual phases or log(amplitudes).

  • maxFlaggedFraction (float, optional) – This sets the maximum allowable fraction of flagged solutions above which the entire station is flagged.

  • nSigma (float, optional) – This sets the number of standard deviations considered when outlier clipping is done.

  • maxStddev (float, optional) – Maximum allowable standard deviation when outlier clipping is done. For phases, this should value should be in radians, for amplitudes in log(amp). If None (or negative), a value of 0.1 rad is used for phases and 0.01 for amplitudes.

  • ampRange (array, optional) – 2-element array of the median amplitude level to be acceptable, ampRange[0]: lower limit, ampRange[1]: upper limit. If None or [0, 0], a reasonable range for typical observations is used.

  • telescope (str, optional) – Specifies the telescope if mode = ‘bandpass’.

  • skipInternational (str, optional) – If True, skip flagging of international LOFAR stations (only used if telescope = ‘lofar’)

  • refAnt (str, optional) – If mode = resid, this sets the reference antenna for phase solutions, by default None.

  • soltabExport (str, optional) – Soltab to export station flags to. Note: exported flags are not time- or frequency-dependent.

  • ncpu (int, optional) – Number of cpu to use, by default all available.

losoto.operations.frjump module

losoto.operations.frjump.costfunctionRM(RM, wav, phase)
losoto.operations.frjump.getPhaseWrapBase(wavels)

freqs: frequency grid of the data return the step size from a local minima (2pi phase wrap) to the others [0]: TEC, [1]: clock

losoto.operations.frjump.getPhaseWrapBase_TEC(freqs)

freqs: frequency grid of the data return the step size from a local minima (2pi phase wrap) to the others [0]: TEC, [1]: clock

losoto.operations.frjump.dejump(vals, wavels, dotec=False)
losoto.operations.frjump.run(soltab, soltabOut, clipping, soltabPhase, frequencies)

EXPERIMENTAL ‘Dejumps’ the Faraday solutions. Because Faraday rotation is a rotation, there are generally multiple possible values for the rotation measure that yield a similar rotation angle - but are offset from the main trend. This code will fix this.

Parameters
  • soltabOut (str, optional) – output table name (same solset), by deault “rotationmeasure001”.

  • clipping (arr, optional) – Refers to the frequency range that is used in the Faraday step. This is important to get a good estimate for the difference in RM

  • soltabPhase (str, optional) – name of soltab that contains the phases. The only reason we need this, is for the frequency axis (so it really doesnt matter what’s in this soltab. Default: phase000

  • frequencies (arr, optional) – if the frequency axis is missing, you need to give the freq range used for TEC/FR fitting manually here.

losoto.operations.globaldelay module

losoto.operations.globaldelay.run(soltab, soltabOut='tec000', refAnt='')

Bruteforce TEC extraction from phase solutions.

Parameters
  • soltabOut (str, optional) – output table name (same solset), by deault “tec”.

  • refAnt (str, optional) – Reference antenna, by default ‘auto’.

losoto.operations.interpolate module

losoto.operations.interpolate.run(soltab, outsoltab, axisToRegrid, newdelta, delta='', maxFlaggedWidth=0, log=False)

This operation for LoSoTo implements regridding and linear interpolation of data for an axis. WEIGHT: compliant

Parameters
  • outsoltab (str) – Name of output soltab

  • axisToRegrid (str) – Name of the axis for which regridding/interpolation will be done

  • newdelta (float or str) – Fundamental width between samples after regridding. E.g., “100kHz” or “10s”

  • delta (float or str, optional) – Fundamental width between samples in axisToRegrid. E.g., “100kHz” or “10s”. If “”, it is calculated from the axisToRegrid values

  • maxFlaggedWidth (int, optional) – Maximum allowable width in number of samples (after regridding) above which interpolated values are flagged (e.g., maxFlaggedWidth = 5 would allow gaps of 5 samples or less to be interpolated across but gaps of 6 or more would be flagged)

  • log (bool, optional) – Interpolation is done in log10 space, by default False

losoto.operations.interpolatedirections module

losoto.operations.interpolatedirections.interpolate_directions3d(cal_vals, cal_weights, cal_dirs, dir_axis, interp_dirs, interp_kind, smooth=0.0)

Function to parallelize interpolation. Interpolates and evaluates the interpolation at the new directions for one ant/pol/time etc. This function interpolates values on a unit sphere in 3d. This is faster because we can use scipy.staptial.distance.cdist euclidean for this.

Parameters
  • cal_vals (array, values of selection, 1st axis: dir, other axes flattened) –

  • weights (array, weights of values,) –

  • cal_dirs ((2,n) array of floats, ra/dec values of calibrator directions) –

  • dir_axis (int, position of dir axis in input values/weights) –

  • interp_dirs ((2,n) array of floats, ra/dec values of interpolate directions) –

  • interp_kind (string, 'wrap' or 'lin' dependent on whether to interpolate phases) – (independently in real and imag) or TEC, amp..

  • smooth (float, smooth-parameter for interpolation. For phases, a value between 1e-3 and 0.0) – seems to work well. For TEC, less smoothing should be necessary.

Returns

  • new_vals (array of floats, interpolated values of selection at new directions)

  • new_weights (array of floats, weights)

losoto.operations.interpolatedirections.run(soltab, interp_dirs, soltabOut=None, prefix='interp_', ncpu=0)

Add interpolated directions to h5parm :param interp_dirs: Shape n x 2, contains ra/dec in degree.

For example: [[ra1,dec1],[ra2,dec2],…]

Parameters
  • soltabOut (string, optional) – Default: Guess from soltype. If specifically set to input soltab, the input soltab will be overwritten.

  • prefix (string, optional, default = “interp_”.) – Name prefix of interpolated directions.

losoto.operations.lofarbeam module

losoto.operations.lofarbeam.run(soltab, ms, inverse=False, useElementResponse=True, useArrayFactor=True, useChanFreq=True)

Generic unspecified step for easy expansion.

Parameters

opt1 (float) – Is a mandatory parameter.

losoto.operations.norm module

losoto.operations.norm.run(soltab, axesToNorm, normVal=1.0, log=False)

Normalize the solutions to a given value WEIGHT: Weights compliant

Parameters
  • axesToNorm (array of str) – Axes along which compute the normalization.

  • normVal (float, optional) – Number to normalize to vals = vals * (normVal/valsMean), by default 1.

  • log (bool, optional) – clip is done in log10 space, by default False.

losoto.operations.plot module

losoto.operations.plot.run(soltab, axesInPlot, axisInTable='', axisInCol='', axisDiff='', NColFig=0, figSize=[0, 0], markerSize=2, minmax=[0, 0], log='', plotFlag=False, doUnwrap=False, refAnt='', refDir='', soltabsToAdd='', makeAntPlot=False, makeMovie=False, prefix='', ncpu=0)

This operation for LoSoTo implements basic plotting WEIGHT: flag-only compliant, no need for weight

Parameters
  • axesInPlot (array of str) – 1- or 2-element array which says the coordinates to plot (2 for 3D plots).

  • axisInTable (str, optional) – the axis to plot on a page - e.g. ant to get all antenna’s on one file. By default ‘’.

  • axisInCol (str, optional) – The axis to plot in different colours - e.g. pol to get correlations with different colors. By default ‘’.

  • axisDiff (str, optional) – This must be a len=2 axis and the plot will have the differential value - e.g. ‘pol’ to plot XX-YY. By default ‘’.

  • NColFig (int, optional) – Number of columns in a multi-table image. By default is automatically chosen.

  • figSize (array of int, optional) – Size of the image [x,y], if one of the values is 0, then it is automatically chosen. By default automatic set.

  • markerSize (int, optional) – Size of the markers in the 2D plot. By default 2.

  • minmax (array of float, optional) – Min max value for the independent variable (0 means automatic). By default 0.

  • log (bool, optional) – Use Log=’XYZ’ to set which axes to put in Log. By default ‘’.

  • plotFlag (bool, optional) – Whether to plot also flags as red points in 2D plots. By default False.

  • doUnwrap (bool, optional) – Unwrap phases. By default False.

  • refAnt (str, optional) – Reference antenna for phases. By default None.

  • refDir (str, optional) – Reference direction for phases. By default None.

  • soltabsToAdd (str, optional) – Tables to “add” (e.g. ‘sol000/tec000’), it works only for tec and clock to be added to phases. By default None. [To Be Implemented]

  • makeAntPlot (bool, optional) – Make a plot containing antenna coordinates in x,y and in color the value to plot, axesInPlot must be [ant]. By default False.

  • makeMovie (bool, optional) – Make a movie summing up all the produced plots, by default False.

  • prefix (str, optional) – Prefix to add before the self-generated filename, by default None.

  • ncpu (int, optional) – Number of cpus, by default all available.

losoto.operations.plotscreen module

losoto.operations.plotscreen.run(soltab, resSoltab='', minZ=- 3.2, maxZ=3.2, prefix='', remove_gradient=False, show_source_names=False, ncpu=0)

Plot screens (one plot is made per time and per station)

Parameters
  • soltab (solution table) – Soltab containing screen.

  • resSoltab (solution table, optional) – Soltab containing the screen residuals.

  • minZ (float, optional) – Minimum value of colorbar scale.

  • maxZ (float, optional) – Max value of colorbar scale.

  • prefix (str, optional) – String to prepend to output plots.

  • remove_gradient (bool, optional) – If True, remove gradient before plotting.

  • show_source_names (bool, optional) – If True, source names are overplotted.

  • ncpu (int, optional) – Number of CPUs to use. If 0, all are used.

losoto.operations.polalign module

losoto.operations.polalign.run(soltab, soltabOut='phasediff', minFreq=0, refAnt='')

Estimate polarization misalignment as delay.

Parameters
  • soltabOut (str, optional) – output table name (same solset), by deault “phasediff”.

  • minFreq (float, optional) – minimum frequency [Hz] to use in estimating the PA. By default, 0 (all freqs).

  • refAnt (str, optional) – Reference antenna, by default ‘auto’.

losoto.operations.prefactor_XYoffset module

losoto.operations.prefactor_XYoffset.normalize(phase)

Normalize phase to the range [-pi, pi].

losoto.operations.prefactor_XYoffset.run(soltab, chanWidth)

losoto.operations.prefactor_bandpass module

losoto.operations.prefactor_bandpass.run(soltab, chanWidth='', outSoltabName='bandpass', BadSBList='', interpolate=True, removeTimeAxis=True, autoFlag=False, nSigma=5.0, maxFlaggedFraction=0.5, maxStddev=0.01, ncpu=0)

This operation for LoSoTo implements the Prefactor bandpass operation WEIGHT: flag-only compliant, no need for weight

Parameters
  • chanWidth (str or float, optional) – the width of each channel in the data from which solutions were obtained. Can be either a string like “48kHz” or a float in Hz. If interpolate = True, chanWidth must be specified

  • BadSBList (str, optional) – a list of bad subbands that will be flagged

  • outSoltabName (str, optional) – Name of the output bandpass soltab. An existing soltab with this name will be overwritten

  • interpolate (bool, optional) – If True, interpolate to a regular frequency grid and then smooth, ignoring bad subbands. If False, neither interpolation nor smoothing is done and the output frequency grid is the same as the input one. If interpolate = True, chanWidth must be specified

  • removeTimeAxis (bool, optional) – If True, the time axis of the output bandpass soltab is removed by doing a median over time. If False, the output time grid is the same as the input one

  • autoFlag (bool, optional) – If True, automatically flag bad frequencies and stations

  • nSigma (float, optional) – Number of sigma for autoFlagging. Amplitudes outside of nSigma*stddev are flagged

  • maxFlaggedFraction (float, optional) – Maximum allowable fraction of flagged frequencies for autoFlagging. Stations with higher fractions will be completely flagged

  • maxStddev (float, optional) – Maximum allowable standard deviation for autoFlagging

  • ncpu (int, optional) – Number of CPUs to use during autoFlagging (0 = all)

losoto.operations.reference module

losoto.operations.reference.run(soltab, refAnt='', refDir='')

Reference to an antenna

Parameters
  • refAnt (str, optional) – Reference antenna for phases. Empty string does not change phases. Default: ‘’.

  • refDir (str, optional) – Reference direction for phases. Empty string does not change phases. Default: ‘’.

losoto.operations.replicateonaxis module

losoto.operations.replicateonaxis.run(soltab, axisReplicate, fromCell, updateWeights=True)

Replace the values along a certain axis taking them from one specific axic cell

Parameters
  • axisReplicate (str) – Axis along which replicate the values.

  • fromCell (str) – A cell value in axisReplicate from which to copy the data values. If it is the string “first”/”last” then uses the first/last element of the axis.

  • updateWeights (bool) – If False then weights are untoched, if True they are replicated like data. Default: True.

losoto.operations.reset module

losoto.operations.reset.run(soltab, dataVal=- 999.0)

This operation reset all the selected solution values. WEIGHT: flag compliant, no need for weight

Parameters

dataVal (float, optional) – If given set values to this number, otherwise uses 1 for amplitude and 0 for all other soltab types.

losoto.operations.residuals module

losoto.operations.residuals.run(soltab, soltabsToSub, ratio=False)

Subtract/divide two tables or a clock/tec/tec3rd/rm from a phase.

Parameters
  • soltabsToSub (list of str) – List of soltabs to subtract

  • ratio (bool, optional) – Return the ratio instead of subtracting, by default False.

losoto.operations.reweight module

losoto.operations.reweight.run(soltab, mode='uniform', weightVal=1.0, nmedian=3, nstddev=251, soltabImport='', flagBad=False, ncpu=0)

Change the the weight values.

Parameters
  • mode (str, optional) – One of ‘uniform’ (single value), ‘window’ (sliding window in time), or ‘copy’ (copy from another table), by default ‘uniform’.

  • weightVal (float, optional) – Set weights to this values (0=flagged), by default 1.

  • nmedian (odd int, optional) – Median window size in number of timeslots for ‘window’ mode. If nonzero, a median-smoothed version of the input values is subtracted to detrend them. If 0, no smoothing or subtraction is done, by default 3.

  • nstddev (odd int, optional) – Standard deviation window size in number of timeslots for ‘window’ mode, by default 251.

  • soltabImport (str, optional) – Name of a soltab. Copy weights from this soltab (must have same axes shape), by default none.

  • flagBad (bool, optional) – Re-apply flags to bad values (1 for amp, 0 for other tables), by default False.

losoto.operations.screenvalues module

losoto.operations.screenvalues.run(soltab1, source_dict, outsoltab, soltab2=None, ncpu=0)

Calculate phases from screens

Parameters
  • soltab1 (solution table) – Soltab containing the screen at frequency 1

  • source_dict (dict) – Dictionary of source positions for which phases are desired

  • outsoltab (str) – Name of output solution table. If TEC+scalarphase solutions are desired, two solution tables are made: ‘tecoutsoltab’ and ‘scalarphaseoutsoltab’

  • soltab2 (solution table, optional) – Soltab containing the screens at frequency 2 (needed for TEC+scalar phase)

  • ncpu (int, optional) – Number of CPUs to use. If 0, all are used

losoto.operations.smooth module

losoto.operations.smooth.run(soltab, axesToSmooth, size=[], mode='runningmedian', degree=1, replace=False, log=False, refAnt='')

A smoothing function: running-median on an arbitrary number of axes, running polyfit and Savitzky-Golay on one axis, or set all solutions to the mean/median value. WEIGHT: flag ready.

Parameters
  • axesToSmooth (array of str) – Axes used to compute the smoothing function.

  • size (array of int, optional) – Window size for the runningmedian, savitzky-golay, and runningpoly (array of same size of axesToSmooth), by default [].

  • mode ({'runningmedian','runningpoly','savitzky-golay','mean','median'}, optional) – Runningmedian or runningpoly or Savitzky-Golay or mean or median (these last two values set all the solutions to the mean/median), by default “runningmedian”.

  • degree (int, optional) – Degrees of the polynomia for the runningpoly or savitzky-golay modes, by default 1.

  • replace (bool, optional) – Flagged data are replaced with smoothed value and unflagged, by default False.

  • log (bool, optional) – clip is done in log10 space, by default False

  • refAnt (str, optional) – Reference antenna for phases. By default None.

losoto.operations.splitleak module

losoto.operations.splitleak.run(soltab, soltabOutG=None, soltabOutD=None)

EXPERIMENTAL Derive leackage

Parameters
  • soltabOutG (str, optional) – Output table name (diagonal component). By default choose next available from table type.

  • soltabOutD (str, optional) – Output table name (leakage component). By default choose next available from table type.

losoto.operations.stationscreen module

losoto.operations.stationscreen.run(soltab, outsoltab, order=12, beta=1.6666666666666667, niter=2, nsigma=5.0, refAnt=- 1, scale_order=True, scale_dist=None, min_order=5, adjust_order=True, ncpu=0)

Fits station screens to input soltab (type ‘phase’ or ‘amplitude’ only).

The results of the fit are stored in the soltab parent solset in “outsoltab” and the residual values (actual - screen) are stored in “outsoltabresid”. These values are the screen amplitude values per station per pierce point per solution interval. The pierce point locations are stored in an auxiliary array in the output soltabs.

Screens can be plotted with the PLOTSCREEN operation.

Parameters
  • soltab (solution table) – Soltab containing amplitude solutions

  • outsoltab (str) – Name of output soltab

  • order (int, optional) – Order of screen (i.e., number of KL base vectors to keep). If the order is scaled by dist (scale_order = True), the order is calculated as order * sqrt(dist/scale_dist)

  • beta (float, optional) – Power-law index for amp structure function (5/3 => pure Kolmogorov turbulence)

  • niter (int, optional) – Number of iterations to do when determining weights

  • nsigma (float, optional) – Number of sigma above which directions are flagged

  • refAnt (str or int, optional) – Index (if int) or name (if str) of reference station (-1 => no ref)

  • scale_order (bool, optional) – If True, scale the screen order with sqrt of distance/scale_dist to the reference station

  • scale_dist (float, optional) – Distance used to normalize the distances used to scale the screen order. If None, the max distance is used

  • adjust_order (bool, optional) – If True, adjust the screen order to obtain a reduced chi^2 of approx. unity

  • min_order (int, optional) – The minimum allowed order if adjust_order = True.

  • ncpu (int, optional) – Number of CPUs to use. If 0, all are used

losoto.operations.structure module

losoto.operations.structure.run(soltab, doUnwrap=False, refAnt='', plotName='', ndiv=1)

Find the structure function from phase solutions of core stations.

Parameters
  • doUnwrap (bool, optional) –

  • refAnt (str, optional) – Reference antenna, by default None.

  • plotName (str, optional) – Plot file name, by default no plot.

  • ndiv (int, optional) –

losoto.operations.tec module

losoto.operations.tec.mod(d)

wrap phases to (-pi,pi)

losoto.operations.tec.tec_merit_brute(dTEC, freq, phases, weight=True)

Merit function for brute-force grid search. :param dTEC: :type dTEC: float, dTEC in TECU :param freq: :type freq: np array of floats, phases in Hz :param phases: :type phases: phases to fit in rad :param weight: :type weight: bool, default True. Whether to weight residuals by noise or not

Returns

rms_phase_residual

Return type

float, rms of phase residuals

losoto.operations.tec.tec_merit(dTEC, freq, phases, weight=True)

Merit function for least-square fit. :param dTEC: :type dTEC: float, dTEC in TECU :param freq: :type freq: np array of floats, phases in Hz :param phases: :type phases: phases to fit in rad :param weight: :type weight: bool, default True. Whether to weight residuals by noise or not

Returns

rms_phase_residuals

Return type

array of floats, rms of phase residuals

losoto.operations.tec.fit_tec_to_phases(vals, weights, coord, refAnt, maxResidualFlag, maxResidualProp)

Fit dTEC to phases and frequencies for a range of times. :param vals: :type vals: numpy array of floats, phases to fit in rad. Shape (n_times, n_freq) :param weights: :type weights: numpy array of floats, phases to fit in rad. Shape (n_times, n_freq) :param coord: :type coord: dict of coords of current selection. Contains time, freq, ant, (optional: dir) :param refAnt: :type refAnt: string, reference antenna :param maxResidualFlag: :type maxResidualFlag: float, default = 2.5 Maximum residual that is not flagged. 0=don’t flag. :param maxResidualProp: :type maxResidualProp: float, default = 1. Maximum residual that is propagated. 0=propagate all.

Returns

[fitdTEC, fitweights]

Return type

list of numpy array of floats, dTEC restults in TECU / weights

losoto.operations.tec.run(soltab, soltabOut, refAnt, maxResidualFlag, maxResidualProp, ncpu)

Bruteforce TEC extraction from phase solutions.

Parameters
  • soltabOut (str, optional) – output table name (same solset), by deault “tec”.

  • refAnt (str, optional) – Reference antenna, by default ‘auto’.

  • maxResidualFlag (float, optional) – Max average residual in radians before flagging datapoint, by default 2.5 If 0: no check.

  • maxResidualProp (float, optional) – Max average residual in radians before stop propagating solutions, by default 1. If 0: no check.

losoto.operations.tecjump module

losoto.operations.tecjump.run(soltab, refAnt='', soltabError='', ncpu=0)

EXPERIMENTAL Remove jumps from TEC solutions. WEIGHT: uses the errors.

Parameters
  • soltabError (str, optional) – The table name with solution errors. By default it has the same name of soltab with “error” in place of “tec”.

  • refAnt (str, optional) – Reference antenna for phases. By default None.

losoto.operations.tecsinglefreq module

losoto.operations.tecsinglefreq.run(soltab, soltabOut='tec000', refAnt='')

EXPERIMENTAL Estimate TEC from ph solutions assuming no wrap for solution at t=0

Parameters
  • soltabOut (str, optional) – output table name (same solset), by deault “tec”.

  • refAnt (str, optional) – Reference antenna, by default ‘auto’.

Module contents