_images/leogps_logo.png

Function Reference

The order of functions in this API reference goes according to the chronological order of which they are called in the native LEOGPS processing work flow (see previous page). Functions that are currently not in use in the current native work flow are listed at the end of this page.


leogui.py

The first item to be called when running leogps.py is the root GUI object (tkinter.Tk() object). This object interfaces directly with config.txt to save or load your input parameters.

class leogui.RunGUI(master)

This class represents the entire LEOGPS GUI, as a TKinter object. The constructor takes in a single tkinter.Tk() object as the root GUI. All buttons in the GUI are linked to the methods described below.

cfg_R(self)

This method does two things. First, this method checks that all inputs in config.txt are correct. Second, it copies the input parameters into the GUI (as TKinter variables).

cfg_W(self)

This method does two things. First, this method checks that all inputs in the GUI are correct. Second, it copies the GUI parameters into the config.txt file, overwriting it.

clr(self)

Clears all existing relative orbit plots in the LEOGPS GUI.

run(self)

Run the LEOGPS program using the leorun.py script and plots the relative trajectory.


leorun.py

The leorun.run() function is called once the user clicks on Run LEOGPS. This file is useful for the user as a guide for creating a custom top-level LEOGPS script that utilizes all of the other functions (i.e. if the user wishes to perform baseline estimation between N number of agents instead of only 2, or for customised processing of GPS observables).

leorun.run()

Basically runs the primary workflow for LEOGPS’ relative positioning. No input arguments needed, and returns None.


inpxtr.py

The first thing that is run in the native work flow is to extract all the inputs from config.txt. This is done through the inpxtr module which comprises two functions. First, inpxtr.inptim(), extracts the dates and times from the config.txt file and outputs them in GPS time format. Second, inpxtr.inpxtr() extracts all the other processing parameters. The outputs of this file will be used in most of the LEOGPS functions. If you would like to customise your own LEOGPS scripts, or add new configuration parameters in the config.txt file, there is no need to change this inpxtr.inpxtr() function, it should automatically pick up all parameters in config.txt.

inpxtr.inptim(t)

Extract time parameters from config.txt, and translates them into five timing-related parameters to be used for processing later on. Called internally only in inpxtr.inpxtr().

Parameters

t (datetime.datetime) – An epoch datetime object.

Returns

  • yyyy (int) – 4-digit Gregorian year

  • yy (str) – 2-digit Gregorian year (for RINEX file name)

  • doy (str) – 3-digit day-of-year (for RINEX file name)

  • wkday (int) – 1-digit day-of-week (Sunday = 0, Saturday = 6)

  • wwww (int) – GPS week number (generally 4-digits)

inpxtr.inpxtr()

Extract all parameters from config.txt. No input arguments.

Returns

inputdict – A dictionary of key-value pairs comprising of key-values found in the config.txt file. For example, the time step of the scenario would be the key-value pair { ‘timestep’ : 30 }

Return type

dict


rnpath.py

The second step after extracting the inputs using inpxtr.inpxtr() is to search for the RINEX file paths based on the 4-letter IDs of both spacecraft, and to perform Hatanaka decompression if necessary. This script performs all of that.

rnpath.rnpath(inps)

Gets the paths to RINEX files, following AIUB CODE’s naming convention.

Parameters

inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Returns

  • rnx1file (pathlib.Path) – Path of RINEX file of LEO-A

  • rnx2file (pathlib.Path) – Path of RINEX file of LEO-B


timing.py

The third step involves deconflicting all the timing parameters. The routine timing.py will take in three sets of timings: the user-specified start-stop times in the GUI or in config.txt, and the start-stop times from both of the RINEX observation files. This module will then output the intersection of all three timelines. This module will also check if the time steps of the RINEX files and time step specified by the user are compatible.

timing.get_startstop(rnxlines)

Gets the first and last epoch after reading one RINEX file.

Parameters

rnxlines (list) – List of strings as lines of the RINEX file

Returns

  • rnxstart (datetime.datetime) – Observed initial time stamp in RINEX file

  • rnxstop (datetime.datetime) – Observed final time stamp in RINEX file

  • rnxstep (datetime.timedelta) – Observed time step in RINEX file

timing.tcheck(rnx1file, rnx2file, inps)

Reads both RINEX files and output the desired start and stop times. Sets the start, stop, and time steps for the entire LEOGPS scenario.

Parameters
  • rnx1file (pathlib.Path) – Path of RINEX file of LEO-A

  • rnx2file (pathlib.Path) – Path of RINEX file of LEO-B

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Returns

  • tstart (datetime.datetime) – Scenario start time for processing

  • tstop (datetime.datetime) – Scenario stop time for processing

  • tstep (datetime.timedelta) – Scenario time step used in processing

  • rnx1step (datetime.timedelta) – Observed time step in the RINEX file


