laika package

Subpackages

Submodules

laika.astro_dog module

class laika.astro_dog.AstroDog(auto_update=True, cache_dir='/tmp/gnss/', dgps=False, valid_const=('GPS', 'GLONASS'), valid_ephem_types=(<EphemerisType.FINAL_ORBIT: 1>, <EphemerisType.RAPID_ORBIT: 2>, <EphemerisType.ULTRA_RAPID_ORBIT: 3>), clear_old_ephemeris=False)[source]

Bases: object

auto_update: flag indicating whether laika should fetch files from web automatically cache_dir: directory where data files are downloaded to and cached dgps: flag indicating whether laika should use dgps (CORS)

data to calculate pseudorange corrections

valid_const: list of constellation identifiers laika will try process valid_ephem_types: set of ephemeris types that are allowed to use and download.

Default is set to use all orbit ephemeris types

clear_old_ephemeris: flag indicating if ephemeris for an individual satellite should be overwritten when new ephemeris is added.

add_navs(new_ephems: Dict[str, List[Ephemeris]])[source]
add_orbits(new_ephems: Dict[str, List[Ephemeris]])[source]
download_parse_orbit(gps_time: GPSTime, skip_before_epoch=None) Dict[str, List[PolyEphemeris]][source]
download_parse_prediction_orbit(gps_time: GPSTime)[source]
get_all_sat_info(time)[source]
get_dcb(prn, time)[source]
get_dcb_data(time)[source]
get_delay(prn, time, rcv_pos, no_dgps=False, signal='C1C', freq=None)[source]
get_dgps_corrections(time, recv_pos)[source]
get_dgps_data(time, recv_pos)[source]
get_epoch_range(new_ephems)[source]
get_frequency(prn, time, signal='C1C')[source]
get_glonass_channel(prn, time)[source]
get_ionex(time) Optional[IonexMap][source]
get_ionex_data(time)[source]
get_nav(prn, time)[source]
get_nav_data(time)[source]
get_navs(time)[source]
get_orbit(prn: str, time: GPSTime)[source]
get_orbit_data(time: GPSTime, only_predictions=False)[source]
get_orbits(time)[source]
get_sat_info(prn, time)[source]
get_tgd_from_nav(prn, time)[source]

laika.constants module

laika.dcb module

class laika.dcb.DCB(prn, data)[source]

Bases: object

get_delay(signal)[source]
valid(time)[source]
laika.dcb.parse_dcbs(file_name, SUPPORTED_CONSTELLATIONS)[source]

laika.dgps module

class laika.dgps.DGPSDelay(station_id, station_pos, station_delays, station_delays_t, max_distance)[source]

Bases: object

get_delay(prn, time, signal='C1C')[source]
valid(time, recv_pos)[source]
laika.dgps.download_and_parse_station_postions(cors_station_positions_path, cache_dir)[source]
laika.dgps.get_closest_station_names(pos, k=5, max_distance=100000, cache_dir='/tmp/gnss/')[source]
laika.dgps.get_station_position(station_id, cache_dir='/tmp/gnss/', time=GPSTime(week=2222, tow=181220.106859))[source]
laika.dgps.load_cors_station_positions(cache_dir)[source]
laika.dgps.mean_filter(delay)[source]
laika.dgps.parse_dgps(station_id, station_obs_file_path, dog, max_distance=100000, required_constellations=['GPS'])[source]

laika.downloader module

exception laika.downloader.DownloadFailed[source]

Bases: Exception

