operations module

Base class for moving values between different modules/functions

operations.concat(*navdatas, axis=1)[source]

Concatenates NavData instances by row or column.

Concatenates given NavData instances together by either row or column.

Each type of data is included in a row, so adding new rows with axis=0, means adding new types of data. Concat requires that the new NavData matches the length of the existing NavData. Row concatenation assumes the same ordering across both NavData instances (e.g. sorted by timestamp) and does not perform any matching/sorting itself.

You can also concatenate new columns axis=1. If the row names of the new NavData instance don’t match the row names of the existing NavData instance, the mismatched values will be filled with np.nan.

Parameters:
  • navdatas (List-like of gnss_lib_py.navdata.navdata.NavData) – Navdata instances to concatenate.

  • axis (int) – Either add new rows (type) of data axis=0 or new columns (e.g. timesteps) of data axis=1.

Returns:

new_navdata – NavData instance after concatenating specified data.

Return type:

gnss_lib_py.navdata.navdata.NavData or None

operations.find_wildcard_indexes(navdata, wildcards, max_allow=None, excludes=None)[source]

Searches for indexes matching wildcard search input.

For example, a search for x_*_m would find x_rx_m or x_sv_m or x_alpha_beta_gamma_m depending on the rows existing in the NavData instance.

The excludes variable allows you to exclude indexes when trying to match a wildcard. For example, if there are rows named pr_raw_m``and ``pr_raw_sigma_m then the input wildcards="pr_*_m", excludes=None would return {"pr_*_m", ["pr_raw_m","pr_raw_sigma_m"]} but with the excludes parameter set, the input wildcards="pr_*_m", excludes="pr_*_sigma_m" would only return {"pr_*_m", ["pr_raw_m"]}

Will return an error no index is found matching the wildcard or if more than max_allow indexes are found.

Currently only allows for a single wildcard ‘*’ per index.

Parameters:
  • navdata (gnss_lib_py.navdata.navdata.NavData) – Navdata instance.

  • wildcards (array-like or str) – List/tuple/np.ndarray/set of indexes for which to search.

  • max_allow (int or None) – Maximum number of valid indexes to allow before throwing an error. If None, then no limit is placed.

  • excludes (array-like or str) – List or string to exclude for each wildcard in wildcards. Must be the same length as wildcards. Allowed to include a wildcard ‘*’ character but not necessary.

Returns:

wildcard_indexes – Dictionary of the form {“search_term”, [indexes,…]},

Return type:

dict

operations.interpolate(navdata, x_row, y_rows, inplace=False, *args)[source]

Interpolate NaN values based on row data.

Additional *args arguments are passed into the np.interp function.

Parameters:
  • navdata (gnss_lib_py.navdata.navdata.NavData) – Navdata instance.

  • x_row (string) – Row name for x-coordinate of all values (e.g. gps_millis). Row must not contain any nan values.

  • y_rows (list or string) – Row name(s) for y-coordinate which includes nan values that will be interpolated.

  • inplace (bool) – If False, will return new NavData instance with nan values interpolated. If True, will interpolate nan values within the current NavData instance.

Returns:

new_navdata – If inplace is False, returns NavData instance after removing specified rows and columns. If inplace is True, returns None.

Return type:

gnss_lib_py.navdata.navdata.NavData or None

operations.loop_time(navdata, time_row, delta_t_decimals=2)[source]

Generator object to loop over columns from same times.

Parameters:
  • navdata (gnss_lib_py.navdata.navdata.NavData) – Navdata instance.

  • time_row (string/int) – Key or index of the row in which times are stored.

  • delta_t_decimals (int) – Decimal places after which times are considered equal.

Yields:
  • timestamp (float) – Current timestamp.

  • delta_t (float) – Difference between current time and previous time.

  • new_navdata (gnss_lib_py.navdata.navdata.NavData) – NavData with same time, up to given decimal tolerance.

operations.sort(navdata, order=None, ind=None, ascending=True, inplace=False)[source]

Sort values along given row or using given index

Parameters:
  • navdata (gnss_lib_py.navdata.navdata.NavData) – Navdata instance.

  • order (string/int) – Key or index of the row on which NavData will be sorted

  • ind (list/np.ndarray) – Ordering of indices to be used for sorting

  • ascending (bool) – If true, sorts “ascending”, otherwise sorts “descending”

  • inplace (bool) – If False, will return new NavData instance with rows sorted. If True, will sorted data rows in the current NavData instance.

Returns:

new_navdata – If inplace is False, returns NavData instance after renaming specified rows. If inplace is True, returns None.

Return type:

gnss_lib_py.navdata.navdata.NavData or None