lib.Qgps module

class lib.Qgps.GPSAntenna(gps_data_path, distance_antennas)[source]

Bases: GPStools

Methods

create_datetime_array(timestamp[, utc_offset])

Datetime array.

datetime_to_index(datetime, observation_date)

Datetime to index.

extract_gps_data(gps_data)

Extract GPS data.

get_gps_data(gps_data_path)

GPS Data.

get_observation_indices(datetime, ...)

Observation indices.

get_position_antenna_1(distance_antennas)

Position wrt antenna 2.

get_position_antenna_2([base_antenna_position])

Position antenna 2.

plot_gps_angles([index_start, index_stop])

Plot GPS angles.

plot_gps_data([index_start, index_stop, ...])

Plot GPS data.

plot_gps_data_plotly([index_start, ...])

Plot GPS data using Plotly.

plot_gps_position_vector([index_start, ...])

Plot GPS position vector.

read_gps_bindat(gps_data_path[, verbosity])

GPS binary data.

get_position_antenna_1(distance_antennas)[source]

Position wrt antenna 2.

General fonction to compute the position of any point located on the straight line formed by the antenna 1 - anntenna 2 vector. In the code, we used it only to compute the position of the antenna 1.

Be careful, yaw is not the usual theta angle in sphercial cooridinates (i.e. the latitude angle): it corresponds to the elevation angle. It is why we need to add np.pi/2 in the conversion formulas.

Parameters:
  • distance_antennas (float) – Distance between a point located on the straight line formed by the antenna 1 - anntenna 2 vector and antenna 2.

  • gps_data (dict) – Dictionary containing the GPS data.

  • date (array_like) – Array of dates, either a single date or a date range, in str or datetime format.

Returns:

position_wrt_antenna_2 – Position of the point wrt antenna 2 in North, East, Down coordinates.

Return type:

array_like

get_position_antenna_2(base_antenna_position=array([0, 0, 0]))[source]

Position antenna 2.

Method to compute the position of the antenna 2 in North, East, Down coordinates.

Parameters:
  • base_antenna_position (array_like) – The base antenna position in North, East, Down coordinates.

  • gps_data (dict) – Dictionary containing the GPS data.

  • date (array_like) – Array of dates, either a single date or a date range, in str or datetime format.

Returns:

antenna_2_position – Position of the antenna 2 in North, East, Down coordinates.

Return type:

array_like

class lib.Qgps.GPSCalsource(gps_data, position_ini_antenna1, position_ini_antenna2, position_ini_calsource, observation_date, distance_antennas=False, position_qubic=array([0, 0, 0]), observation_only=False)[source]

Bases: GPSAntenna

Methods

apply_rotation(v, rotation_instance)

Apply rotation.

cartesian_to_azel(cartesian_position)

Cartesian to AzEl.

compute_rotation(v1, v2)

Rotation.

create_datetime_array(timestamp[, utc_offset])

Datetime array.

datetime_to_index(datetime, observation_date)

Datetime to index.

extract_gps_data(gps_data)

Extract GPS data.

get_calsource_position(position_ini_antenna, ...)

Calsource position.

get_gps_data(gps_data_path)

GPS Data.

get_observation_indices(datetime, ...)

Observation indices.

get_position_antenna_1(distance_antennas)

Position wrt antenna 2.

get_position_antenna_2([base_antenna_position])

Position antenna 2.

plot_calsource_deviation(index)

Plot Calsource deviation.

plot_calsource_deviation_alt(index)

Plot calsource deviation alt.

plot_gps_angles([index_start, index_stop])

Plot GPS angles.

plot_gps_data([index_start, index_stop, ...])

Plot GPS data.

plot_gps_data_plotly([index_start, ...])

Plot GPS data using Plotly.

plot_gps_position_vector([index_start, ...])

Plot GPS position vector.

plot_position_calsource_azel([start_index, ...])