gpsxtr.py

The fourth step is to extract out the interpolated GPS satellite ephemeris and clock data.

The primary output of gpsxtr.gpsxtr() is the gpsdata dictionary, which is a three-layer nested dictionary comprising all of the Lagrange-interpolated ephemeris and clock data. The first layer keys are the epochs (datetime.datetime). The second layer keys are the PRN IDs of GPS satellites. The third layer keys are the XYZ coordinates of the position vectors, XYZ coordinates of the velocity vectors, the clock bias, and clock drift. Third layer values are all floats.

All GPS coordinates are in ITRF by default. No coordinate reference frame transformations were performed between the raw and the interpolated GPS ephemeris.

gpsxtr.gpsxtr(inps, tstart, tstop, tstep)

Downloads the precise ephemeris, clock files, and Earth rotation parameters from AIUB CODE FTP. Extracts and interpolates according to the time step the ephemeris data of the (good) GPS satellites, including clock bias and clock drift values.

Parameters
  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

  • tstart (datetime.datetime) – Scenario start time for processing

  • tstop (datetime.datetime) – Scenario stop time for processing

  • tstep (datetime.timedelta) – Scenario time step used in processing

Returns

  • gpsdata (dict) – Nested dictionary of GPS ephemeris and clock data

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

An example structure of this dictionary is given below:

gpsdata = {epoch1 : {1 : {px:0,   py:0,   pz:0,
                          vx:0,   vy:0,   vz:0,
                          clkb:0, clkd:0      },

                     2 : {px:0,   py:0,   pz:0,
                          vx:0,   vy:0,   vz:0,
                          clkb:0, clkd:0      }, ...

                         ... ... ... ... ... ... ...

                    32 : {px:0,   py:0,   pz:0,
                          vx:0,   vy:0,   vz:0,
                          clkb:0, clkd:0      }},

           epoch2 : {1 : {px:0,   py:0,   pz:0,
                         ... ... ... ... ... ...} ...} ...}

The secondary output of gpsxtr.gpsxtr() is the goodsats list, which is a sorted list of GPS satellite PRN IDs whose observables had no outages.

An auxiliary function gpsxtr.gpsweekday() exists but is not documented here. It converts a datetime object into two string variables: the GPS day-of-week and the GPS week number. This is a similar function to inpxtr.inptim().


rinxtr.py

The fifth step involves the extraction of RINEX observations C1/P1, P2, L1, L2, D1, D2, with carrier phase marking, and cycle slip detection performed using the phasep.py module.

An additional ‘flag’ key will be added to the RINEX observables to mark them. These are the possible values belonging to the ‘flag’ keys.

  • “start” : start of carrier phase observed, from an N-th GPS satellite, in a sequence.

  • “end” : last carrier phase observed, from some N-th GPS satellite, in a sequence.

  • “solo” : single carrier phase observation by some N-th GPS satellite, no sequence.

  • “none” : carrier phase observation within a sequence, from some N-th GPS satellite.

  • “slip” : cycle slip flag for carrier phase observed from some N-th GPS satellite.

An additional carrier phase term, L4, will also be added to the RINEX observables. This helps LEOGPS to perform cycle slip detection. If the user opts for single frequency processing, then L4 is the Melbourne-Wubbena linear combination. If the user opts for dual frequency processing, then L4 is the geometry-free linear combination.

If Doppler observables D1/D2 are not found in the RINEX observations, then Doppler values will be estimated through the dopest.py module, by estimating a first-order derivative of the L1/L2 phase values numerically using polynomial fitting.

rinxtr.rinxtr(namepath, inps, goodsats, tstart, tstop, rnxstep)

Extraction of RINEX observations C1/P1, P2, L1, L2, D1, D2.

Parameters
  • namepath (str) – Path to the RINEX observation file

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

  • tstart (datetime.datetime) – Scenario start time for processing

  • tstop (datetime.datetime) – Scenario stop time for processing

  • rnxstep (datetime.timedelta) – Observed time step in RINEX file

Returns

rnxproc – A nested dictionary comprising code observations, carrier phase, doppler values, and a carrier phase flag.

Return type

dict

The output RINEX observations are structured as a dictionary of epochs, each epoch with a sub-dictionary of GPS satellites based on IDs (1 to 32), and each ID with a sub dictionary of the various observations (C1/P1, P2, L1, L2, D1, D2). Example output structure:

rnxproc = {epoch1 : {1 : {'C1':123, 'L1':123, ...
                          'L4':321, 'flag':'none'} ...} ...
           epoch2 : {2 : {'C1':123, 'L1':123, ...
                          'L4':321, 'flag':'slip'} ...} ...

                   ...

           epochX : {1 : {'C1':123, 'L1':123, ...
                          'L4':321, 'flag':'none'} ...}}

If the user opts for code-carrier smoothing Hatch filter (either through the GUI or in the config file), then hatch filtering will be called in rinxtr.rinxtr() using the phasep.py module.

You may also change the length of the cycle slip filter, and the filter tolerance in terms of the number of standard deviations through the GUI or manually in the config file.

Do ensure that RINEX observation files follow 4-letter ID naming convention followed by the DOY + 0, with the file extension .YYO.


phasep.py

The phasep.py module augments the RINEX data dictionary parsed out by rinxtr.py module. It comprises the cycle slip detection and marking function phsmrk(), as well as the hatch filtering algorithm ph1fil() for L1 observables, and ph2fil() for L1 + L2 observables. Within the hatch filtering loop, each code-phase data point at each time step is computed by the hatch1() or hatch2() functions.

In this module, the carrier phase cycle slip detection algorithm is done by performing an interpolation of combined L4 (see rinxtr.py above) carrier phase data, and observing if there are any single points of data that exceed “X” sigmas of the interpolated carrier phase. “X” refers to the user-specified number of standard deviations as a cut-off point for declaring deviant observations as cycle slips. Such deviant observations will trigger the script to mark that epoch’s observation and GPS PRN ID with a cycle slip string flag, and print a warning message to the user in the terminal. However, as of Version 1.3, LEOGPS does not attempt to repair or reject that particular observation.

phasep.hatch1(rf, ri, pf, pi, M, ltype)

Single-frequency code-carrier hatch filter for a single data point.

Parameters
  • rf (float) – Pseudorange at epoch [i]

  • ri (float) – Pseudorange at epoch [i-1]

  • pf (float) – Carrier phase at epoch [i]

  • pi (float) – Carrier phase at epoch [i-1]

  • M (int) – Hatch filter length

  • ltype (str) – Frequency string (‘L1’ or ‘L2’)

Returns

Smoothed code-phase value.

Return type

float

phasep.hatch2(rf, ri, pf1, pf2, pi1, pi2, M)

Dual-frequency code-carrier hatch filter for a single data point.

Parameters
  • rf (float) – Pseudorange at epoch [i]

  • ri (float) – Pseudorange at epoch [i-1]

  • pf1 (float) – Carrier phase L1 at epoch [i]

  • pf2 (float) – Carrier phase L2 at epoch [i]

  • pi1 (float) – Carrier phase L1 at epoch [i-1]

  • pi2 (float) – Carrier phase L2 at epoch [i-1]

  • M (int) – Hatch filter length

Returns

Smoothed code-phase value.

Return type

float

phasep.ph1fil(rnxdata, rnxstep, goodsats, hatchlen)

Single-frequency hatch filter to be applied to the entire RINEX data dictionary, for carrier phase values without cycle slips. This function calls hatch1() repeatedly in the filter loop.

Parameters
  • rnxdata (dict) – A nested dictionary comprising code observations, carrier phase, and doppler values.

  • rnxstep (datetime.timedelta) – Observed time step in RINEX file

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

  • hatchlen (int) – Length of the hatch filter

Returns

rnxdata – A nested dictionary comprising code observations, carrier phase, and doppler values, with the code values smoothed by Hatch filtering.

Return type

dict

phasep.ph2fil(rnxdata, rnxstep, goodsats, hatchlen)

Dual-frequency hatch filter to be applied to the entire RINEX data dictionary, for carrier phase values without cycle slips. This function calls hatch2() repeatedly in the filter loop.

Parameters
  • rnxdata (dict) – A nested dictionary comprising code observations, carrier phase, and doppler values.

  • rnxstep (datetime.timedelta) – Observed time step in RINEX file

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

  • hatchlen (int) – Length of the hatch filter

Returns

rnxdata – A nested dictionary comprising code observations, carrier phase, and doppler values, with the code values smoothed by Hatch filtering.

Return type

dict

phasep.phsmrk(rnxdata, rnxstep, goodsats, inps)

Marks the rnxdata dict with carrier phase flags at each epoch.

Parameters
  • rnxdata (dict) – A nested dictionary comprising code observations, carrier phase, and doppler values.

  • rnxstep (datetime.timedelta) – Observed time step in RINEX file

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Returns

rnxproc – A nested dictionary comprising code observations, carrier phase, doppler values, with an added L4 phase and a carrier phase flag.

Return type

dict

Note

