def stringify_plans(
plans_path, simplify_pt_trips: bool = False, crop: bool = False, colour=True, width=101
):
print(f"Loading plan sequences from {plans_path}.")
encoder = PlansToCategorical(bin_size=int(86400 / width), duration=86400)
colourer = ActColour(colour=colour)
for person in stream_matsim_persons(plans_path, simplify_pt_trips=simplify_pt_trips, crop=crop):
apply_jitter_to_plan(
plan=person.plan, jitter=timedelta(minutes=30), min_duration=timedelta(minutes=5)
)
encoded = encoder.encode(person.plan)
string = stringify_plan(plan_array=encoded, mapping=encoder.index_to_act, colourer=colourer)
print(person.pid, string)
print()
print("Key:")
for act in encoder.act_to_index:
print(f"{colourer.paint(act, '▇▇▇▇▇▇▇▇▇▇')}: {act}")