Plot position calsource azel.

plot_vector(fig, pos, vector[, color, name, ...])

Plot vector with plotly.

read_gps_bindat(gps_data_path[, verbosity])

GPS binary data.

apply_rotation(v, rotation_instance)[source]

Apply rotation.

Apply the rotation instance to the vector v.

Parameters:
  • v (array_like) – Vector to rotate.

  • rotation_instance (Rotation) – Rotation instance from Spipy.spatial.transform.Rotation.

Returns:

rotated_vector – Rotated vector.

Return type:

array_like

cartesian_to_azel(cartesian_position)[source]

Cartesian to AzEl.

Convert cartesian coordinates to AzEl coordinates.

Parameters:

cartesian_position (array_like) – Position in cartesian coordinates.

Returns:

azel_position – Position in AzEl coordinates.

Return type:

array_like

compute_rotation(v1, v2)[source]

Rotation.

Compute the rotation instance from Spipy.spatial.transform.Rotation, that transforms v1 to v2.

Parameters:
  • v1 (array_like) – Fisrt vector.

  • v2 (array_like) – Second vector.

Returns:

rotationon_instance – Rotation instance from Spipy.spatial.transform.Rotation.

Return type:

Rotation

get_calsource_position(position_ini_antenna, position_ini_calsource, position_antenna)[source]

Calsource position.

Compute the position of the calibration source, using the translation between the initial and current position of one antenna. This translation is then applied on the initial position of the calibration source.

Parameters:
  • position_ini_antenna (array_like) – Initial position of the antenna.

  • position_ini_calsource (array_like) – Initial position of the calibration source.

  • position_antenna (array_like) – Position of the antenna.

Returns:

position_calsource – Position of the calibration source.

Return type:

array_like

plot_calsource_deviation(index)[source]

Plot Calsource deviation.

Plot the deviation of the calibration source orientation at a given observation time, compared to the initial position.

Parameters:

index (int) – Index of the observation time.

plot_calsource_deviation_alt(index)[source]

Plot calsource deviation alt.

Alternative to plot the deviation of the calsource using matplotlib only.

Parameters:

index (int) – Index of the observation time.

plot_position_calsource_azel(start_index=0, end_index=-1)[source]

Plot position calsource azel.

Function to plot the evolution of the position of the calibration source in azel.

plot_vector(fig, pos, vector, color='blue', name='vector', show_arrow=True, arrow_size=0.2)[source]

Plot vector with plotly.

General method to plot a vector with arrow using plotly.

Parameters:
  • fig (matplotlib.figure.Figure) – Matplotlib figure.

  • pos (array_like) – Position of the vector.

  • vector (array_like) – Vector to plot.

  • color (str, optional) – Color of the vector, by default ‘blue’

  • name (str, optional) – Name of the vector, by default ‘vector’

  • show_arrow (bool, optional) – Show or not the arrow, by default True

  • arrow_size (float, optional) – Vector’s arrow size, by default 0.2

class lib.Qgps.GPStools(gps_data_path)[source]

Bases: object

Methods

create_datetime_array(timestamp[, utc_offset])

Datetime array.

datetime_to_index(datetime, observation_date)

Datetime to index.

extract_gps_data(gps_data)

Extract GPS data.

get_gps_data(gps_data_path)

GPS Data.

get_observation_indices(datetime, ...)

Observation indices.

plot_gps_angles([index_start, index_stop])

Plot GPS angles.

plot_gps_data([index_start, index_stop, ...])

Plot GPS data.

plot_gps_data_plotly([index_start, ...])

Plot GPS data using Plotly.

plot_gps_position_vector([index_start, ...])

Plot GPS position vector.

read_gps_bindat(gps_data_path[, verbosity])

GPS binary data.

create_datetime_array(timestamp, utc_offset=0)[source]

Datetime array.

Build datetime array from timestamp data. We can convert them to any time zone using utc_offset parameter.

