Skip to content

Filter reference

For filters, the Receives field in the function descriptions is used to document what columns are assumed to be in the DriveData objects processed by the filter.

FixReversedRoadLinearLand

FixReversedRoadLinearLand(drivedata: DriveData) -> DriveData

Fixes a section of reversed road in the LinearLand map

RoadOffset becomes -RoadOffset between XPos 700 and 900

Requires data columns
  • XPos: X position of ownship
  • RoadOffset: lateral distance on roadway

Returns:

Type Description
DriveData

Original DriveData object with altered RoadOffset column data

Jenks

Jenks(drivedata: DriveData, oldCol: str, newCol: str) -> DriveData

Classifies the given column using Jenks natural breaks and outputs a binary column.

Parameters:

Name Type Description Default
drivedata DriveData

The DriveData object containing the data.

required
oldCol str

The name of the column to classify (should be 'headPitch').

required
newCol str

The name of the new binary column to be created (e.g., 'hpBinary').

required

Returns:

Type Description
DriveData

Updated DriveData object with the new binary column.

SimTimeFromDatTime

SimTimeFromDatTime(drivedata: DriveData) -> DriveData

Copies DatTime to SimTime

Requires data columns
  • SimTime: simulation time = DatTime: time from simobserver recording start

Returns:

Type Description
DriveData

Original DriveData object with identical DatTime and SimTime

filterValuesBelow

filterValuesBelow(drivedata: DriveData, col: str, threshold=1) -> DriveData

Filters out device adjustemnt at the start. (Should filter out velocities below 1 m/s)

Params: col: The column to filter threshold: The value to filter above (1 m/s default)

numberBinaryBlocks

numberBinaryBlocks(
    drivedata: DriveData,
    binary_column="ButtonStatus",
    new_column="NumberedBlocks",
    only_on=0,
    limit_fill_null=700,
    extend_blocks=0,
) -> DriveData

Adds a column that separates data into blocks based on the value of another column

If only_on is set to 1, it filters the data to only include rows where binary_col is set to 1. If extend_blocks is set to 1, it extends the blocks.

Parameters:

Name Type Description Default
binary_column

The name of the column to reference

'ButtonStatus'
new_column

The name of the new column with blocks

'NumberedBlocks'
only_on

Determines whether to filter the data after adding blocks.

0
extend_blocks

Determines whether to extend the blocks.

0
limit_fill_null

Determines how many rows to fill using fill_null (only applies when extend_blocks is set to 1).

700

Returns:

Type Description
DriveData

Original drive data object augmented with new column

removeDataInside

removeDataInside(drivedata: DriveData, col: str, lower: float, upper: float) -> DriveData

Params: col: The name of the column to filter data lower: lower bound to filter upper: upper bound to filter

removeDataOutside

removeDataOutside(drivedata: DriveData, col: str, lower: float, upper: float) -> DriveData

Params: col: The name of the column to filter data lower: lower bound to filter upper: upper bound to filter

separateData

separateData(
    drivedata: DriveData, col: str, threshold: float, high: int = 1, low: int = 0
) -> DriveData

Categorizes head pitch data into high and low based on a manually defined threshold.

Params: col: The column containing head pitch values threshold: The value that separates high and low pitch high: Value assigned to "high" pitch (1) low: Value assigned to "low" pitch (0)

setinrange

setinrange(
    drivedata: DriveData,
    coltoset: str,
    valtoset: float,
    colforrange: str,
    rangemin: float,
    rangemax: float,
) -> DriveData

Set values of one column based on the values of another column

If the value of colforrange is outside the range of (rangemin, rangemax), then the value of coltoset will be unchanged. Otherwise, the value of coltoset will be changed to valtoset.

Parameters:

Name Type Description Default
coltoset str

The name of the column to modify

required
valtoset float

The new value to set for the

required
colforrange str

The name of the column to look up to decide to set a new value or not

required
rangemin float

Minimum value of the range

required
rangemax float

Maximum value of the range

required

Returns:

Type Description
DriveData

Original DriveData object with modified column

zscoreCol

zscoreCol(drivedata: DriveData, col: str, newcol: str) -> DriveData

Transform a column into a standardized z-score column

Parameters:

Name Type Description Default
col str

The name of the column to transform

required
newcol str

The name of the new z-score column

required

Returns:

Type Description
DriveData

Original DriveData object augmented with new z-score column