PyRidy API
OSM
OSM
- class OSM(bbox: List[Union[List, float, float64]], desired_railway_types: Optional[Union[List, str]] = None, download: bool = True, recurse: str = '>')
- Parameters
bbox (List[List, float]) – Single bounding box or list of bounding boxes of which OSM data should be downloaded. In case of a list of bounding boxes data will be downloaded for each single bounding box and finally unified to a single result. Each bounding box must have the format lon_sw, lat_sw, lon_ne, lat_ne
desired_railway_types (List[str] or str) – Railway type that should be queried. Can be ‘rail’, ‘tram’, ‘subway’ or ‘light_rail’
download (bool, default: True) – If True, starts downloading the OSM data
recurse (str, default: '>') – Type of recursion used on Overpass query. (Recurse up < or down >)
- Raises
ValueError – Raised if bounding boxes are empty, the bounding box is not a list with coordinates or list of bounding boxes, desired_railway_type is not supported or recurse type is invalid
- get_all_route_nodes() list
Retrieves a list of nodes part of any relation/route
- Return type
List[overpy.node]
- get_coords(frmt: str = 'lon/lat') ndarray
Get the coordinates in lon/lat format for all nodes
- Parameters
frmt (str, default: lon/lat) – Format in which the coordinates are being returned. Can be lon/lat or x/y
- Return type
np.ndarray
- Raises
ValueError – Raised when format is not lon/lat or xy
- get_level_crossings() List[OSMRailwayElement]
Returns a list of railway level crossings found in the downloaded OSM region
- Returns
List of railway level crossings
- Return type
- get_live_overpass_api_instances()
The function returns live instances by testing the connection to the api_instances’ list.
- Returns
live_instances – A list of current live instances.
- Return type
- get_milestones() List[OSMRailwayElement]
Returns a list of railway milestones found in the downloaded OSM region
- Returns
List of railway milestones
- Return type
- get_railway_line(name) List[OSMRailwayLine]
Get railway line by name. Always returns a list, even if only one line is found that matches the name
- Parameters
name (str) – Name of the railway line that should be searched
- Returns
List of railway lines
- Return type
- get_shortest_path(source: int, target: int, weight: str, method='dijkstra') List[int]
Calculates the shortest path between a source and target node. Also considers how switches can be transited Based on: https://en.wikipedia.org/wiki/Dijkstra
- Parameters
- Returns
List of node ids that represent the shortest path between source and target
- Return type
List[int]
- Raises
ValueError – Raised when given method is not supported
- get_signals() List[OSMRailwayElement]
Returns a list of railway signals found in the downloaded OSM region
- Returns
list of railway signals
- Return type
- get_switches(line: Optional[OSMRailwayLine] = None) List[OSMRailwayElement]
Returns a list of railway switches found in the downloaded OSM region
- Parameters
line (OSMRailwayLine) –
- Returns
line_switches – list of railway switches found in the downloaded OSM region
- Return type
- get_switches_for_railway_line(line: OSMRailwayLine) List[OSMRailwaySwitch]
Get switches part of a given railway line
- Parameters
line (OSMRailwayLine) –
- Returns
line_switches – list of railway switches found in the downloaded OSM region
- Return type
- query_overpass(query: str, attempts: Optional[int] = None, overpass_instances: Optional[List[Overpass]] = None) Result
- reset_way_attributes()
Deletes all attributes of each way. E.g results are saved
- search_osm_result(way_ids: List[int], railway_type='tram')
Queries ways using their ids and railway type :param way_ids: List of IDs of ways. :type way_ids: List[int] :param railway_type: Type of railway. Defaults to ‘tram’ :type railway_type: str
- Returns
ways – The ways resulting from the query
- Return type
OSM Utils
Elements
- class OSMResultNode(lon: float, lat: float, value=None, f=None, proc=None, direction: str = '', color: Optional[str] = None)
Class representing a Node calculated by PyRidy
- class OSMResultWay
- class OSMRailwayElement(n: Node)
Abstract Base Class for railway elements retrieved from OpenStreetMap
- Parameters
n (overpy.Node) – OpenStreetMap node queried by Overpy
- class OSMLevelCrossing(n: Node)
Class representing railway level crossings
See https://wiki.openstreetmap.org/wiki/Tag:railway%3Dlevel_crossing for more information on available tags
- Parameters
n (overpy.Node) – OpenStreetMap Node retrieved using Overpy
- class OSMRailwayMilestone(n: Node)
Class representing railway milestones (turnouts)
- Parameters
n (overpy.Node) – OpenStreetMap node retrieved using Overpy
- Raises
ValueError – Error caused by unusual milestone position format
- class OSMRailwaySignal(n: Node)
Class representing railway signals
See https://wiki.openstreetmap.org/wiki/Tag:railway%3Dsignal for more information on available tags
- Parameters
n (overpy.Node) – OpenStreetMap node retrieved using Overpy
- class OSMRailwaySwitch(n: Node)
Class representing railway switches (turnouts)
- Parameters
n (overpy.Node) – OpenStreetMap node retrieved using Overpy
- class OSMRelation(relation: Relation, ways=None, color=None)
Class Representing an OpenStreetMap relation. A relation can represent multiple tracks in some cases
- Parameters
relation (overpy.Relation) – Relation between the ways
ways (List [overpy.Way]) – Ways part of the relation
color – Color when used to draw the track e.g. using ipyleaflet
- class OSMRailwayLine(relation: Relation, ways: Optional[List[Way]] = None, color=None)
Class representing a railway line. See https://wiki.openstreetmap.org/wiki/Tag:railway%3Drail
- Parameters
relation (overpy.Relation) – Relation between the ways
ways (list) – List of ways of the railway line
color – Color when used to draw the line e.g. using ipyleaflet
- Return type
None
- class OSMTrack(nodes: List[Node], ways: List[Way])
Represents a single railway track
- Parameters
- Return type
None
- flip_curvature()
Flips the calculated curvature upside down
- to_ipyleaflet()
Converts the coordinates to the format required by ipyleaflet for drawing
- Returns
coordinates – list of coordinates in ipyleaflet format
- Return type
- to_tuple_list(frmt: str = 'lon,lat')
Converts the coordinates to a list of tuples
- Parameters
frmt (str) – Format, lon,lat or x,y. Defaults to “lon,lat”
- Returns
coordinates – List of coordinates as tuples
- Return type
- Raises
ValueError – Error occurs if the format of coordinates is not supported
Overpass
- class Overpass(*args, session: Optional[Session] = None, **kwargs)
Extend overpy.Overpass to use requests. This allows to use requests-cache for caching. Based on https://github.com/DinoTools/python-overpy/blob/5343e743e87c117531f1e321a424911ff4cee8cf/overpy/__init__.py (April 2021)
Initialise an overpy.Overpass instance and a session :param args: :param session: :param kwargs:
- parse_response(content_type: str, response)
Parse raw response from Overpass service
- Parameters
content_type (str) – Type of response (application/json or application/osm3s+xml)
response – Raw JSON or XML Data
- Returns
result – Parsed result
- Return type
Overpy.Result
- Raises
overpy.exception.OverpassUnknownContentType – Raised if the reported content type isn’t handled by OverPy
- request(query: Union[bytes, str]) Result
Query the Overpass API using requests
- Parameters
- Returns
content_type (str) – Type of response application/json or application/osm3s+xml
response – Raw JSON or XML Data
- Raises
overpy.exception.OverpassUnknownContentType – Raised if the reported content type isn’t handled by OverPy
overpy.exception.OverpassBadRequest – Raised if the Overpass API service returns a syntax error
overpy.exception.OverpassTooManyRequests – Raised if the Overpass API service returns a 429 status code
overpy.exception.OverpassGatewayTimeout – Raised if load of the Overpass API service is too high and it can’t handle the request
overpy.exception.OverpassUnknownHTTPStatusCode – Raised if the returned HTTP status code isn’t handled by OverPy
overpy.exception.MaxRetriesReached – Raised if max retries reached and the Overpass server didn’t respond with a result
Query
Tools
- boxes_to_edges(boxes)
Source: https://stackoverflow.com/questions/4842613/merge-lists-that-share-common-elements treat l as a Graph and returns it’s edges to_edges([‘a’,’b’,’c’,’d’]) -> [(a,b), (b,c),(c,d)]
- Parameters
boxes (list) – List of boxes to form edges for
- Yields
last – From-element of the edge
current – To-element of the edge
- bspline(cv, n=10000, degree=3, periodic=False)
Calculate n samples on a bspline
- calc_angle_between(v1: Union[list, ndarray], v2: Union[list, ndarray]) ndarray
Returns the angle in radians between vectors v1 and v2
- calc_curvature(x: List[float], y: List[float]) List[float]
Calculates the Menger curvature for a set of coordinates
- Parameters
- Returns
coordinates – List of Menger curvature of the coordinates
- Return type
- Raises
ValueError – Raised if x and y are not of same length
- calc_distance_from_lon_lat(lon: List[float], lat: List[float])
Computes pairwise and total distance using geodesic distance of individual lat/lon coordinates
- Parameters
- Returns
pairwise distance (list) – Pairwise of individual lat/lon coordinates
total distance (list) – Total distance using geodesic distance of individual lat/lon coordinates
- Raises
ValueError – Raised if x and y are not of same length
- calc_distance_from_xy(x: List[float], y: List[float]) Tuple[list, list]
Computes distances between a set of x y coordinates as well as the total distance
- Parameters
- Returns
distances – List containing total distance, list of pairwise distances
- Return type
- Raises
ValueError – Raised if x and y are not of same length:
- calc_unit_vector(v: Union[list, ndarray]) ndarray
Returns the unit vector of the given vector v
- Parameters
v (Union[np.ndarray, list]) – Vector of which the unit vector should be calculated
- Returns
unit vector – Unit vector of the input vector
- Return type
np.ndarray
- convert_lon_lat_to_xy(lon: List[float], lat: List[float], adjust_zero_point: bool = False)
Convert lon/lat coordinates to a metric coordinate system. The first coordinate is used for zero-point in the metric coordinate system
- convert_way_to_line_string(w: Way, frmt: str = 'lon,lat') LineString
Converts a way to LineString; one-dimensional figure comprising one or more line segments
- Parameters
w (overpy.Way) – The way to be converted
frmt (str) – The location’s format. Defaults to “lon,lat”
- Returns
linestring – A one-dimensional figure comprising one or more line segments
- Return type
LineString
- Raises
ValueError – Raised if the format is unknown
- haversine(lon1: float, lat1: float, lon2: float, lat2: float) float
Calculate the great circle distance in kilometers between two points on the earth (specified in decimal degrees) Source: https://stackoverflow.com/questions/4913349/haversine-formula-in-python-bearing-and-distance-between-two-gps-points
- iou(b1: List[float], b2: List[float])
Calculates the Intersection over Union metric for two bounding boxes Each box must be of form x_min, y_min, x_max, y_max
- is_point_within_line_projection(line: Union[ndarray, list], point: Union[ndarray, list]) bool
Checks whether a given point line projection falls within the points that define the line
- Parameters
- Returns
inline – Tells if point is one of the points that define the line or not
- Return type
- overlap(b1: List[float], b2: List[float], thres: float = 0.8) bool
Check whether two bounding boxes have an overlap larger than thres Each box must be of form x_min, y_min, x_max, y_max
- project_point_onto_line(line: Union[ndarray, list], point: Union[ndarray, list]) tuple
Returns a tuple with the point where the orthogonal projections of the given points intersects the given line and secondly the (perpendicular) distance to this point
- Parameters
- Returns
point_distance – The point where the orthogonal projections of the given points intersects the given line and the (perpendicular) distance to this point
- Return type
- Raises
ValueError – Raised if the given line consists of two identical points.
Processor
Comfort Processor
- class ComfortProcessor(campaign: Campaign, f_s: int = 200, v_thres: float = 0, method='EN12299', osm_integration=True)
The Comfort processor can process acceleration data of a campaign according to the EN 12299 standard and Wz (Sperling-Index) Method.
- Parameters
campaign (pyridy.Campaign) – An object used to import and evaluate several measurements made using Ridy.
f_s (int) – Sample rate, as ordinary frequency [Hz]. Defaults to 200.
v_thres (float) – Threshold velocity. Defaults to 0.
method (str) – Standard to process acceleration data. Defaults to the EN 12299 standard.
- Raises
ValueError – Raised if method is not supported (“EN1299” or “Wz”)
NotImplementedError – Raised if WZ method is passed as method
- static Wd(f_s: int)
Calculates the frequency weighting filter Wb in both longitudinal and lateral direction
- static calc_comfort_en12999(acc_x: ndarray, acc_y: ndarray, acc_z: ndarray, f_s: int)
Static method that works purely with numpy arrays for optional use on non campaign like data
- Parameters
acc_x (np.ndarray) – Acceleration according to x-axis.
acc_y (np.ndarray) – Acceleration according to y-axis.
acc_z (np.ndarray) – Acceleration according to z-axis.
f_s (int) – Sample rate, as ordinary frequency [Hz]. Defaults to 200.
- Returns
n_mv (ndarray) – Mean comfort index Nmv
t (ndarray) – Array of timestamps
cc_x (ndarray) – Continuous comfort index according to x-axis
cc_y (ndarray) – Continuous comfort index according to y-axis
cc_z (ndarray) – Continuous comfort index according to z-axis
- create_map(use_file_color=False) Map
Creates a pyridy.widgets Map showing the GPS tracks of measurement files and adds the nodes to the map.
- Parameters
use_file_color (bool) – Defaults to False.
- Returns
m – The created map
- Return type
pyridy.widgets Map
- execute()
Executes the Comfort Processor on the given axes
Condition Processor
- class ConditionProcessor(thres_lo: float = 0, thres_hi: float = 0, v_thres: float = 1.0, sampling_period: str = '1000ms')
Class representing the Track condition based on a RDYFile containing measurements of a track
- Parameters
- process_file(file: RDYFile, method='acc') DataFrame
Class representing the Track condition based on a RDYFile containing measurements of a track.
- Parameters
- Returns
df_merged – Dataframe containing merged dataframes
- Return type
pd.DataFrame
- Raises
ValueError – Raised if method is not supported (‘acc’, ‘velocity’ or ‘comfort’)
Excitation Processor
- class ExcitationProcessor(campaign: Campaign, f_s: int = 200, f_c: float = 1, order: int = 4, p_thres: float = 0.025, p_dist: int = 50, osm_integration=True)
The ExcitationProcessor performs a double integration of the acceleration data to calculate excitations. High-Pass Filters are applied to remove static offset and drift. Hence, the resulting excitations only represent high-frequent excitations but no quasi-static movements
- Parameters
campaign (Campaign) – The measurement campaign on which the ExcitationProcessor should be applied. Results are saved directly in the campaign.
f_s (int, default: 200) – Sampling frequency to be used.
f_c (float, default: 1) – Cut-Off frequency for the high-pass filter
order (int, default: 4) – Order of the high-pass filter
p_thres (float, default .025) – Peak detection threshold
p_dist (int, default 50) – Peak detection distance
osm_integration (bool, default True) – If True, integrate results into OSM nodes
- create_map(use_file_color=False) Map
Creates a pyridy.widgets Map showing the GPS tracks of measurement files and adds the nodes to the map.
- Parameters
use_file_color (bool) –
False. (Defaults to) –
- Returns
m – Created map
- Return type
pyridy.widgets Map
Utils
Device
- class Device(api_level: Union[int, Series] = - 1, base_os: Union[str, Series] = 'N/A', brand: Union[str, Series] = 'N/A', manufacturer: Union[str, Series] = 'N/A', device: Union[str, Series] = 'N/A', product: Union[str, Series] = 'N/A', model: Union[str, Series] = 'N/A', gnss_hardware_model_name: Union[str, Series] = 'N/A', gnss_year_of_hardware: Union[int, Series] = - 1)
Class representing Android device information
- Parameters
api_level (Union[int, Series]) – Identifies the framework API revision offered by a version of the Android platform.
base_os (Union[int, Series]) – The base OS build the product is based on.
brand (Union[int, Series]) – The consumer-visible brand with which the product/hardware
manufacturer (Union[int, Series]) – The manufacturer of the product/hardware.
device (Union[int, Series]) –
product (Union[int, Series]) – The name of the overall product.
model (Union[int, Series]) – The end-user-visible name for the end product.
gnss_hardware_model_name (Union[int, Series]) – The exact GNSS hardware in-use in the device.
gnss_year_of_hardware (Union[int, Series]) – The year of manufacture of GNSS hardware in-use.
Sensor
- class Sensor(name: Optional[str] = None, vendor: Optional[str] = None, string_type: Optional[str] = None, power: Optional[float] = None, resolution: Optional[float] = None, version: Optional[int] = None, type: Optional[int] = None, max_delay: Optional[int] = None, max_range: Optional[float] = None, min_delay: Optional[int] = None)
Class that describes an Android sensor
See https://developer.android.com/reference/android/hardware/Sensor for documentation on individual parameters
- Parameters
name (str) – Sensor’s name.
vendor (str) – Vendor string of the sensor.
string_type (str) – A constant string describing the sensor’s type.
power (float) – The power in mA used by this sensor while in use.
resolution (float) – Resolution of the sensor in the sensor’s unit.
version (int) – Version of the sensor’s module.
type (int) – Generic type of this sensor.
max_delay (int) – The delay between two sensor events corresponding to the lowest frequency that this sensor supports.
max_range (int) – Maximum range of the sensor in the sensor’s unit.
min_delay (int) – The minimum delay allowed between two events in microseconds or zero if this sensor only returns a value when the data it’s measuring changes.
Series
- class TimeSeries(**kwargs)
Abstract Baseclass representing TimeSeries like measurements
- Parameters
kwargs –
- cut(start: float = 0, end: float = 0, inplace: bool = True)
Cuts off seconds after start and before end
- Parameters
- Returns
time_series_copy – A copy of the timeseries without the interval
- Return type
- get_duration() float
Calculates the duration of the TimeSeries in seconds
- Returns
duration – Duration of the TimeSeries
- Return type
- get_sample_rate() float
Calculates the sample rate of the TimeSeries
- Returns
sample_rate – Sample rate of the TimeSeries
- Return type
- get_sub_series_names() list
Returns names of subseries (e.g., acc_x, acc_y, acc_z)
- Returns
names – List of subseries’ names
- Return type
- is_empty() bool
Checks whether the TimeSeries contains any values
- Returns
empty – True if Timeseries is empty else False
- Return type
- synchronize(method: str, sync_timestamp: Union[int, int64] = 0, sync_time: datetime64 = numpy.datetime64('1970-01-01T00:00:00'), timedelta_unit='timedelta64[ns]')
- Parameters
- Raises
ValueError – Raised if method is not supported or sync_time’s type is not compatible with given method
- to_df() DataFrame
Converts the Series to a Pandas DataFrame
- Returns
pd.DataFrame – Dataframe containing series measurements
- Return type
Pandas DataFrame
- class AccelerationSeries(time: Optional[Union[list, ndarray]] = None, acc_x: Optional[Union[list, ndarray]] = None, acc_y: Optional[Union[list, ndarray]] = None, acc_z: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing acceleration values See https://developer.android.com/guide/topics/sensors/sensors_overview for more information on Android sensors
- Parameters
time (Union [list, np.ndarray]) – Series’ timestamps.
acc_x (Union [list, np.ndarray]) – Acceleration according to x-axis.
acc_y (Union [list, np.ndarray]) – Acceleration according to y-axis.
acc_z (Union [list, np.ndarray]) – Acceleration according to z-axis.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class AccelerationUncalibratedSeries(time: Optional[Union[list, ndarray]] = None, acc_uncal_x: Optional[Union[list, ndarray]] = None, acc_uncal_y: Optional[Union[list, ndarray]] = None, acc_uncal_z: Optional[Union[list, ndarray]] = None, acc_uncal_x_bias: Optional[Union[list, ndarray]] = None, acc_uncal_y_bias: Optional[Union[list, ndarray]] = None, acc_uncal_z_bias: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing uncalibrated acceleration values
- Parameters
time (Union [list, np.ndarray]) – Series’ timestamps.
acc_uncal_x (Union [list, np.ndarray]) – Uncalibrated acceleration according to x-axis without any bias compensation.
acc_uncal_y (Union [list, np.ndarray]) – Uncalibrated acceleration according to y-axis without any bias compensation.
acc_uncal_z (Union [list, np.ndarray]) – Uncalibrated acceleration according to z-axis without any bias compensation.
acc_uncal_x_bias (Union [list, np.ndarray]) – Measured acceleration along the x-axis with estimated bias compensation.
acc_uncal_y_bias (Union [list, np.ndarray]) – Measured acceleration along the y-axis with estimated bias compensation.
acc_uncal_z_bias (Union [list, np.ndarray]) – Measured acceleration along the z-axis with estimated bias compensation.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class LinearAccelerationSeries(time: Optional[Union[list, ndarray]] = None, lin_acc_x: Optional[Union[list, ndarray]] = None, lin_acc_y: Optional[Union[list, ndarray]] = None, lin_acc_z: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '', **kwargs)
Series containing linear acceleration values (i.e. without g)
- Parameters
time (Union [list, np.ndarray]) – Series’ timestamps.
lin_acc_x (Union [list, np.ndarray]) – Linear acceleration force along x-axis.
lin_acc_y (Union [list, np.ndarray]) – Linear acceleration force along y-axis.
lin_acc_z (Union [list, np.ndarray]) – Linear acceleration force along z-axis.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class MagnetometerSeries(time: Optional[Union[list, ndarray]] = None, mag_x: Optional[Union[list, ndarray]] = None, mag_y: Optional[Union[list, ndarray]] = None, mag_z: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing magnetic field values
- Parameters
time (Union [list, np.ndarray]) – Series’ timestamps.
mag_x (Union [list, np.ndarray]) – Geomagnetic field strength according to x-axis.
mag_y (Union [list, np.ndarray]) – Geomagnetic field strength according to y-axis.
mag_z (Union [list, np.ndarray]) – Geomagnetic field strength according to z-axis.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class MagnetometerUncalibratedSeries(time: Optional[Union[list, ndarray]] = None, mag_uncal_x: Optional[Union[list, ndarray]] = None, mag_uncal_y: Optional[Union[list, ndarray]] = None, mag_uncal_z: Optional[Union[list, ndarray]] = None, mag_uncal_x_bias: Optional[Union[list, ndarray]] = None, mag_uncal_y_bias: Optional[Union[list, ndarray]] = None, mag_uncal_z_bias: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing uncalibrated magnetic field values
- Parameters
time (Union [list, np.ndarray]) – Series’ timestamps.
mag_uncal_x (Union [list, np.ndarray]) – Geomagnetic field strength (without hard iron calibration) along the x-axis.
mag_uncal_y (Union [list, np.ndarray]) – Geomagnetic field strength (without hard iron calibration) along the y-axis.
mag_uncal_z (Union [list, np.ndarray]) – Geomagnetic field strength (without hard iron calibration) along the z-axis.
mag_uncal_x_bias (Union [list, np.ndarray]) – Iron bias estimation along the x-axis.
mag_uncal_y_bias (Union [list, np.ndarray]) – Iron bias estimation along the y-axis.
mag_uncal_z_bias (Union [list, np.ndarray]) – Iron bias estimation along the z-axis.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class NMEAMessageSeries(time: Optional[Union[list, ndarray]] = None, utc_time: Optional[Union[list, ndarray]] = None, msg: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing raw NMEA strings from GNSS chipset See https://www.wikiwand.com/en/NMEA_0183 for more information on NMEA messages
- Parameters
time (Union [list, np.ndarray]) – Series’ timestamps.
utc_time (Union [list, np.ndarray]) – Time of the observation, UTC time zone.
msg (Union [list, np.ndarray]) – NMEA message from GNSS chipset
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class GNSSClockMeasurementSeries(time: Optional[Union[list, ndarray]] = None, bias_nanos: Optional[Union[list, ndarray]] = None, bias_uncertainty_nanos: Optional[Union[list, ndarray]] = None, drift_nanos_per_second: Optional[Union[list, ndarray]] = None, drift_uncertainty_nanos_per_second: Optional[Union[list, ndarray]] = None, elapsed_realtime_nanos: Optional[Union[list, ndarray]] = None, elapsed_realtime_uncertainty_nanos: Optional[Union[list, ndarray]] = None, full_bias_nanos: Optional[Union[list, ndarray]] = None, hardware_clock_discontinuity_count: Optional[Union[list, ndarray]] = None, leap_second: Optional[Union[list, ndarray]] = None, reference_carrier_frequency_hz_for_isb: Optional[Union[list, ndarray]] = None, reference_code_type_for_isb: Optional[Union[list, ndarray]] = None, reference_constellation_type_for_isb: Optional[Union[list, ndarray]] = None, time_nanos: Optional[Union[list, ndarray]] = None, time_uncertainty_nanos: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing raw GNSS clock values See https://developer.android.com/reference/android/location/GnssClock for more information on individual parameters
- Parameters
time (Union [list, np.ndarray]:) – Timeseries’s timestamps
bias_nanos (Union [list, np.ndarray]) – The clock’s sub-nanosecond bias.
bias_uncertainty_nanos (Union [list, np.ndarray]) – The clock’s Bias Uncertainty (1-Sigma) in nanoseconds.
drift_nanos_per_second (Union [list, np.ndarray]) – The clock’s Drift in nanoseconds per second.
drift_uncertainty_nanos_per_second (Union [list, np.ndarray]) – The clock’s Drift Uncertainty (1-Sigma) in nanoseconds per second.
elapsed_realtime_nanos (Union [list, np.ndarray]) – The elapsed real-time of this clock since system boot, in nanoseconds.
elapsed_realtime_uncertainty_nanos (Union [list, np.ndarray]) – The estimate of the relative precision of the alignment of the elapsed_realtime_nanos timestamp.
full_bias_nanos (Union [list, np.ndarray]) – The difference between hardware clock inside GPS receiver and the true GPS time.
hardware_clock_discontinuity_count (Union [list, np.ndarray]) – Count of hardware clock discontinuities.
leap_second (Union [list, np.ndarray]) – The leap second associated with the clock’s time
reference_carrier_frequency_hz_for_isb (Union [list, np.ndarray]) – The reference carrier frequency in Hz for inter-signal bias.
reference_code_type_for_isb (Union [list, np.ndarray]) – The reference code type for inter-signal bias.
reference_constellation_type_for_isb (Union [list, np.ndarray]) – The reference constellation type for inter-signal bias.
time_nanos (Union [list, np.ndarray]) – The GNSS receiver internal hardware clock value in nanoseconds.
time_uncertainty_nanos (Union [list, np.ndarray]) – The clock’s time Uncertainty (1-Sigma) in nanoseconds.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class GNSSMeasurementSeries(time: Optional[Union[list, ndarray]] = None, accumulated_delta_range_meters: Optional[Union[list, ndarray]] = None, accumulated_delta_range_state: Optional[Union[list, ndarray]] = None, accumulated_delta_range_uncertainty_meters: Optional[Union[list, ndarray]] = None, automatic_gain_control_level_db: Optional[Union[list, ndarray]] = None, baseband_cn0DbHz: Optional[Union[list, ndarray]] = None, carrier_cycles: Optional[Union[list, ndarray]] = None, carrier_frequency_hz: Optional[Union[list, ndarray]] = None, carrier_phase: Optional[Union[list, ndarray]] = None, carrier_phase_uncertainty: Optional[Union[list, ndarray]] = None, cn0DbHz: Optional[Union[list, ndarray]] = None, code_type: Optional[Union[list, ndarray]] = None, constellation_type: Optional[Union[list, ndarray]] = None, full_inter_signal_bias_nanos: Optional[Union[list, ndarray]] = None, full_inter_signal_bias_uncertainty_nanos: Optional[Union[list, ndarray]] = None, multipath_indicator: Optional[Union[list, ndarray]] = None, pseudorange_rate_meters_per_second: Optional[Union[list, ndarray]] = None, pseudorange_rate_uncertainty_meters_per_second: Optional[Union[list, ndarray]] = None, received_sv_time_nanos: Optional[Union[list, ndarray]] = None, received_sv_time_uncertainty_nanos: Optional[Union[list, ndarray]] = None, satellite_inter_signal_bias_nanos: Optional[Union[list, ndarray]] = None, satellite_inter_signal_bias_uncertainty_nanos: Optional[Union[list, ndarray]] = None, snrInDb: Optional[Union[list, ndarray]] = None, state: Optional[Union[list, ndarray]] = None, svid: Optional[Union[list, ndarray]] = None, time_offset_nanos: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing raw GNSS measurements See https://developer.android.com/reference/android/location/GnssMeasurement for more information on specific values
- Parameters
time (Union [list, np.ndarray]) – Series’s timestamps.
accumulated_delta_range_meters (Union [list, np.ndarray]) – The accumulated delta range since the last channel reset, in meters.
accumulated_delta_range_state (Union [list, np.ndarray]) – The state (availability of the value) of the accumulated_delta_range_meters measurement.
accumulated_delta_range_uncertainty_meters (Union [list, np.ndarray]) – The accumulated delta range’s uncertainty (1-Sigma) in meters.
automatic_gain_control_level_db (Union [list, np.ndarray]) – The Automatic Gain Control level in dB.
baseband_cn0DbHz (Union [list, np.ndarray]) – The baseband carrier-to-noise density in dB-Hz. Typical range: 10-50 dB-Hz.
carrier_cycles (Union [list, np.ndarray]) – The number of full carrier cycles between the satellite and the receiver.
carrier_frequency_hz (Union [list, np.ndarray]) – The carrier frequency of the tracked signal.
carrier_phase (Union [list, np.ndarray]) – The RF phase detected by the receiver. Range: [0.0, 1.0].
carrier_phase_uncertainty (Union [list, np.ndarray]) – The carrier-phase’s uncertainty (1-Sigma).
cn0DbHz (Union [list, np.ndarray]) – The Carrier-to-noise density in dB-Hz.
code_type (Union [list, np.ndarray]) – The GNSS measurement’s code type.
constellation_type (Union [list, np.ndarray]) – The constellation type.
full_inter_signal_bias_nanos (Union [list, np.ndarray]) – The GNSS measurement’s inter-signal bias in nanoseconds with sub-nanosecond accuracy.
full_inter_signal_bias_uncertainty_nanos (Union [list, np.ndarray]) – The GNSS measurement’s inter-signal bias uncertainty (1 sigma) in nanoseconds with sub-nanosecond accuracy.
multipath_indicator (Union [list, np.ndarray]) – Values indicating the ‘multipath’ state of the event.
pseudorange_rate_meters_per_second (Union [list, np.ndarray]) – The Pseudorange rate at the timestamp in m/s.
pseudorange_rate_uncertainty_meters_per_second (Union [list, np.ndarray]) – The pseudorange’s rate uncertainty (1-Sigma) in m/s.
received_sv_time_nanos (Union [list, np.ndarray]) – The received GNSS satellite time, at the measurement time, in nanoseconds.
received_sv_time_uncertainty_nanos (Union [list, np.ndarray]) – The error estimate (1-sigma) for the received GNSS time, in nanoseconds.
satellite_inter_signal_bias_nanos (Union [list, np.ndarray]) – The GNSS measurement’s satellite inter-signal bias in nanoseconds with sub-nanosecond accuracy.
satellite_inter_signal_bias_uncertainty_nanos (Union [list, np.ndarray]) – The GNSS measurement’s satellite inter-signal bias uncertainty (1 sigma) in nanoseconds with sub-nanosecond accuracy.
snrInDb (Union [list, np.ndarray]) – The (post-correlation & integration) Signal-to-Noise ratio (SNR) in dB.
state (Union [list, np.ndarray]) – The per-satellite-signal sync state.
svid (Union [list, np.ndarray]) – The satellite ID.
time_offset_nanos (Union [list, np.ndarray]) – The time offset at which the measurement was taken in nanoseconds.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class OrientationSeries(time: Optional[Union[list, ndarray]] = None, azimuth: Optional[Union[list, ndarray]] = None, pitch: Optional[Union[list, ndarray]] = None, roll: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing orientation values
- Parameters
time (Union [list, np.ndarray]) – Series’s timestamps.
azimuth (Union [list, np.ndarray]) – Azimuth (angle around the z-axis).
pitch (Union [list, np.ndarray]) – Pitch (angle around the x-axis).
roll (Union [list, np.ndarray]) – Roll (angle around the y-axis).
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class GyroSeries(time: Optional[Union[list, ndarray]] = None, w_x: Optional[Union[list, ndarray]] = None, w_y: Optional[Union[list, ndarray]] = None, w_z: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing gyro values
- Parameters
time (Union [list, np.ndarray]) – Series’s timestamps.
w_x (Union [list, np.ndarray]) – Rate of rotation around x-axis.
w_y (Union [list, np.ndarray]) – Rate of rotation around y-axis.
w_z (Union [list, np.ndarray]) – Rate of rotation around z-axis.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class GyroUncalibratedSeries(time: Optional[Union[list, ndarray]] = None, w_uncal_x: Optional[Union[list, ndarray]] = None, w_uncal_y: Optional[Union[list, ndarray]] = None, w_uncal_z: Optional[Union[list, ndarray]] = None, w_uncal_x_bias: Optional[Union[list, ndarray]] = None, w_uncal_y_bias: Optional[Union[list, ndarray]] = None, w_uncal_z_bias: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing uncalibrated gyro values
- Parameters
time (Union [list, np.ndarray]) – Series’s timestamps.
w_uncal_x (Union [list, np.ndarray]) – Rate of rotation (without drift compensation) around x-axis.
w_uncal_y (Union [list, np.ndarray]) – Rate of rotation (without drift compensation) around y-axis.
w_uncal_z (Union [list, np.ndarray]) – Rate of rotation (without drift compensation) around z-axis.
w_uncal_x_bias (Union [list, np.ndarray]) – Estimated drift around the x-axis.
w_uncal_y_bias (Union [list, np.ndarray]) – Estimated drift around the y-axis.
w_uncal_z_bias (Union [list, np.ndarray]) – Estimated drift around the z-axis.
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class RotationSeries(time: Optional[Union[list, ndarray]] = None, rot_x: Optional[Union[list, ndarray]] = None, rot_y: Optional[Union[list, ndarray]] = None, rot_z: Optional[Union[list, ndarray]] = None, cos_phi: Optional[Union[list, ndarray]] = None, heading_acc: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing rotation values
- Parameters
time (Union [list, np.ndarray]) – Series timestamps.
rot_x (Union [list, np.ndarray]) – Rotation vector component along the x-axis.
rot_y (Union [list, np.ndarray]) – Rotation vector component along the y-axis.
rot_z (Union [list, np.ndarray]) – Rotation vector component along the y-axis.
cos_phi (Union [list, np.ndarray]) – Scalar component of the rotation vector.
heading_acc (Union [list, np.ndarray]) – Heading accuracy
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class GPSSeries(time: Optional[Union[list, ndarray]] = None, lat: Optional[Union[list, ndarray]] = None, lon: Optional[Union[list, ndarray]] = None, altitude: Optional[Union[list, ndarray]] = None, bearing: Optional[Union[list, ndarray]] = None, speed: Optional[Union[list, ndarray]] = None, hor_acc: Optional[Union[list, ndarray]] = None, ver_acc: Optional[Union[list, ndarray]] = None, bear_acc: Optional[Union[list, ndarray]] = None, speed_acc: Optional[Union[list, ndarray]] = None, utc_time: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing GPS values
- Parameters
time (Union [list, np.ndarray]) – Series’s timestamps.
lat (Union [list, np.ndarray]) – The latitude in degrees.
lon (Union [list, np.ndarray]) – The longitude in degrees.
altitude (Union [list, np.ndarray]) – The altitude of this location in meters
bearing (Union [list, np.ndarray]) – The bearing at the time of this location in degrees.
speed (Union [list, np.ndarray]) – The speed at the time of this location in meters per second.
hor_acc (Union [list, np.ndarray]) – The estimated horizontal accuracy radius in meters of this location.
ver_acc (Union [list, np.ndarray]) – The estimated altitude accuracy in meters of this location.
bear_acc (Union [list, np.ndarray]) – The estimated bearing accuracy in degrees of this location.
speed_acc (Union [list, np.ndarray]) – The estimated speed accuracy in meters per second of this location
utc_time (Union [list, np.ndarray]) – UTC-Time received by GPS, accurate to 1 s
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class PressureSeries(time: Optional[Union[list, ndarray]] = None, pressure: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing the ambient air pressure and the timestamps
- class TemperatureSeries(time: Optional[Union[list, ndarray]] = None, temperature: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing ambient temperature and the corresponding timestamps
- class HumiditySeries(time: Optional[Union[list, ndarray]] = None, humidity: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series contaning the ambient relative humidity and the corresponding timestamps
- class LightSeries(time: Optional[Union[list, ndarray]] = None, light: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing the light measurements and the corresponding timestamps
- class WzSeries(time: Optional[Union[list, ndarray]] = None, wz_x: Optional[Union[list, ndarray]] = None, wz_y: Optional[Union[list, ndarray]] = None, wz_z: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Based on the Sperling’s ride index to determine ride Comfort
- Parameters
time (Union [list, np.ndarray]) – Series’s timestamps.
wz_x (Union [list, np.ndarray]) – Sperling’s ride index in y direction
wz_y (Union [list, np.ndarray]) – Sperling’s ride index in y direction
wz_z (Union [list, np.ndarray]) – Sperling’s ride index in y direction
rdy_format_version (float) – File format version
filename (str) – Ridy File’s name containing measurements
- class SubjectiveComfortSeries(time: Optional[Union[list, ndarray]] = None, comfort: Optional[Union[list, ndarray]] = None, rdy_format_version: Optional[float] = None, filename: str = '')
Series containing the subjective comfort measurements and their timestamps
Tools
- create_map_circle(lat: float, lon: float, color='green', radius: int = 2)
Creates an ipyleaflet circle marker
- generate_random_color(color_format: str = 'RGB') Union[list, str]
Generates random color based on the given format RGB or HEX
- Parameters
color_format (str) – Color format of the generated color, either “RGB” or “HEX”. RGB values range from 0 to 255. Defaults to “RGB”
- Returns
color – Randomly generated colors
- Return type
- Raises
ValueError – Raised if color format is not supported (‘RGB’ or ‘HEX’)
- internet(host='8.8.8.8', port=53, timeout=None)
Function that returns True if an internet connection is available, False if otherwise
- Parameters
- Returns
connection – Set to True if internet connection is available
- Return type
- requires_internet(func)
Decorator for functions that require internet
- Parameters
func (func) – Function that requires an active internet connection
- Raises
ConnectionError – Raised if there is no internet connection
- test_connection_to_url(url, timeout=None)
Tests if there is connection to the provided URL
Widgets
Map
- class Map(**kwargs: Any)
extends the map widget from ipyleaflet with functions to populate the map with campaign data
Public constructor
- add_measurement(file: RDYFile, t_lim: Optional[Tuple[datetime64, datetime64]] = None, show_hor_acc: bool = False) Optional[LayerGroup]
Adds a GPS track from a file to the Map
- Parameters
t_lim (tuple, default: None) – Time limit as a tuple of np.datetime64 to show only parts of the GPS track that are within the specified time interval
file (RDYFile) – Alternatively, provide RDYFile that should be drawn on the map
show_hor_acc (bool, default: False) – If true shows the horizontal accuracies for each measurement point using circles. The likelihood that that the real position is within the circle is defined as 68 %
- Returns
The measurement layer
- Return type
Layer instance
- add_measurements(campaign: Campaign) Union[None, List[LayerGroup]]
Add all GPS tracks from the campaign files to a Map
- Parameters
campaign (pyridy.Campaign) – pyridy Campaign
- Returns
measurement_layers – Group of layers containing the measurements
- Return type
List[LayerGroup]
- add_osm_railway_elements(campaign: Campaign) LayerGroup
Draws railway elements using markers on top of a map
- Parameters
campaign (pyridy.Campaign) – campaign whose railway elements should be drawn
- Returns
railway_elements
- Return type
LayerGroup instance
- add_osm_routes(campaign: Campaign) Union[None, LayerGroup]
Adds OSM Routes from the downloaded OSM Region
- Parameters
campaign (pyridy.Campaign) – campaign whose route details
- Returns
railway_lines_layer
- Return type
LayerGroup instance
- add_results(nodes: List[OSMResultNode], use_file_color=False)
Draws the resulting nodes on the map
- Parameters
nodes (List[OSMResultNode]) – List of resulting nodes
use_file_color (bool) – Defines whether to use the file or node color
- Return type
None
- add_results_from_campaign(campaign: Campaign, use_file_color=False)
Gets the results from a campaign and draws the nodes on the map
- Parameters
campaign (pyridy.Campaign) – The campaign to get the result nodes from
use_file_color (bool, default: False) – Defines whether to use the file color or not
- Return type
None
- refresh_controls()
The controls refresh themselves automatically; no need to do this manually
Campaign
- class Campaign(name='', folder: Optional[Union[list, str]] = None, recursive=True, exclude: Optional[Union[list, str]] = None, sync_method: str = 'timestamp', timedelta_unit: str = 'timedelta64[ns]', strip_timezone: bool = True, trim_ends: bool = True, lat_sw: Optional[float] = None, lon_sw: Optional[float] = None, lat_ne: Optional[float] = None, lon_ne: Optional[float] = None, download_osm_data: bool = False, map_matching: bool = False, osm_recurse_type: str = '>', railway_types: Optional[Union[list, str]] = None, series: Optional[Union[List[Type[TimeSeries]], Type[TimeSeries]]] = None)
- Parameters
name (str) – Name of the campaign
folder (Union[list, str]) – Folder or list of folders that should be imported
recursive (bool, default: True) – Flag if folders should be searched recursively
exclude (Union[list, str]) – Name(s) of file or folder that should be excluded
sync_method (str) – Method to use to sync timestamps of individual files
strip_timezone (bool, default: True) – Strips timezone from timestamps as np.datetime64 does not support timezones
trim_ends (bool, default: True) – If True, cutoffs the measurements precisely to the timestamp when the measurement was started, respectively stopped. By default, Ridy measurement files can contain several seconds of measurements from before/after the button press
lat_sw (float) – South west Latitude of the campaign, if the geographic extent is not given via arguments, the library tries to determine the geographic extent based on the GPS tracks
lon_sw (float) – South west longitude of the campaign
lat_ne (float) – North east latitude of the campaign
lon_ne (float) – North east longitude of the campaign
download_osm_data (bool, default: False) – If True download OSM data via the Overpass API
map_matching (bool, default: False) – If True removes tries to match GPS track of each file to most reasonable OSM nodes
railway_types (list or list of str) – Railway type to be downloaded from OSM, e.g., “rail”, “subway”, “tram” or “light_rail”
osm_recurse_type (str) – Recurse type to be used when querying OSM data using the overpass API
series (Union[List[Type[TimeSeries]], Type[TimeSeries]]) – Classes of TimeSeries to load, if None all TimeSeries of each file will be imported
- clear_files()
Clear all files from the campaign
- create_map(center: Tuple[float, float] = None, show_gps_tracks=True, show_railway_elements=False) Map
Creates a pyridy.widgets Map (based on ipyleaflet) showing the GPS tracks of measurement files
- Parameters
- Returns
Map – Created map
- Return type
pyridy.widgets.Map
- determine_bounding_boxes(simplify=True, plot=False)
Determine bounding boxes of files and stores them in self.bboxs.
- determine_geographic_center() Tuple[float, float]
Determines the geographic center of the campaign.
- Returns
Center – Geographic center of the campaign
- Return type
- Raises
ValueError – An error occurred determining the geographic center.
- determine_geographic_extent()
Determines the geographic extent of the campaign in terms of min/max lat/lon
- Return type
None
- do_map_matching(rematch=False, **kwargs)
Performs map matching for all files in campaign
- Parameters
rematch (Bool, default: False) – If True performs map matching again, even when file already contains a map matching
- Return type
None
- Raises
RuntimeError – An error occurred matching maps
- download_osm_data(railway_types: Optional[Union[list, str]] = None, osm_recurse_type: str = '>')
Downloads the OSM data and
- group_by(key)
Group Ridy files by given key, grouped files can be accessed through the grouped_files attributes
- Parameters
key (Any) – Key that should be used to group files
- import_files(file_paths: Optional[Union[list, str]] = None, sync_method: str = 'timestamp', timedelta_unit: str = 'timedelta64[ns]', trim_ends: bool = True, strip_timezone: bool = True, det_geo_extent: bool = True, use_multiprocessing: bool = False, download_osm_data: bool = False, railway_types: Optional[Union[list, str]] = None, osm_recurse_type: Optional[str] = None, series: Optional[Union[List[Type[TimeSeries]], Type[TimeSeries]]] = None)
Import files into the campaign
- Parameters
file_paths (Union[list, str]) – Individual file paths of the files that should be imported
sync_method (str) – Method to use for timestamp syncing
timedelta_unit (str , default: 'timedelta64[ns]') – Timedelta unit for timestamp sync method
trim_ends (bool, default: True) – If True, trims measurement precisely to timestamp when the measurement was started respectively stopped
strip_timezone (bool, default: True) – If True, strips timezone from timestamp arrays
det_geo_extent (bool, default: True) – If True, determine the geographic extent of the imported files
use_multiprocessing (bool, default: True) – If True, uses multiprocessing to import Ridy files
download_osm_data (bool, default: False) – If True, download OSM Data via the Overpass API
railway_types (str or list of str) – Railway types to be downloaded via the Overpass API
osm_recurse_type (str) – Recurse type to be used when querying OSM data using the overpass API
series (Union[List[Type[TimeSeries]], Type[TimeSeries]]) – Classes of TimeSeries to load, if None all TimeSeries of each file will be imported
- Raises
TypeError – Occurs if path’s arguments are not of type str or list of str
ValueError – Error if the series is not of type Timeseries or if series’ arguments ar not valid
- import_folder(folder: Optional[Union[list, str]] = None, recursive: bool = True, exclude: Optional[Union[list, str]] = None, **kwargs)
Imports folder(s) into the campaign
- Parameters
- Raises
TypeError – Occurs if folder’s arguments are not of type str or list of str
- simplify_bounding_boxes()
Unify bounding boxes with a large overlap to reduce number of queries. Cluster boxes by overlap
- Return type
None
File
- class RDYFile(path: str = '', sync_method: str = 'timestamp', trim_ends: bool = True, timedelta_unit: str = 'timedelta64[ns]', strip_timezone: bool = True, filename='', series: Optional[Union[List[Type[TimeSeries]], Type[TimeSeries]]] = None, color: Optional[str] = None)
- Parameters
path (str) – Path to the Ridy File
sync_method (str) – Sync method to be applied
trim_ends (bool, default: True) – If True, trims the measurements precisely to the timestamp when the measurement was started, respectively stopped. By default Ridy measurement files can contain several seconds of measurements from before/after the button press
timedelta_unit (str) – NumPy timedelta unit to be applied
strip_timezone (bool, default: True) – Strips timezone from timestamps as np.datetime64 does not support timezones
filename (str) – Name of the files, will be the filename if not provided
series (Union[List[Type[TimeSeries]], Type[TimeSeries]]) – Classes of TimeSeries to load, if None all TimeSeries of each file will be imported
color (str) – Color
- create_map(t_lim: Optional[Tuple[datetime64, datetime64]] = None, show_hor_acc: bool = False) Map
Creates an ipyleaflet Map using OpenStreetMap and OpenRailwayMap to show the GPS track of the measurement file
- Parameters
t_lim (tuple, default: None) – time limit as a tuple of np.datetime64 to show only parts of the GPS track that are within the specified time interval
show_hor_acc (bool, default: False) – If true shows the horizontal accuracies for each measurement point using circles. The likelihood that the real position is within the circle is defined as 68 %
- Returns
Map – Created map
- Return type
ipyleaflet.Map
- determine_track_center(gps_series: ~typing.Optional[~pyridy.utils.timeseries.GPSSeries] = None) -> (<class 'float'>, <class 'float'>)
Determines the geographical center of the GPSSeries, returns None if the GPSSeries is emtpy
- Parameters
gps_series (GPSSeries, default: None) – If not None, takes the given GPSSeries to determine the track center
- Returns
center_longitude (float) – Longitude of the GPSSeries’ center
center_latitude (float) – Latitude of the GPSSeries’ center
- do_map_matching(v_thres: float = 1.0, algorithm: str = 'nx', alpha: int = 1.0, beta: int = 1.0)
Performs map matching of the GPS track to closest OSM nodes/ways
- Parameters
alpha (float, default: 1.0) – Weighting Parameter for the Map Matching Algorithm. Alpha represents the default lange of an edge in the Graph
beta (float, default: 1.0) – Beta is a scaling factor for the emission probabilities.
algorithm (str, default: nx) – Algorithm to be used, can be “pyridy” or “nx”. The pyridy algorithm also incorporates how switches can be transited
v_thres (float, default: 1.0) – Speed threshold, GPS points measured with a velocity below v_thres [m/s] will not be considered
- Raises
ValueError – Error occurs when Algorithm is neither nx nor pyridy
- get_integrity_report()
Returns a dict that contains information which measurement types are available in the file
- Returns
report – Dict with measurement types that are available in the file
- Return type