The RINEX data dictionary returned by phasep.phsmrk(), phasep.ph1fil(), phasep.ph2fil() all share the same nested dictionary key-value pairs as the output of the rinxtr.rinxtr() function.


dopest.py

If Doppler observables D1/D2 are not found in the RINEX observations, then Doppler values will be estimated through the dopest.py module, by estimating a first-order derivative of the L1/L2 phase values numerically using polynomial fitting.

dopest.dopest(rnxdata, goodsats, tstart, tstop, rnxstep, inps)

Estimation of Doppler (carrier phase rates) using carrier phase.

Parameters
  • rnxdata (dict) – A nested dictionary comprising code observations, carrier phase, but missing Doppler values (thus triggering this function).

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

  • tstart (datetime.datetime) – Scenario start time for processing

  • tstop (datetime.datetime) – Scenario stop time for processing

  • rnxstep (datetime.timedelta) – Observed time step in RINEX file

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Returns

rnxout – A nested dictionary comprising code observations, carrier phase, and non-zero doppler values, at data points where multiple carrier phase values are present in sequence.

Return type

dict


posvel.py

The sixth step is to perform single point positioning (SPP), using the code pseudorange equations, solved via weighted least squares epoch-wise. Thus, the primary function posvel.posvel() is called once for each satellite and for each epoch.

In the code phase ranging equation, GPS satellite clock biases are offset from the output of the gpsxtr.py module. Ionospheric delays are handled too. In the L1 case, the GRAPHIC linear combination is used. In the L2 case, the ionosphere-free linear combination is used. Other effects such as the signal time-of-flight, the effects of Earth rotation, relativistic Shapiro effect, relativistic clock delays and clock advances are also offset. Functions to compute the relativistic effects are given in the next section, under einstn.py.

Doppler-based estimation of velocities will also be performed if Doppler data is available in the RINEX data dictionary parsed out by rinxtr.py module. By default, if Doppler data is missing, the dopest.py module would have worked its magic to estimate the Doppler values.

posvel.posvel(epoch, goodsats, gps, rxi, inps, nm, iters=6)

Single point positioning using code via weighted least squares, called epoch-wise. In other words, posvel() is called to solve for positions at every single epoch set of observables snap-shot wise.

Parameters
  • epoch (datetime.datetime) – Current epoch of observables

  • goodsats (list) – Sorted list of integers of SV IDs e.g. [1,2,3,5,6,9,10,…,31,32]

  • gps (dict) – Nested dictionary of GPS ephemeris and clock data across PRN IDs, for a particular epoch. This dictionary is one tier deep in the output of gpsxtr.gpsxtr(). In other words, gps = gpsdict[epoch] where gpsdict is the output of gpsxtr.gpsxtr()

  • rxi (dict) – A nested dictionary comprising code observations, carrier phase, doppler values, and a carrier phase flag, for a particular epoch. This dictionary is one tier deep in the output of rinxtr.rinxtr() In other words, rxi = rnxdata[epoch] where rnxdata is the output of rinxtr.rinxtr()

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

  • nm (str) – 4-letter ID of the current spacecraft

  • iters (int, optional) – Number of iterations in least squares (default 6).

Returns

  • posf (numpy.ndarray) – Position and clock bias [Xp, Yp, Zp, Tp]

  • velf (numpy.ndarray) – Velocity and clock drift [Xv, Yv, Zv, Tv]

  • dopf (numpy.ndarray) – Dilution of precision [GDOP, PDOP, TDOP]

  • clkb (numpy.ndarray) – Clock bias length-one [Tp].

Note

Tropospheric effects are not handled in posvel.py as LEOGPS was built for spaceborne receivers and not for terrestrial receivers. However, if you wish to include terrestrial receivers, you can include the tropospheric modelled offsets (i.e. Saastamoinen, Hopfield, or Differential Refraction models etc) to the observed range variable gpsrng_obsv from lines 258 to 297.

In the main work flow leorun.run(), this function will be called once in each epoch for each of the two satellites. Both SPP results will be used in the carrier phase ambiguity estimation.


einstn.py

The ‘Einstein’ module, comprises two main functions: one to compute the clock advance and one to compute the Shapiro path delay. In both functions, the output is converted to the equivalent path-length in meters.

einstn.clockadv(gpspos, gpsvel)

Returns the clock advance effect on signal range as a path length correction in meters.

Parameters
  • gpspos (numpy.ndarray) – 1x3 position of GPS satellite (ITRF)

  • gpsvel (numpy.ndarray) – 1x3 velocity of GPS satellite (ITRF)

Returns

correction – Units in meters

Return type

float

einstn.shapiro(leopos, gpspos)

Returns the Shapiro delay effect on signal range as a path length correction in meters.

