From 807b0af22b796674971d58bbb9ff689fb19771cc Mon Sep 17 00:00:00 2001 From: David Hensle Date: Fri, 15 Dec 2023 16:40:26 -0800 Subject: [PATCH] Alt name for jtfc estimation mode --- .../abm/models/joint_tour_frequency_composition.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/activitysim/abm/models/joint_tour_frequency_composition.py b/activitysim/abm/models/joint_tour_frequency_composition.py index cfd04a19c..be52c900a 100644 --- a/activitysim/abm/models/joint_tour_frequency_composition.py +++ b/activitysim/abm/models/joint_tour_frequency_composition.py @@ -55,9 +55,11 @@ def joint_tour_frequency_composition( model_settings_file_name, ) + # FIXME setting index as "alt" causes crash in estimation mode... alts = simulate.read_model_alts( - state, "joint_tour_frequency_composition_alternatives.csv", set_index="alt" + state, "joint_tour_frequency_composition_alternatives.csv", set_index=None ) + alts.index = alts["alt"].values # - only interested in households with more than one cdap travel_active person and # - at least one non-preschooler @@ -116,7 +118,6 @@ def joint_tour_frequency_composition( estimator.write_model_settings(model_settings, model_settings_file_name) estimator.write_coefficients(coefficients_df, model_settings) estimator.write_choosers(choosers) - estimator.write_alternatives(alts) assert choosers.index.name == "household_id" assert "household_id" not in choosers.columns @@ -124,6 +125,9 @@ def joint_tour_frequency_composition( estimator.set_chooser_id(choosers.index.name) + # FIXME set_alt_id - do we need this for interaction_simulate estimation bundle tables? + estimator.set_alt_id("alt_id") + # The choice value 'joint_tour_frequency_composition' assigned by interaction_simulate # is the index value of the chosen alternative in the alternatives table. choices = interaction_simulate( @@ -157,6 +161,7 @@ def joint_tour_frequency_composition( # - but we don't know the tour participants yet # - so we arbitrarily choose the first person in the household # - to be point person for the purpose of generating an index and setting origin + # FIXME: not all models are guaranteed to have PNUM temp_point_persons = persons.loc[persons.PNUM == 1] temp_point_persons["person_id"] = temp_point_persons.index temp_point_persons = temp_point_persons.set_index("household_id")