lair.transects.split_transits#

lair.transects.split_transits(time, s, max_gap_s=600.0, reversal_m=500.0, min_span_m=1000.0)[source]#

Cut a platform’s along-route coordinate into one-way transits.

s is the along-route position of each sample (metres; NaN where the sample is not on this route) and time is sorted. A transit ends

  • at a time gap longer than max_gap_s (overnight, or the record stops), or

  • at a reversal of the direction of travel: a turning point of s with prominence of at least reversal_m (scipy.signal.find_peaks on s and on -s). GPS jitter and short shunts stay inside a transit; a turnaround at a terminus does not. A dwell at the terminus is cut at its middle, between the arriving and the departing transit (trim it with max_dwell_s in transect_matrix()).

Transits covering less than min_span_m of route are discarded.

Returns (transit, table): transit is the transit index per sample (-1 for samples not in a kept transit) and table has one row per transit, indexed by that number: direction (+1 with increasing s, -1 against it), t_start, t_end (POSIX s), s_min, s_max and n samples.

Parameters:
Return type:

tuple[ndarray, DataFrame]