Parameters
  • leopos (numpy.ndarray) – 1x3 position of LEO satellite (ITRF)

  • gpspos (numpy.ndarray) – 1x3 position of GPS satellite (ITRF)

Returns

correction – Units in meters

Return type

float

Note

The rate of advance of two identical clocks, one in the LEO satellite and the other on the GPS satellite, will differ due to differences in the gravitational potential and to the relative speed between them.

Note

Shapiro Delay: Due to the space time curvature produced by the gravitational field, the Euclidean range travelled by the signal, which is computed by posvel.py must be corrected by the extra distance travelled. Typically, Shapiro effects corrupt the range model with about ~2cm ranging error.

This module will be called in posvel.py during the setup of pseudorange model in the iterative least squares solution of single-point positioning.


azimel.py

While elevation-dependent or azimuth-dependent weighting is not built into the iterative least squares processing of LEOGPS for single point positioning, this module exists (but is not used) if the user wishes to compute azimuths and elevations from the LEO to GPS satellites anyway.

azimel.azimel(leopos, gpspos)

Returns azimuth and elevation angles (rad) from the LEO satellite to the GPS satellite when providing an ECEF position coordinate of them both.

Parameters
  • leopos (list) – Position coordinate of LEO in ECEF [X,Y,Z]

  • gpspos (list) – Position coordinate of GPS in ECEF [X,Y,Z]

Returns

  • az (float) – Azimuth angle (rad, -pi to +pi)

  • el (float) – Azimuth angle (rad, -pi to +pi)


ambest.py

This is the seventh processing step, which is the carrier phase integer or float ambiguity resolution step. This module contains functions that support epoch-wise processing for integer ambiguity resolution step.

The chief function in the module is the ‘ambest()’ function, which outputs the precise relative baseline vector between the two spacecraft. This processing is done snapshot-wise, and thus has to be called for each epoch of carrier phase observations. All other supporting functions are called within ‘ambest()’. At the user-level, it is advised to modify contents only within ‘ambest’ unless the user wishes to modify the core float ambiguity resolution algorithm.

ambest.ambest(epoch, gps, rx1, rx2, pos1, pos2, inps, sigma=0.002, fix=False, covZD=None)

Double difference ambiguity estimation for baseline estimation.

Parameters
  • epoch (datetime.datetime) – Current epoch of observables

  • gps (dict) – Nested dictionary of GPS ephemeris and clock data across PRN IDs, for a particular epoch. This dictionary is one tier deep in the output of gpsxtr.gpsxtr(). In other words, gps = gpsdict[epoch] where gpsdict is the output of gpsxtr.gpsxtr()

  • rx1 (dict) – A nested dictionary comprising (LEO-A) code observations, carrier phase, doppler, and a carrier phase flag, for a particular epoch. This dictionary is one tier deep in the output of rinxtr.rinxtr() In other words, rxi = rnxdata[epoch] where rnxdata is the output of rinxtr.rinxtr()

  • rx2 (dict) – A nested dictionary comprising (LEO-B) code observations, carrier phase, doppler, and a carrier phase flag, for a particular epoch. This dictionary is one tier deep in the output of rinxtr.rinxtr() In other words, rxi = rnxdata[epoch] where rnxdata is the output of rinxtr.rinxtr()

  • pos1 (numpy.ndarray) – Position vector of LEO-A [Xp, Yp, Zp]

  • pos2 (numpy.ndarray) – Position vector of LEO-B [Xp, Yp, Zp]

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

  • sigma (float, optional) – Carrier phase variance (assumed uniform, default = 0.002m or 2mm).

  • fix (boolean, optional) – Set to True to enable integer ambiguity fixing using LAMBDA. Otherwise, use the float ambiguity approximated by the code range (default False)

  • covZD (numpy.ndarray) – Covariance matrix of N zero difference observables (NxN dimension)

Returns

baseline – Relative position vector [Rx, Ry, Rz]. Returns a zero vector if the inertial position vectors of LEO-A or LEO-B are zero.

Return type

numpy.ndarray

An option exists to perform integer fixing (see the fix argument above) using Peter Teunissen’s LAMBDA method. A Pythonic translation of his original LAMBDA Integer-Least-Squares (ILS) Search-and-Shrink algorithm has been provided in the ambfix.py module.

Note

If the user wishes to set their own custom zero difference covariance matrix, the user can input this in the optional covZD argument. If the user does not specify the covZD argument, then covZD by default will revert to an identity matrix scaled by the sigma argument above. Thus, running LAMBDA (by setting fix = True when calling ambest.py), but not setting a custom covZD argument, only has the equivalent effect of integer rounding.