laika.downloader.download_and_cache_file(url_base, folder_path: str, cache_dir: str, filename: str, compression='', overwrite=False)[source]
laika.downloader.download_and_cache_file_return_first_success(url_bases, folder_and_file_names, cache_dir, compression='', overwrite=False, raise_error=False)[source]
laika.downloader.download_cors_coords(cache_dir)[source]
laika.downloader.download_cors_station(time, station_name, cache_dir)[source]
laika.downloader.download_dcb(time, cache_dir)[source]
laika.downloader.download_file(url_bases, *args, **kwargs)[source]
laika.downloader.download_files(url_bases, *args, **kwargs)[source]
laika.downloader.download_ionex(time, cache_dir)[source]
laika.downloader.download_nav(time: GPSTime, cache_dir, constellation: ConstellationId)[source]
laika.downloader.download_orbits_gps(time, cache_dir, ephem_types)[source]
laika.downloader.download_orbits_russia_src(time, cache_dir, ephem_types)[source]
laika.downloader.download_prediction_orbits_russia_src(gps_time, cache_dir)[source]
laika.downloader.ftp_connect(url)[source]
laika.downloader.ftp_download_file(url)[source]
laika.downloader.ftp_download_files(url_base, folder_path, cacheDir, filenames)[source]

Like download file, but more of them. Keeps a persistent FTP connection open to be more efficient.

laika.downloader.http_download_files(url_base, folder_path, cacheDir, filenames)[source]

Similar to ftp_download_files, attempt to download multiple files faster than just downloading them one-by-one. Returns a list of filepaths instead of the raw data

laika.downloader.https_download_file(url)[source]
laika.downloader.list_dir(url_bases, *args, **kwargs)[source]
laika.downloader.retryable(f)[source]

Decorator to allow us to pass multiple URLs from which to download. Automatically retry the request with the next URL on failure

laika.ephemeris module

class laika.ephemeris.Ephemeris(prn: str, data, epoch: GPSTime, eph_type: EphemerisType, healthy: bool, max_time_diff: float, file_epoch: Optional[GPSTime] = None, file_name=None)[source]

Bases: ABC

classmethod from_json(json_dct)[source]
get_sat_info(time: GPSTime)[source]

Returns: (pos, vel, clock_err, clock_rate_err, ephemeris)

