The function counts stop departures: each stop_times entry with a
departure time is a departure from its stop, except for the entry of the
last stop of each trip (the one with the highest stop_sequence), from which
vehicles don't depart. Entries with blank departure times (such as those of
stops that are not timepoints) are not counted, so their times should be
interpolated beforehand to count them. A stop visited twice by the same trip
is counted twice. Its results are therefore not comparable to those of
get_route_frequency(), which counts trips.
The stop_times entries of trips listed in the frequencies table are just
templates: these trips depart every headway_secs from start_time until
(but not including) end_time, and each of these departures visits the
template's stops with the times shifted accordingly, as in
frequencies_to_stop_times(). Trips without any departure time in
stop_times don't generate departures. An error is raised if the
frequencies table has invalid entries for the trips that serve the
specified stops, even if they don't have any departure time.
The stops are those listed in stop_times, which are never stations. Use
get_children_stops() to get the stops of a station and sum their
departures.
A departure is counted when it happens at or after from and before to, so
that consecutive time windows (e.g. "06:00:00"-"07:00:00" and
"07:00:00"-"08:00:00") don't count the same departure twice. Please note
that this differs from filter_by_time_of_day(), which keeps entries whose
times are equal to to. Departures after midnight are listed with times
greater than "24:00:00" and belong to the previous service day, so a time
of day such as "24:00:00"-"26:00:00" should be used to account for them.
Times after midnight written as early morning times (e.g. "00:30:00"
instead of "24:30:00"), and end_times earlier than start_times in
frequencies, are first fixed with fix_overnight_times(), so these
departures are counted at their real times.
The mean headway is the length of the time of day divided by the number of
departures. It is an average over the whole time of day, so it is larger
than the actual headway when service starts or ends within it. Trips with an
NA direction_id are grouped together.