ambfix.py

This module holds the classical LAMBDA method that was originally authored by Teunissen, Jonge, and Tiberius (1993). The code was later written in MATLAB by Dr Sandra Verhagen and Dr Bofeng Li. It takes in a vector of float ambiguities to the integer least-squares (ILS) problem, and covariance of the float ambiguities. It then runs the LAMBDA’s ILS search-&-shrink and spits out the ambiguity integers. The other 5 methods in original LAMBDA MATLAB code are not supported here (feel free to edit the code and implement it youself). The default ncands = 2, as per original code. All supporting functions from the original MATLAB code (decorrel, ldldecom, ssearch) have been nested within the main function as sub functions.

ambfix.LAMBDA(ahat, Qahat, ncands=2)

Integer least-squares method with search-and-shrink for integer estimation based on the provided float ambiguity vector (Nx1) ahat and associated variance-covariance matrix (NxN) Qahat.

Parameters
  • ahat (numpy.ndarray) – N-length array of float ambiguities

  • Qahat (numpy.ndarray) – NxN covariance matrix of ambiguities

  • ncands (int, optional) – Number of search candidates (default = 2)

Returns

  • afixed – (N x ncands) Array of with estimated integer candidates, sorted according to the corresponding squared norms, best candidate first.

  • sqnorm – (ncands x 1) Distance between integer candidate and float ambiguity vectors in the metric of the variance-covariance matrix Qahat.

Note

LAMBDA always first applies a decorrelation before the integer estimation. For ILS this is required to guarantee an efficient search. For rounding and bootstrapping it is required in order to get higher success rates (although rounding and bootstrapping is not included in LEOGPS).


frames.py

This is the eighth step in the LEOGPS native processing work flow. This step performs the conversion of the coordinate reference frames between ITRF and ICRF, via the IAU1976 Theory of Precession and IAU1980 Theory of Nutation. For the visualisation of the formation geometry, it is recommended that the user select the Hill frame as the relative orbit coordinate frame. By default, the reference frame in the downloaded ephemeris files in AIUB CODE’s FTP is the ITRF.

frames.cep2icrf(t, r, v=array([0.0, 0.0, 0.0]))

Transformation of the conventional ephemeris pole frame (the True-Of- Epoch frame) to the international celestial reference frame (ICRF), by discounting precession and nutation. This transformation is performed via a the inverse of the precession and nutation matrices P and N. This function will return two vectors (position and velocity).

Parameters
  • t (datetime.datetime) – Current time of observation in GPST.

  • r (numpy.ndarray) – Position vector (1x3) in CEP frame.

  • v (numpy.ndarray, optional) – Velocity vector (1x3) in CEP frame.

Returns

  • r_icrf (numpy.ndarray) – Position vector in ICRF frame.

  • v_icrf (numpy.ndarray) – Velocity vector in ICRF frame.

frames.cep2itrf(t, r, v=array([0.0, 0.0, 0.0]))

Transformation of the conventional ephemeris pole frame (CEP) to the international terrestrial reference frame (ITRF) by accounting for the diurnal rotation of the Earth, and accounting for the motion of the poles that matches the CEP to the ITRF. This function will return two vectors (position and velocity).

Parameters
  • t (datetime.datetime) – Current time of observation in GPST.

  • r (numpy.ndarray) – Position vector (1x3) in CEP frame.

  • v (numpy.ndarray, optional) – Velocity vector (1x3) in CEP frame.

Returns

  • r_itrf (numpy.ndarray) – Position vector in ITRF frame.

  • v_itrf (numpy.ndarray) – Velocity vector in ITRF frame.

frames.icrf2cep(t, r, v=array([0.0, 0.0, 0.0]))

Transformation of the international celestial reference frame (ICRF) to the conventional ephemeris pole frame (the True-Of-Epoch frame), by correcting precession and nutation. This transformation is performed using a composite of two orthogonal rotation matrices P and N. This function will return two vectors (position and velocity).

Parameters
  • t (datetime.datetime) – Current time of observation in GPST.

  • r (numpy.ndarray) – Position vector (1x3) in ICRF frame.

  • v (numpy.ndarray, optional) – Velocity vector (1x3) in ICRF frame.

Returns

  • r_cep (numpy.ndarray) – Position vector in CEP frame.

  • v_cep (numpy.ndarray) – Velocity vector in CEP frame.

frames.icrf2hill(baseline, rc, vc)

Takes in a relative position vector, or baseline vector, as well as the chief position and velocity vectors. All inputs in ICRF. Transforms the relative position vector, or baseline vector, to the satellite local vertical local horizontal Euler-Hill Frame of the chief spacecraft.

