postprocessing

nomad.stop_detection.postprocessing.fill_timestamp_gaps(first_time, last_time, stop_table)[source]

Add unassigned intervals between timestamp-based stops.

nomad.stop_detection.postprocessing.merge_stops(stops, time_thresh=60, location_col=None, method='grid_based', algorithm=None, algorithm_kwargs=None, traj_cols=None, **kwargs)[source]

Merge consecutive stops at the same location.

Parameters:
  • stops (pd.DataFrame) – Ping or stop table containing time and location columns. Stop tables additionally contain an end time or duration. Rows must be ordered by their temporal column.

  • time_thresh (int, default 60) – Largest gap in minutes between one stop’s end and the next stop’s start that can belong to the same visit. For custom ping-table methods, a value in algorithm_kwargs takes precedence.

  • location_col (str, optional) – Location identifier column. Defaults to the location_id mapping in traj_cols.

  • method ({'grid_based', 'custom'}, default 'grid_based') – Stop-detection method used for a location-labeled ping table. This is ignored when stops is already a stop table.

  • algorithm (callable, optional) – Stop-detection callable required when method='custom'.

  • algorithm_kwargs (dict, optional) – Arguments for a custom stop-detection callable.

  • traj_cols (dict, optional) – Trajectory-column mappings.

  • **kwargs – Additional trajectory-column mappings.

Returns:

One row per uninterrupted visit.

Return type:

pd.DataFrame