Data Preprocessing: (recursiveRouteChoice.data_processing)

file for processing matrices after they have been loaded from file, or generate by hand/ other means.

Currently just for processing angles

class recursiveRouteChoice.data_processing.AngleProcessor

Bases: object

classmethod get_left_turn_categorical_matrix(turn_angle_mat, left_turn_thresh=None, u_turn_thresh=None)

Assumes that angles are between -pi and pi

classmethod get_neutral_turn_categorical_matrix(turn_angle_mat, side_turn_thresh=None)

We assume that all zero angles are absent arcs, genuine zero angles should be encoded as near zero nonzero - i.e. 0.01 or as 2* Pi = 6.28 = 0 # IF this is not the case it should be handled otherwise first

Parameters:
  • turn_angle_mat

  • side_turn_thresh – left or right turn threshold, assumed to be symmetric

  • u_turn_thresh – u turn threshold angle in radians

classmethod get_right_turn_categorical_matrix(turn_angle_mat, right_turn_thresh=None, u_turn_thresh=None)

Assumes that angles are between -pi and pi

classmethod get_turn_categorical_matrices(turn_angles_cts, incidence_mat=None, u_turn_thresh=None, left_turn_thresh=None)
classmethod get_u_turn_categorical_matrix(turn_angle_mat, u_turn_thresh=None)

Assumes that angles are between -pi and pi

classmethod to_radians(angle_turn_mat)
recursiveRouteChoice.data_processing.get_incorrect_tien_turn_matrices(turn_angle_mat, left_turn_thresh=-0.5235987755833333, u_turn_thresh=3.089232775941667)

A function to generate the turn matrices equivalently tien mai code for comparison purposes, note that this is logically incorrect though. Deliberately copies confusing logic since it is trying to be consistent. Computes turn angles correctly in a convoluted way. Skips computing leftTurn since this is overridden to be an incidence matrix