Parameters
  • baseline (numpy.ndarray) – Relative position vector (1x3) in ICRF frame.

  • rc (numpy.ndarray) – Position vector (1x3) of Chief in ICRF frame.

  • vc (numpy.ndarray) – Velocity vector (1x3) of Chief in ICRF frame.

Returns

hill_baseline – Relative position vector (1x3) of Deputy in Euler-Hill frame.

Return type

numpy.ndarray

frames.icrf2itrf(t, r, v=array([0.0, 0.0, 0.0]))

Transformation of the international celestial reference frame (ICRF) to the international terrestrial reference frame (ITRF), by calling the two functions in sequence: icrf2cep and cep2itrf().

Parameters
  • t (datetime.datetime) – Current time of observation in GPST.

  • r (numpy.ndarray) – Position vector (1x3) in ICRF frame.

  • v (numpy.ndarray, optional) – Velocity vector (1x3) in ICRF frame.

Returns

  • r_icrf (numpy.ndarray) – Position vector in ITRF frame.

  • v_icrf (numpy.ndarray) – Velocity vector in ITRF frame.

frames.itrf2cep(t, r, v=array([0.0, 0.0, 0.0]))

Transformation of the international terrestrial reference frame (ITRF) to the conventional ephemeris pole frame (CEP) by discounting for the diurnal rotation of the Earth, and discounting the motion of the poles, from the ITRF to CEP. This function will return two vectors (position and velocity).

Parameters
  • t (datetime.datetime) – Current time of observation in GPST.

  • r (numpy.ndarray) – Position vector (1x3) in ITRF frame.

  • v (numpy.ndarray, optional) – Velocity vector (1x3) in ITRF frame.

Returns

  • r_itrf (numpy.ndarray) – Position vector in CEP frame.

  • v_itrf (numpy.ndarray) – Velocity vector in CEP frame.

frames.itrf2icrf(t, r, v=array([0.0, 0.0, 0.0]))

Transformation of the international terrestrial reference frame (ITRF) to the international celestial reference frame (ICRF), by calling the two functions in sequence: itrf2cep() and cep2icrf().

Parameters
  • t (datetime.datetime) – Current time of observation in GPST.

  • r (numpy.ndarray) – Position vector (1x3) in ITRF frame.

  • v (numpy.ndarray, optional) – Velocity vector (1x3) in ITRF frame.

Returns

  • r_icrf (numpy.ndarray) – Position vector in ICRF frame.

  • v_icrf (numpy.ndarray) – Velocity vector in ICRF frame.


pubplt.py

In the final stage, after all processing is done, the pubplt.py module publishes the information into output files in the outputs folder, found in the LEOGPS root directory.

Specifically, there are three functions in this module: a function to save as a plot graph the interpolated GPS ephemeris and clock biases; a function to save as a text report the interpolated GPS ephemeris and clock biases; and a function to save the final ephemeris and precise baselines estimated of both LEO-A and LEO-B.

pubplt.gps_graphs(SV, t_usr_dt, t_usr_ss, gpsdata, inps)

Generates a plot of the GPS position, velocity, and clock bias (ITRF). Plots will be saved in the output/gps_plots folder.

Parameters
  • SV (int) – Space vehicle number (1 to 32)

  • t_usr_dt (list) – List of datetime.datetime objects

  • t_usr_ss (list) – List of integer time units in seconds

  • gpsdata (dict) – Nested dictionary of GPS ephemeris and clock data generated by gpsxtr.gpsxtr().

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Return type

None.

pubplt.gps_report(gpsdata, goodsats, inps)

Generates an ASCII text report of GPS position, velocity, and clock bias (ITRF). Report will be saved in the output/gps_report folder.

Parameters
  • gpsdata (dict) – Nested dictionary of GPS ephemeris and clock data generated by gpsxtr.gpsxtr().

  • goodsats (list) – Sorted list of GPS satellites without outages by PRN IDs

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Return type

None.

pubplt.leo_results(results, inps)

Generates the final report comprising the solutions to single-point positions and velocities of LEO-A and LEO-B, the dilution of precisions, the receiver clock bias values, and the precise relative baseline vectors. This report is saved in the output folder.

Parameters
  • results (dict) – This is a Python dictionary, with each key being a datetime.datetime object, with values as a list of the NumPy arrays as elements: [pos1 (1x3), vel1 (1x3), dop1 (1x3), cb1 (1x1), pos2 (1x3), vel2 (1x3), dop2 (1x3), cb2 (1x1), baseline (1x3)]

  • inps (dict) – A dictionary of inputs created by inpxtr.inpxtr()

Return type

None.


consts.py

