Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions activitysim/abm/models/joint_tour_frequency_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ 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=None
state, "joint_tour_frequency_composition_alternatives.csv", set_index="alt"
)
alts.index = alts["alt"].values

# - only interested in households with more than one cdap travel_active person and
# - at least one non-preschooler
Expand Down
14 changes: 5 additions & 9 deletions activitysim/abm/models/school_escorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def create_school_escorting_bundles_table(choosers, tours, stage):
bundles["chauf_id"],
)

bundles["Alt"] = choosers["Alt"]
bundles["alt"] = choosers["alt"]
bundles["Description"] = choosers["Description"]

return bundles
Expand Down Expand Up @@ -412,11 +412,7 @@ def school_escorting(

trace_hh_id = state.settings.trace_hh_id

# FIXME setting index as "Alt" causes crash in estimation mode...
# happens in joint_tour_frequency_composition too!
# alts = simulate.read_model_alts(state, model_settings.ALTS, set_index="Alt")
alts = simulate.read_model_alts(state, model_settings.ALTS, set_index=None)
alts.index = alts["Alt"].values
alts = simulate.read_model_alts(state, model_settings.ALTS, set_index="alt")

choosers, participant_columns = determine_escorting_participants(
households_merged, persons, model_settings
Expand Down Expand Up @@ -565,10 +561,10 @@ def school_escorting(
)

if stage_num >= 1:
choosers["Alt"] = choices
choosers = choosers.join(alts.set_index("Alt"), how="left", on="Alt")
choosers["alt"] = choices
choosers = choosers.join(alts, how="left", on="alt")
bundles = create_school_escorting_bundles_table(
choosers[choosers["Alt"] > 1], tours, stage
choosers[choosers["alt"] > 1], tours, stage
)
escort_bundles.append(bundles)

Expand Down
15 changes: 15 additions & 0 deletions activitysim/core/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,22 @@ def read_model_alts(state: workflow.State, file_name, set_index=None):
file_path = state.filesystem.get_config_file_path(file_name)
df = pd.read_csv(file_path, comment="#")
if set_index:
if "Alt" in df.columns:
# Handle deprecated ALTS index
warnings.warn(
"Support for 'Alt' column name in alternatives files will be removed."
" Use 'alt' (lowercase) instead.",
DeprecationWarning,
)
# warning above does not actually output to logger, so also log it
logger.warning(
"Support for 'Alt' column name in alternatives files will be removed."
" Use 'alt' (lowercase) instead."
)
df.rename(columns={"Alt": "alt"}, inplace=True)

df.set_index(set_index, inplace=True)

return df


Expand Down
Binary file not shown.
8 changes: 8 additions & 0 deletions docs/dev-guide/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ branch (i.e., the main branch on GitHub), but not yet released in a stable versi
of ActivitySim. See below under the various version headings for changes in
released versions.

### Alternative file naming consistency

We have enforced a naming scheme for alternative config files to have the index name
be 'alt' instead of 'Alt'. This is to maintain consistency across all config files.
The code will handle this for you, but you will get a deprecation warning if you
are using 'Alt' in your config files. Please update your config files to use 'alt'.
See ActivitySim issue [#846](https://github.com/ActivitySim/activitysim/issues/846)

### CDAP Estimation Mode

A bug has been fixed in the Larch portion of code for the re-estimation of CDAP
Expand Down
Loading