Skip to content

Commit

Permalink
estimation mode tour checking
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensle committed Mar 28, 2024
1 parent 6fd0318 commit 8a9f772
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions activitysim/abm/models/non_mandatory_tour_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ def non_mandatory_tour_frequency(

locals_dict = {
"person_max_window": lambda x: person_max_window(state, x),
"person_available_periods": lambda x: person_available_periods(state, x),
"person_available_periods": lambda persons, start_bin, end_bin, continuous: person_available_periods(
state, persons, start_bin, end_bin, continuous
),
}

expressions.assign_columns(
Expand Down Expand Up @@ -425,14 +427,21 @@ def non_mandatory_tour_frequency(
if estimator:
# make sure they created the right tours
survey_tours = estimation.manager.get_survey_table("tours").sort_index()
# FIXME below check needs to remove the pure-escort tours from the survey tours table
# non_mandatory_survey_tours = survey_tours[
# survey_tours.tour_category == "non_mandatory"
# ]
# assert len(non_mandatory_survey_tours) == len(non_mandatory_tours)
# assert non_mandatory_survey_tours.index.equals(
# non_mandatory_tours.sort_index().index
# )
non_mandatory_survey_tours = survey_tours[
survey_tours.tour_category == "non_mandatory"
]
# need to remove the pure-escort tours from the survey tours table for comparison below
if state.is_table("school_escort_tours"):
non_mandatory_survey_tours = non_mandatory_survey_tours[
~non_mandatory_survey_tours.index.isin(
state.get_table("school_escort_tours").index
)
]

assert len(non_mandatory_survey_tours) == len(non_mandatory_tours)
assert non_mandatory_survey_tours.index.equals(
non_mandatory_tours.sort_index().index
)

# make sure they created tours with the expected tour_ids
columns = ["person_id", "household_id", "tour_type", "tour_category"]
Expand Down

0 comments on commit 8a9f772

Please sign in to comment.