def get_transit_events(self, start_time_ut=None, end_time_ut=None, route_type=None):
table_name = self._get_day_trips_table_name()<EOL>event_query = "<STR_LIT>""<STR_LIT>""<STR_LIT>" + table_name + "<STR_LIT:U+0020>""<STR_LIT>""<STR_LIT>""<STR_LIT>"<EOL>where_clauses = []<EOL>if end_time_ut:<EOL><INDENT>where_clauses.append(table_name + "<STR_LIT>".format(end_time_ut=end_time_ut))<EOL>where_clauses.append("<STR_LIT>".format(end_time_ut=end_time_ut))<EOL><DEDENT>if start_time_ut:<EOL><INDENT>where_clauses.append(table_name + "<STR_LIT>".format(start_time_ut=start_time_ut))<EOL>where_clauses.append("<STR_LIT>".format(start_time_ut=start_time_ut))<EOL><DEDENT>if route_type is not None:<EOL><INDENT>assert route_type in ALL_ROUTE_TYPES<EOL>where_clauses.append("<STR_LIT>".format(route_type=route_type))<EOL><DEDENT>if len(where_clauses) > <NUM_LIT:0>:<EOL><INDENT>event_query += "<STR_LIT>"<EOL>for i, where_clause in enumerate(where_clauses):<EOL><INDENT>if i is not <NUM_LIT:0>:<EOL><INDENT>event_query += "<STR_LIT>"<EOL><DEDENT>event_query += where_clause<EOL><DEDENT><DEDENT>event_query += "<STR_LIT>"<EOL>events_result = pd.read_sql_query(event_query, self.conn)<EOL>from_indices = numpy.nonzero(<EOL>(events_result['<STR_LIT>'][:-<NUM_LIT:1>].values == events_result['<STR_LIT>'][<NUM_LIT:1>:].values) *<EOL>(events_result['<STR_LIT>'][:-<NUM_LIT:1>].values < events_result['<STR_LIT>'][<NUM_LIT:1>:].values)<EOL>)[<NUM_LIT:0>]<EOL>to_indices = from_indices + <NUM_LIT:1><EOL>assert (events_result['<STR_LIT>'][from_indices].values == events_result['<STR_LIT>'][to_indices].values).all()<EOL>trip_Is = events_result['<STR_LIT>'][from_indices]<EOL>from_stops = events_result['<STR_LIT>'][from_indices]<EOL>to_stops = events_result['<STR_LIT>'][to_indices]<EOL>shape_ids = events_result['<STR_LIT>'][from_indices]<EOL>dep_times = events_result['<STR_LIT>'][from_indices]<EOL>arr_times = events_result['<STR_LIT>'][to_indices]<EOL>route_types = events_result['<STR_LIT>'][from_indices]<EOL>route_ids = events_result['<STR_LIT>'][from_indices]<EOL>route_Is = events_result['<STR_LIT>'][from_indices]<EOL>durations = arr_times.values - dep_times.values<EOL>assert (durations >= <NUM_LIT:0>).all()<EOL>from_seqs = events_result['<STR_LIT>'][from_indices]<EOL>to_seqs = events_result['<STR_LIT>'][to_indices]<EOL>data_tuples = zip(from_stops, to_stops, dep_times, arr_times,<EOL>shape_ids, route_types, route_ids, trip_Is,<EOL>durations, from_seqs, to_seqs, route_Is)<EOL>columns = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>df = pd.DataFrame.from_records(data_tuples, columns=columns)<EOL>return df<EOL>
Obtain a list of events that take place during a time interval.
Each event needs to be only partially overlap the given time interval.
Does not include walking events.

Parameters
----------
start_time_ut : int
    start of the time interval in unix time (seconds)
end_time_ut: int
    end of the time interval in unix time (seconds)
route_type: int
    consider only events for this route_type

Returns
-------
events: pandas.DataFrame
    with the following columns and types
        dep_time_ut: int
        arr_time_ut: int
        from_stop_I: int
        to_stop_I: int
        trip_I : int
        shape_id : int
        route_type : int

See also
--------
get_transit_events_in_time_span : an older version of the same thing