The following is a list of common constants used throughout LEOGPS, extracted from the University of Bern, Center for Orbit Determination in Europe (CODE):

C      = 299792458.0      # VELOCITY OF LIGHT                M/SEC
FREQ1  = 1575420000.0     # L1-CARRIER FREQUENCY   GPS       1/SEC
FREQ2  = 1227600000.0     # L2-CARRIER FREQUENCY   GPS       1/SEC
FREQ5  = 1176450000.0     # L5-CARRIER FREQUENCY   GPS       1/SEC
FREQP  = 10230000.0       # P-CODE     FREQUENCY   GPS       1/SEC
FREQG1 = 1602000000.0     # L1-CARRIER FREQUENCY   GLONASS   1/SEC
FREQG2 = 1246000000.0     # L2-CARRIER FREQUENCY   GLONASS   1/SEC
DFRQG1 = 562500.0         # L1-CARRIER FREQ. DIFF. GLONASS   1/SEC
DFRQG2 = 437500.0         # L2-CARRIER FREQ. DIFF. GLONASS   1/SEC
FREQGP = 5110000.0        # P-CODE     FREQUENCY   GLONASS   1/SEC
FRQE1  = 1575420000.0     # L1-CARRIER FREQUENCY   GALILEO   1/SEC
FRQE5  = 1191795000.0     # L5-CARRIER FREQUENCY   GALILEO   1/SEC
FRQE5a = 1176450000.0     # L5a-CARRIER FREQUENCY  GALILEO   1/SEC
FRQE5b = 1207140000.0     # L5b-CARRIER FREQUENCY  GALILEO   1/SEC
FRQE6  = 1278750000.0     # L6-CARRIER FREQUENCY   GALILEO   1/SEC
FRQS1  = 1575420000.0     # L1-CARRIER FREQUENCY   SBAS      1/SEC
FRQS5  = 1176450000.0     # L5-CARRIER FREQUENCY   SBAS      1/SEC
FRQC1  = 1589740000.0     # L1-CARRIER FREQUENCY   COMPASS   1/SEC
FRQC2  = 1561098000.0     # L2-CARRIER FREQUENCY   COMPASS   1/SEC
FRQC5b = 1207140000.0     # L5b-CARRIER FREQUENCY  COMPASS   1/SEC
FRQC6  = 1268520000.0     # L6-CARRIER FREQUENCY   COMPASS   1/SEC
FRQJ1  = 1575420000.0     # L1-CARRIER FREQUENCY   QZSS      1/SEC
FRQJ2  = 1227600000.0     # L2-CARRIER FREQUENCY   QZSS      1/SEC
FRQJ5  = 1176450000.0     # L5-CARRIER FREQUENCY   QZSS      1/SEC
FRQJ6  = 1278750000.0     # L6-CARRIER FREQUENCY   QZSS      1/SEC
GM     = 398.6004415e12   # GRAVITY CONSTANT*EARTH MASS      M**3/SEC**2
GMS    = 1.3271250e20     # GRAVITY CONSTANT*SOLAR MASS      M**3/SEC**2
GMM    = 4.9027890e12     # GRAVITY CONSTANT*LUNAR MASS      M**3/SEC**2
AU     = 149597870691     # ASTRONOMICAL UNIT                M
AE     = 6378137.0        # EQUATORIAL RADIUS OF EARTH       M
CONRE  = 6371000.0        # MEAN RADIUS OF THE EARTH         M
J2     = 1.0826359e-3     # DYNAMICAL FORM-FACTOR IERS(2003) 1
FACTEC = 40.3e16          # IONOSPHERIC FACTOR               M/SEC**2/TECU
P0     = -0.94e-7         # NOMINAL RAD.PR. ACCELERAT.       M/SEC**2
OMEGA  = 7292115.1467e-11 # ANGULAR VELOCITY OF EARTH        RAD/USEC
EPHUTC = 55.0             # EPH. TIME (ET) MINUS UTC         SEC
WGTPHA = 1.0              # WEIGHT FOR PHASE OBSERVATIONS    1
WGTCOD = 1.0e-4           # WEIGHT FOR CODE OBSERVATIONS     1
HREF   = 0.0              # REFERENCE HEIGHT FOR METEO MODEL M
PREF   = 1013.25          # PRESSURE AT HREF                 MBAR
TREF   = 18.0             # TEMPERATURE AT HREF              DEG. CELSIUS
HUMREF = 50.0             # HUMIDITY AT HREF                 %
ERR    = 7.2921150e-5     # EARTH INERTIAL ROTATION RATE     RAD/SEC

This API reference was automatically generated using Sphinx’ Autodoc feature, using the NumPy docstring format, and last updated on 11th September 2021.