to_json()[source]
valid(time)[source]
class laika.ephemeris.EphemerisSerializer(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
class laika.ephemeris.EphemerisType(value)[source]

Bases: IntEnum

An enumeration.

FINAL_ORBIT = 1
NAV = 0
QCOM_POLY = 4
RAPID_ORBIT = 2
ULTRA_RAPID_ORBIT = 3
static all_orbits()[source]
classmethod from_file_name(file_name: str)[source]
class laika.ephemeris.GLONASSEphemeris(data, epoch, healthy=True, file_name=None)[source]

Bases: Ephemeris

class laika.ephemeris.GPSEphemeris(data, epoch, healthy=True, file_name=None)[source]

Bases: Ephemeris

get_tgd()[source]
class laika.ephemeris.PolyEphemeris(prn: str, data, epoch: GPSTime, ephem_type: EphemerisType, file_epoch: GPSTime, file_name: str, healthy=True, tgd=0)[source]

Bases: Ephemeris

laika.ephemeris.convert_ublox_ephem(ublox_ephem, current_time: Optional[datetime] = None)[source]
laika.ephemeris.ephemeris_deserialize_hook(dct)[source]
laika.ephemeris.parse_rinex_nav_msg_glonass(file_name)[source]
laika.ephemeris.parse_rinex_nav_msg_gps(file_name)[source]
laika.ephemeris.parse_sp3_orbits(file_names, supported_constellations, skip_until_epoch: Optional[GPSTime] = None) Dict[str, List[PolyEphemeris]][source]
laika.ephemeris.read4(f, rinex_ver)[source]
laika.ephemeris.read_prn_data(data, prn, deg=16, deg_t=1)[source]

laika.gps_time module

class laika.gps_time.GPSTime(week, tow)[source]

Bases: object

GPS time class to add and subtract [week, tow]

as_datetime()[source]
as_unix_timestamp()[source]
property day
classmethod from_datetime(datetime)[source]
classmethod from_glonass(cycle, days, tow)[source]
classmethod from_meas(meas)[source]
class laika.gps_time.TimeSyncer(mono_time, gps_time)[source]

Bases: object

Converts logmonotime to gps_time and vice versa

classmethod from_datetime(datetime)[source]
classmethod from_logs(raw_qcom_measurement_report, clocks)[source]
gps2mono(gps_time)[source]
mono2gps(mono_time)[source]
laika.gps_time.datetime_to_tow(t)[source]

Convert a Python datetime object to GPS Week and Time Of Week. Does not convert from UTC to GPST. Fractional seconds are supported.

tdatetime

A time to be converted, on the GPST timescale.

mod1024bool, optional

If True (default), the week number will be output in 10-bit form.

week, towtuple (int, float)

The GPS week number and time-of-week.

laika.gps_time.get_leap_seconds(time)[source]
laika.gps_time.gpst_to_utc(t_gpst)[source]
laika.gps_time.tow_to_datetime(tow, week)[source]

Convert a GPS Week and Time Of Week to Python datetime object. Does not convert from GPST to UTC. Fractional seconds are supported.

tow : time of week in seconds

weeks : gps week

tdatetime

Python datetime

laika.gps_time.utc_to_gpst(t_utc)[source]

laika.helpers module

class laika.helpers.ConstellationId(value)[source]

Bases: IntEnum

An enumeration.

BEIDOU = 3
GALILEO = 2
GLONASS = 6
GPS = 0
IMES = 4
IRNSS = 7
QZNSS = 5
SBAS = 1
classmethod from_qcom_source(report_source: int)[source]
classmethod from_rinex_char(c: str)[source]
to_rinex_char() str[source]
class laika.helpers.TimeRangeHolder[source]

Bases: object

Class to support test if date is in any of the multiple, sparse ranges

add(start_time, end_time)[source]
laika.helpers.get_closest(time, candidates, recv_pos=None)[source]
laika.helpers.get_constellation(prn: str)[source]
laika.helpers.get_constellation_and_sv_id(nmea_id)[source]
laika.helpers.get_el_az(pos, sat_pos)[source]
laika.helpers.get_nmea_id_from_constellation_and_svid(constellation: ConstellationId, sv_id: int)[source]
laika.helpers.get_nmea_id_from_prn(prn: str)[source]
laika.helpers.get_prn_from_nmea_id(nmea_id: int)[source]
laika.helpers.rinex3_obs_from_rinex2_obs(observable)[source]

laika.iono module

class laika.iono.IonexMap(exp, data1, data2)[source]

Bases: object

static find_nearest(lst, val)[source]
get_TEC(pos, time)[source]

Returns TEC in a position pos of ionosphere :param pos: (lat, lon) [deg, deg] :return:

get_delay(rcv_pos, az, el, sat_pos, time, freq)[source]
static round_to_grid(number, base)[source]
valid(time)[source]
laika.iono.closest_in_list(lst, val, num=2)[source]

Returns two (num in general) closest values of val in list lst

laika.iono.compute_grid_lats_lons(data)[source]
laika.iono.get_header_body(file_path)[source]

Opens file_path, reads file and returns header and body separated with “END OF HEADER” :param file_path: path to RINEX-like file :return: header, body (arrays of lines)

laika.iono.get_header_line(headr, proprty)[source]
Parameters
  • headr – the header of the RINEX-file

  • proprty – string-like property to search for (e.g. ‘delta-utc’)

Returns

the string of the headr containing property

laika.iono.get_int_from_header(hdr, seq)[source]

Returns the first int from the line that contains seq of lines hdr. In fact, _header_ here may not be header of RINEX/IONEX, just some set of lines.

laika.iono.klobuchar(pos, az, el, time, iono_coeffs)[source]

Details are taken from [5]: IS-GPS-200H, Fig. 20-4 Note: result is referred to the GPS L₁ frequency; if the user is operating on the GPS L₂ frequency, the correction term must be multiplied by γ = f₂²/f₁¹ = 0.6071850227694382 :param pos: [lat, lon, alt] in radians and meters

laika.iono.parse_ionex(ionex_file)[source]
Parameters

ionex_file – path to the IONEX file

Returns

TEC interpolation function f( (lat,lon), datetime )

laika.raw_gnss module

class laika.raw_gnss.GNSSMeasurement(constellation_id: ConstellationId, sv_id: int, recv_time_week: int, recv_time_sec: float, observables: Dict[str, float], observables_std: Dict[str, float], glonass_freq: Optional[Union[int, float]] = None)[source]

Bases: object

GLONASS_FREQ = 3
PR = 4
PRN = 0
PRR = 6
PRR_STD = 7
PR_STD = 5
RECV_TIME_SEC = 2
RECV_TIME_WEEK = 1
SAT_POS = slice(8, 11, None)
SAT_VEL = slice(11, 14, None)
as_array(only_corrected=True)[source]
correct(est_pos, dog, allow_incomplete_delay=False)[source]
get_nmea_id()[source]
process(dog)[source]
laika.raw_gnss.array_from_normal_meas(meas)[source]
laika.raw_gnss.calc_pos_fix(measurements, x0=[0, 0, 0, 0, 0], no_weight=False, signal='C1C', min_measurements=6)[source]

Calculates gps fix with WLS optimizer

returns: 0 -> list with positions 1 -> pseudorange errs

laika.raw_gnss.calc_vel_fix(measurements, est_pos, v0=[0, 0, 0, 0], no_weight=False, signal='D1C')[source]

Calculates gps velocity fix with WLS optimizer

returns: 0 -> list with velocities 1 -> pseudorange_rate errs

laika.raw_gnss.correct_measurements(measurements: List[GNSSMeasurement], est_pos, dog, allow_incomplete_delay=False) List[GNSSMeasurement][source]
laika.raw_gnss.get_DOP(recv_pos, sat_positions)[source]
laika.raw_gnss.get_HDOP(recv_pos, sat_positions)[source]
laika.raw_gnss.get_PDOP(recv_pos, sat_positions)[source]
laika.raw_gnss.get_Q(recv_pos, sat_positions)[source]
laika.raw_gnss.get_TDOP(recv_pos, sat_positions)[source]
laika.raw_gnss.get_VDOP(recv_pos, sat_positions)[source]
laika.raw_gnss.group_measurements_by_epoch(measurements)[source]
laika.raw_gnss.group_measurements_by_sat(measurements)[source]
laika.raw_gnss.normal_meas_from_array(arr)[source]
laika.raw_gnss.pr_residual(measurements: List[GNSSMeasurement], signal='C1C', no_weight=False, no_nans=False)[source]
laika.raw_gnss.process_measurements(measurements: List[GNSSMeasurement], dog) List[GNSSMeasurement][source]
laika.raw_gnss.prr_residual(measurements, est_pos, signal='D1C', no_weight=False, no_nans=False)[source]
laika.raw_gnss.read_raw_qcom(report)[source]
laika.raw_gnss.read_raw_ublox(report) List[GNSSMeasurement][source]
laika.raw_gnss.read_rinex_obs(obsdata) List[List[GNSSMeasurement]][source]

laika.rinex_file module

exception laika.rinex_file.DownloadError[source]

Bases: Exception

class laika.rinex_file.RINEXFile(filename, rate=None)[source]

Bases: object

laika.rinex_file.digitorzero(x)[source]
laika.rinex_file.floatornan(x)[source]
laika.rinex_file.padline(l, n=16)[source]

laika.trop module

laika.trop.saast(pos, el, humi=0.75, temp0=15.0)[source]
Function from RTKlib: https://github.com/tomojitakasu/RTKLIB/blob/master/src/rtkcmn.c#L3362-3362

with no changes

Parameters
  • time – time

  • pos – receiver position {ecef} m)

  • el – azimuth/elevation angle {az,el} (rad) – we do not use az

  • humi – relative humidity

  • temp0 – temperature (Celsius)

Returns

tropospheric delay (m)

Module contents