From 0f8d9975df16c7c6ad036a83afe6b6ac5ab3edba Mon Sep 17 00:00:00 2001 From: JoeJimFlood Date: Sat, 25 Mar 2023 14:31:27 -0700 Subject: [PATCH 1/3] Moved 'tot_tours' from nonmandatory_tour_frequency.py to nonmandatory_tour_frequency_alternatives.csv --- .../models/non_mandatory_tour_frequency.py | 3 - ..._mandatory_tour_frequency_alternatives.csv | 194 ++++++++--------- ..._mandatory_tour_frequency_alternatives.csv | 194 ++++++++--------- ..._mandatory_tour_frequency_alternatives.csv | 194 ++++++++--------- ..._mandatory_tour_frequency_alternatives.csv | 200 +++++++++--------- ..._mandatory_tour_frequency_alternatives.csv | 194 ++++++++--------- ..._mandatory_tour_frequency_alternatives.csv | 194 ++++++++--------- 7 files changed, 585 insertions(+), 588 deletions(-) diff --git a/activitysim/abm/models/non_mandatory_tour_frequency.py b/activitysim/abm/models/non_mandatory_tour_frequency.py index 93b36b2f4..1d6493b66 100644 --- a/activitysim/abm/models/non_mandatory_tour_frequency.py +++ b/activitysim/abm/models/non_mandatory_tour_frequency.py @@ -151,12 +151,9 @@ def non_mandatory_tour_frequency(persons, persons_merged, chunk_size, trace_hh_i model_settings = config.read_model_settings(model_settings_file_name) - # FIXME kind of tacky both that we know to add this here and del it below - # 'tot_tours' is used in model_spec expressions alternatives = simulate.read_model_alts( "non_mandatory_tour_frequency_alternatives.csv", set_index=None ) - alternatives["tot_tours"] = alternatives.sum(axis=1) # filter based on results of CDAP choosers = persons_merged.to_frame() diff --git a/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_frequency_alternatives.csv b/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_frequency_alternatives.csv index b9765aa75..09e89fae3 100755 --- a/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_frequency_alternatives.csv +++ b/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_frequency_alternatives.csv @@ -1,97 +1,97 @@ -escort,shopping,othmaint,othdiscr,eatout,social -0,0,0,0,0,0 -0,0,0,1,0,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 +1,1,0,1,1,0,4 +1,1,0,0,1,1,4 +1,1,0,1,1,1,5 +1,1,1,0,0,0,3 +1,1,1,1,0,0,4 +1,1,1,0,0,1,4 +1,1,1,1,0,1,5 +1,1,1,0,1,0,4 +1,1,1,1,1,0,5 +1,1,1,0,1,1,5 +1,1,1,1,1,1,6 +2,0,0,0,0,0,2 +2,0,0,1,0,0,3 +2,0,0,0,0,1,3 +2,0,0,1,0,1,4 +2,0,0,0,1,0,3 +2,0,0,1,1,0,4 +2,0,0,0,1,1,4 +2,0,0,1,1,1,5 +2,0,1,0,0,0,3 +2,0,1,1,0,0,4 +2,0,1,0,0,1,4 +2,0,1,1,0,1,5 +2,0,1,0,1,0,4 +2,0,1,1,1,0,5 +2,0,1,0,1,1,5 +2,0,1,1,1,1,6 +2,1,0,0,0,0,3 +2,1,0,1,0,0,4 +2,1,0,0,0,1,4 +2,1,0,1,0,1,5 +2,1,0,0,1,0,4 +2,1,0,1,1,0,5 +2,1,0,0,1,1,5 +2,1,0,1,1,1,6 +2,1,1,0,0,0,4 +2,1,1,1,0,0,5 +2,1,1,0,0,1,5 +2,1,1,1,0,1,6 +2,1,1,0,1,0,5 +2,1,1,1,1,0,6 +2,1,1,0,1,1,6 +2,1,1,1,1,1,7 diff --git a/activitysim/examples/prototype_arc/configs/non_mandatory_tour_frequency_alternatives.csv b/activitysim/examples/prototype_arc/configs/non_mandatory_tour_frequency_alternatives.csv index b9765aa75..09e89fae3 100644 --- a/activitysim/examples/prototype_arc/configs/non_mandatory_tour_frequency_alternatives.csv +++ b/activitysim/examples/prototype_arc/configs/non_mandatory_tour_frequency_alternatives.csv @@ -1,97 +1,97 @@ -escort,shopping,othmaint,othdiscr,eatout,social -0,0,0,0,0,0 -0,0,0,1,0,0 -0,0,0,0,0,1 -0,0,0,1,0,1 -0,0,0,0,1,0 -0,0,0,1,1,0 -0,0,0,0,1,1 -0,0,0,1,1,1 -0,0,1,0,0,0 -0,0,1,1,0,0 -0,0,1,0,0,1 -0,0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,1,1,1,1,0,5 +1,1,1,0,1,1,5 +1,1,1,1,1,1,6 +2,0,0,0,0,0,2 +2,0,0,1,0,0,3 +2,0,0,0,0,1,3 +2,0,0,1,0,1,4 +2,0,0,0,1,0,3 +2,0,0,1,1,0,4 +2,0,0,0,1,1,4 +2,0,0,1,1,1,5 +2,0,1,0,0,0,3 +2,0,1,1,0,0,4 +2,0,1,0,0,1,4 +2,0,1,1,0,1,5 +2,0,1,0,1,0,4 +2,0,1,1,1,0,5 +2,0,1,0,1,1,5 +2,0,1,1,1,1,6 +2,1,0,0,0,0,3 +2,1,0,1,0,0,4 +2,1,0,0,0,1,4 +2,1,0,1,0,1,5 +2,1,0,0,1,0,4 +2,1,0,1,1,0,5 +2,1,0,0,1,1,5 +2,1,0,1,1,1,6 +2,1,1,0,0,0,4 +2,1,1,1,0,0,5 +2,1,1,0,0,1,5 +2,1,1,1,0,1,6 +2,1,1,0,1,0,5 +2,1,1,1,1,0,6 +2,1,1,0,1,1,6 +2,1,1,1,1,1,7 diff --git a/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_frequency_alternatives.csv b/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_frequency_alternatives.csv index b9765aa75..09e89fae3 100644 --- a/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_frequency_alternatives.csv +++ b/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_frequency_alternatives.csv @@ -1,97 +1,97 @@ -escort,shopping,othmaint,othdiscr,eatout,social -0,0,0,0,0,0 -0,0,0,1,0,0 -0,0,0,0,0,1 -0,0,0,1,0,1 -0,0,0,0,1,0 -0,0,0,1,1,0 -0,0,0,0,1,1 -0,0,0,1,1,1 -0,0,1,0,0,0 -0,0,1,1,0,0 -0,0,1,0,0,1 -0,0,1,1,0,1 -0,0,1,0,1,0 -0,0,1,1,1,0 -0,0,1,0,1,1 -0,0,1,1,1,1 -0,1,0,0,0,0 -0,1,0,1,0,0 -0,1,0,0,0,1 -0,1,0,1,0,1 -0,1,0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2,0,0,1,1,0,4 +2,0,0,0,1,1,4 +2,0,0,1,1,1,5 +2,0,1,0,0,0,3 +2,0,1,1,0,0,4 +2,0,1,0,0,1,4 +2,0,1,1,0,1,5 +2,0,1,0,1,0,4 +2,0,1,1,1,0,5 +2,0,1,0,1,1,5 +2,0,1,1,1,1,6 +2,1,0,0,0,0,3 +2,1,0,1,0,0,4 +2,1,0,0,0,1,4 +2,1,0,1,0,1,5 +2,1,0,0,1,0,4 +2,1,0,1,1,0,5 +2,1,0,0,1,1,5 +2,1,0,1,1,1,6 +2,1,1,0,0,0,4 +2,1,1,1,0,0,5 +2,1,1,0,0,1,5 +2,1,1,1,0,1,6 +2,1,1,0,1,0,5 +2,1,1,1,1,0,6 +2,1,1,0,1,1,6 +2,1,1,1,1,1,7 diff --git a/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_frequency_alternatives.csv b/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_frequency_alternatives.csv index 0bea47c6f..be633e649 100644 --- a/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_frequency_alternatives.csv +++ b/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_frequency_alternatives.csv @@ -1,100 +1,100 @@ -escort,shopping,othmaint,othdiscr,eatout,social -0,0,0,0,0,0 -0,0,0,1,0,0 -0,0,0,0,0,1 -0,0,0,1,0,1 -0,0,0,0,1,0 -0,0,0,1,1,0 -0,0,0,0,1,1 -0,0,0,1,1,1 -0,0,1,0,0,0 -0,0,1,1,0,0 -0,0,1,0,0,1 -0,0,1,1,0,1 -0,0,1,0,1,0 -0,0,1,1,1,0 -0,0,1,0,1,1 -0,0,1,1,1,1 -0,1,0,0,0,0 -0,1,0,1,0,0 -0,1,0,0,0,1 -0,1,0,1,0,1 -0,1,0,0,1,0 -0,1,0,1,1,0 -0,1,0,0,1,1 -0,1,0,1,1,1 -0,1,1,0,0,0 -0,1,1,1,0,0 -0,1,1,0,0,1 -0,1,1,1,0,1 -0,1,1,0,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+2,0,1,1,0,0,4 +2,0,1,0,0,1,4 +2,0,1,1,0,1,5 +2,0,1,0,1,0,4 +2,0,1,1,1,0,5 +2,0,1,0,1,1,5 +2,0,1,1,1,1,6 +2,1,0,0,0,0,3 +2,1,0,1,0,0,4 +2,1,0,0,0,1,4 +2,1,0,1,0,1,5 +2,1,0,0,1,0,4 +2,1,0,1,1,0,5 +2,1,0,0,1,1,5 +2,1,0,1,1,1,6 +2,1,1,0,0,0,4 +2,1,1,1,0,0,5 +2,1,1,0,0,1,5 +2,1,1,1,0,1,6 +2,1,1,0,1,0,5 +2,1,1,1,1,0,6 +2,1,1,0,1,1,6 +2,1,1,1,1,1,7 +# extension for flexible ids demonstration,,,,,,0 +# should be removed for actual model run,,,,,,0 +0,0,0,2,0,0,2 diff --git a/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_frequency_alternatives.csv b/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_frequency_alternatives.csv index b9765aa75..09e89fae3 100644 --- a/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_frequency_alternatives.csv +++ b/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_frequency_alternatives.csv @@ -1,97 +1,97 @@ -escort,shopping,othmaint,othdiscr,eatout,social -0,0,0,0,0,0 -0,0,0,1,0,0 -0,0,0,0,0,1 -0,0,0,1,0,1 -0,0,0,0,1,0 -0,0,0,1,1,0 -0,0,0,0,1,1 -0,0,0,1,1,1 -0,0,1,0,0,0 -0,0,1,1,0,0 -0,0,1,0,0,1 -0,0,1,1,0,1 -0,0,1,0,1,0 -0,0,1,1,1,0 -0,0,1,0,1,1 -0,0,1,1,1,1 -0,1,0,0,0,0 -0,1,0,1,0,0 -0,1,0,0,0,1 -0,1,0,1,0,1 -0,1,0,0,1,0 -0,1,0,1,1,0 -0,1,0,0,1,1 -0,1,0,1,1,1 -0,1,1,0,0,0 -0,1,1,1,0,0 -0,1,1,0,0,1 -0,1,1,1,0,1 -0,1,1,0,1,0 -0,1,1,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 +2,0,1,1,1,0,5 +2,0,1,0,1,1,5 +2,0,1,1,1,1,6 +2,1,0,0,0,0,3 +2,1,0,1,0,0,4 +2,1,0,0,0,1,4 +2,1,0,1,0,1,5 +2,1,0,0,1,0,4 +2,1,0,1,1,0,5 +2,1,0,0,1,1,5 +2,1,0,1,1,1,6 +2,1,1,0,0,0,4 +2,1,1,1,0,0,5 +2,1,1,0,0,1,5 +2,1,1,1,0,1,6 +2,1,1,0,1,0,5 +2,1,1,1,1,0,6 +2,1,1,0,1,1,6 +2,1,1,1,1,1,7 diff --git a/activitysim/examples/prototype_semcog/configs/non_mandatory_tour_frequency_alternatives.csv b/activitysim/examples/prototype_semcog/configs/non_mandatory_tour_frequency_alternatives.csv index b9765aa75..09e89fae3 100755 --- a/activitysim/examples/prototype_semcog/configs/non_mandatory_tour_frequency_alternatives.csv +++ b/activitysim/examples/prototype_semcog/configs/non_mandatory_tour_frequency_alternatives.csv @@ -1,97 +1,97 @@ -escort,shopping,othmaint,othdiscr,eatout,social -0,0,0,0,0,0 -0,0,0,1,0,0 -0,0,0,0,0,1 -0,0,0,1,0,1 -0,0,0,0,1,0 -0,0,0,1,1,0 -0,0,0,0,1,1 -0,0,0,1,1,1 -0,0,1,0,0,0 -0,0,1,1,0,0 -0,0,1,0,0,1 -0,0,1,1,0,1 -0,0,1,0,1,0 -0,0,1,1,1,0 -0,0,1,0,1,1 -0,0,1,1,1,1 -0,1,0,0,0,0 -0,1,0,1,0,0 -0,1,0,0,0,1 -0,1,0,1,0,1 -0,1,0,0,1,0 -0,1,0,1,1,0 -0,1,0,0,1,1 -0,1,0,1,1,1 -0,1,1,0,0,0 -0,1,1,1,0,0 -0,1,1,0,0,1 -0,1,1,1,0,1 -0,1,1,0,1,0 -0,1,1,1,1,0 -0,1,1,0,1,1 -0,1,1,1,1,1 -1,0,0,0,0,0 -1,0,0,1,0,0 -1,0,0,0,0,1 -1,0,0,1,0,1 -1,0,0,0,1,0 -1,0,0,1,1,0 -1,0,0,0,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4 +2,1,0,1,1,0,5 +2,1,0,0,1,1,5 +2,1,0,1,1,1,6 +2,1,1,0,0,0,4 +2,1,1,1,0,0,5 +2,1,1,0,0,1,5 +2,1,1,1,0,1,6 +2,1,1,0,1,0,5 +2,1,1,1,1,0,6 +2,1,1,0,1,1,6 +2,1,1,1,1,1,7 From b41800480ece6cb08f20b6497275d2f66004ee58 Mon Sep 17 00:00:00 2001 From: Jeff Newman Date: Wed, 7 Feb 2024 11:40:37 -0600 Subject: [PATCH 2/3] warnings on tot_tours --- .../models/non_mandatory_tour_frequency.py | 22 ++++++++++++++----- activitysim/abm/models/util/canonical_ids.py | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/activitysim/abm/models/non_mandatory_tour_frequency.py b/activitysim/abm/models/non_mandatory_tour_frequency.py index 54392445c..96986948f 100644 --- a/activitysim/abm/models/non_mandatory_tour_frequency.py +++ b/activitysim/abm/models/non_mandatory_tour_frequency.py @@ -3,18 +3,13 @@ from __future__ import annotations import logging +import warnings from pathlib import Path from typing import Any import numpy as np import pandas as pd -from activitysim.abm.models.util import annotate -from activitysim.abm.models.util.overlap import person_max_window -from activitysim.abm.models.util.school_escort_tours_trips import ( - recompute_tour_count_statistics, -) -from activitysim.abm.models.util.tour_frequency import process_non_mandatory_tours from activitysim.core import ( config, estimation, @@ -203,6 +198,21 @@ def non_mandatory_tour_frequency( alternatives = simulate.read_model_alts( state, "non_mandatory_tour_frequency_alternatives.csv", set_index=None ) + if "tot_tours" not in alternatives.columns: + # add a column for total tours + alternatives["tot_tours"] = alternatives.sum(axis=1) + warnings.warn( + "The 'tot_tours' column may not be automatically added in the future.", + FutureWarning, + ) + else: + # tot_tours already exists, check if it is consistent with legacy behavior + if not (alternatives["tot_tours"] == alternatives.sum(axis=1)).all(): + warnings.warn( + "The 'tot_tours' column in non_mandatory_tour_frequency_alternatives.csv " + "does not match the sum of the other columns.", + RuntimeWarning, + ) # filter based on results of CDAP choosers = persons_merged diff --git a/activitysim/abm/models/util/canonical_ids.py b/activitysim/abm/models/util/canonical_ids.py index 0ca1a1d3b..782828ca6 100644 --- a/activitysim/abm/models/util/canonical_ids.py +++ b/activitysim/abm/models/util/canonical_ids.py @@ -182,7 +182,7 @@ def determine_flavors_from_alts_file( flavors = { c: int(alts[c].max() + max_extension) for c in alts.columns - if all(alts[c].astype(str).str.isnumeric()) + if all(alts[c].astype(str).str.isnumeric()) and (c != "tot_tours") } valid_flavors = all( [(isinstance(flavor, str) & (num >= 0)) for flavor, num in flavors.items()] From 3d4dc354869b36b691fac633c230863bf4ec617e Mon Sep 17 00:00:00 2001 From: Jeff Newman Date: Wed, 7 Feb 2024 11:47:41 -0600 Subject: [PATCH 3/3] add back dropped imports --- activitysim/abm/models/non_mandatory_tour_frequency.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activitysim/abm/models/non_mandatory_tour_frequency.py b/activitysim/abm/models/non_mandatory_tour_frequency.py index 96986948f..53b1bbaed 100644 --- a/activitysim/abm/models/non_mandatory_tour_frequency.py +++ b/activitysim/abm/models/non_mandatory_tour_frequency.py @@ -10,6 +10,12 @@ import numpy as np import pandas as pd +from activitysim.abm.models.util import annotate +from activitysim.abm.models.util.overlap import person_max_window +from activitysim.abm.models.util.school_escort_tours_trips import ( + recompute_tour_count_statistics, +) +from activitysim.abm.models.util.tour_frequency import process_non_mandatory_tours from activitysim.core import ( config, estimation,