Parameters:
  • timestamp (array_like) – Timestamp data.

  • utc_offset (int, optional) – UTC offset for any time zone in hours, by default 0

Returns:

datetime – Datetime array.

Return type:

array_like

datetime_to_index(datetime, observation_date)[source]

Datetime to index.

Method to find the data index associated to a chosen date.

Parameters:
  • datetime (datetime) – Datetime array.

  • date (str or datetime) – Chosen date, either in the form of a string (‘year-month-dayThour:minute:second’) or a datetime isoformat object.

Returns:

date_index – Index associated to the chosen date.

Return type:

int

Raises:
  • TypeError – Raise TypeError if the chosen date is not in the form of a string or a datetime object.

  • IndexError – Raise ValueError if the chosen date is not in the data.

extract_gps_data(gps_data)[source]

Extract GPS data.

Method to extract the GPS data from the dictionary and convert them in proper units. It also converts the Down data into Up coordinates (usual vectical axis in cartesian coordinates).

Parameters:

gps_data (dict) – Dictionary containing the GPS data.

get_gps_data(gps_data_path)[source]

GPS Data.

Method used to build the dictionnary that contains the GPS Data, either by converting the binary file or by using the given dictionary.

Parameters:

gps_data_path (string or dict) – Path of the GPS binary file or dictionary containing the GPS data.

Returns:

gps_data – Dictionary containing the GPS data.

Return type:

dict

Raises:

ValueError – If the GPS data file does not exist.

get_observation_indices(datetime, observation_date)[source]

Observation indices.

Return the indices associated to the chosen date. If date.shape is 1, the method returns a unique index associated to the chosen date. If date.shape is 2, the method returns the indices associated to the chosen date range.

Parameters:
  • datetime (datetime) – Datetime array.

  • date (array_like) – Array of dates, either a single date or a date range, in str or datetime format.

Returns:

observation_indices – Array containing the indices associated to the observation date(s).

Return type:

array_like

Raises:

ValueError – Raise ValueError if the date does not have the proper shape, 1 or 2.

plot_gps_angles(index_start=0, index_stop=-1)[source]

Plot GPS angles.

Plot the roll and yaw angles.

Parameters:
  • index_start (int, optional) – First observation index, by default 0

  • index_stop (int, optional) – Last observation index, by default -1

plot_gps_data(index_start=0, index_stop=-1, position_limit=None, angle_limit=None)[source]

Plot GPS data.

Plot the position vector and the angles.

Parameters:
  • index_start (int, optional) – First observation index, by default 0

  • index_stop (int, optional) – Last observation index, by default -1

plot_gps_data_plotly(index_start=0, index_stop=-1, position_limit=None, angle_limit=None)[source]

Plot GPS data using Plotly.

This function creates an interactive plot with two y-axes: - Primary y-axis: Position vector components (North, East, Up). - Secondary y-axis: Angles (Roll, Yaw).

Parameters:
  • index_start (int, optional) – First observation index (default is 0)

  • index_stop (int, optional) – Last observation index (default is -1)

  • position_limit (tuple of float, optional) – Y-axis limits for position components (min, max)

  • angle_limit (tuple of float, optional) – Y-axis limits for angles (min, max)

plot_gps_position_vector(index_start=0, index_stop=-1)[source]

Plot GPS position vector.

Plot the position vector of the antenna in the North, East and Up directions.

Parameters:
  • index_start (int, optional) – First observation index, by default 0

  • index_stop (int, optional) – Last observation index, by default -1

read_gps_bindat(gps_data_path, verbosity=0)[source]

GPS binary data.

Method to convert the binary data acquired from by RTK simple broadcast into readable format and store them in a dictionary.

Parameters:

gps_data_path (str) – GPS file path.

Returns:

dat – Dictionary containing the GPS data.

Return type:

dict

Raises:

ValueError – If the file is not found.