helper_func module¶
- helper_func.activity_colors(list_act: List = None, palette: str = 'colorblind') List[source]¶
Match each activity from list to a color from the input palette. Useful to keep consistent colors across visualizations
Parameters:¶
list_act: list of activity all_labels
palette; name of matplotlib/searborn color palette.
- helper_func.discretize_sched(schedule: DataFrame, block_size: float = 0.5) Dict[source]¶
Discretizes given schedule in blocks of size (duration) n
Parameters:¶
-schedule: schedule as a pandas dataframe -block_size: discretization in hours
- rtype:
Schedule as a dictionary, where keys are the chosen discretization.
- helper_func.generate_discret_sched(block_size: float = 0.25, list_act: List | None = None) Dict[source]¶
Returns a random 24h schedule discretized in blocks of size (duration) n
Parameters:¶
Block_size: expressed in hours
list_act: If a list of activities is passed, then all the activities of the list are scheduled. Otherwise,
schedules are generated randomly from the default list of activities.
Returns:¶
Random schedule as a dictionary
- helper_func.lookup_discret() DataFrame[source]¶
Precomputed table to convert one time discretisation to another.
- helper_func.parse_df_schedule(schedule: DataFrame, tt_mat: Dict | None = None) Schedule[source]¶
Transforms a pandas DataFrame schedule into a Schedule object.
Parameters:¶
schedule: dataframe schedule
tt_mat: travel time matrix
Returns:¶
Schedule object
- helper_func.parse_schedule(schedule: Dict) Schedule[source]¶
Transforms a dictionary schedule into a Schedule object.
Parameters:¶
schedule: dataframe schedule
tt_mat: travel time matrix
Returns:¶
Schedule object