data_tools.lap_tools.collect_lap_data#
- data_tools.lap_tools.collect_lap_data(query_func: Callable, client: InfluxDBClient, include_day_2=False, verbose=False) ndarray#
Higher order function - computes query_func for each lap in FSGP 2024 and returns the resulting array.
Set include_day_2 to True to include the day 2 laps, which were driven slowly & under heavy rain.
Example usage:
```python from data_tools.collections import collect_lap_data, TimeSeries from data_tools.query import DBClient import datetime import numpy as np
- def get_average_speed(start_time: datetime.datetime, end_time: datetime.datetime, data_client: DBClient):
lap_speed: TimeSeries = data_client.query_time_series(start_time, end_time, “VehicleVelocity”) return np.mean(lap_speed)
client = InfluxDBClient()
average_speeds = collect_lap_data(get_average_speed, client) ```
- Parameters:
query_func (Callable) – must take in parameters (lap_start: datetime, lap_end:datetime, data_client:InfluxDBClient)
client (InfluxDBClient) – client to use for querying
include_day_2 – flag to include the three day 2 laps, driven slowly & under heavy rain
verbose – if True, print out queried data during execution
- Returns:
a NumPy ndarray of query_func results for all laps