Skip to content

Commit 8b9df09

Browse files
Clint DanielsbstablerBlakeBlake Rosenthaltoliwaga
authored
Address Minor Issues Associated with ARC Update to Develop Branch (#342)
* publish v0.9.5 (#340) * update docs, drop scripts no longer needed, include example files in package * Pandas 1.0 fixes * Location and mode choice logsums (#298) * Tncs (#14) * write trip matrices (#311) * small fixes for semcog deployment (#319) * improved validation diagnostics in trip_purpose and various windows-related int32/int64 conversions * fix bug in handling of no viable trips case in choose_trip_destination * major work on phase 5 (#325) * estimation through atwork_subtour_mode_choice * Tnc updates and notebooks (#18) * move other resources into folder since examples now part of package as well * add example zone shapefile * estimation notebooks for larch (#19) * multiprocessing related logging and error checking * trip_destination handle all trips fail * skim caching with numpy memmap to speed skim loading * better chunking in vectorize_tour_scheduling * Cli (#22) * use activitysim_resources Fixed auto sufficiency conditions in tour_mode_choice.csv. (Issue #324) * correct write trip matrices sampling expansion and add vehicle occupancy to the expression file * additional updates for estimation integration (#328) * improve LICENSE (#30) * correct univ coeff template lookup (#28) Co-authored-by: Clint Daniels <clint.daniels@wsp.com> Co-authored-by: Blake <brosenthalpdx@gmail.com> Co-authored-by: Blake Rosenthal <blake.rosenthal@rsginc.com> Co-authored-by: Jeff Doyle <toliwaga@gmail.com> Co-authored-by: Jeffrey Doyle <jeff.doyle@rsginc.com> Co-authored-by: Jeffrey Newman <jeff@newman.me> * Remove duplicate coefficient. * move coefficient processing up * Update joint_tour_destination.py * Fix reference to joint tour destination.yaml * Error check for COEFFICIENT files * Add person_id to joint choosers. * move notebooks to examples folder so they are installed and update docs as a result (#343) * publish (#344) * move notebooks to examples folder so they are installed and update docs as a result (#343) * correct doc links * Remove duplicate coefficient. * move coefficient processing up * Update joint_tour_destination.py * Fix reference to joint tour destination.yaml * Error check for COEFFICIENT files * Add person_id to joint choosers. * Remove duplicate coefficient. * move coefficient processing up * Update joint_tour_destination.py * Fix reference to joint tour destination.yaml * Error check for COEFFICIENT files * Add person_id to joint choosers. Co-authored-by: Ben Stabler <bstabler@users.noreply.github.com> Co-authored-by: Blake <brosenthalpdx@gmail.com> Co-authored-by: Blake Rosenthal <blake.rosenthal@rsginc.com> Co-authored-by: Jeff Doyle <toliwaga@gmail.com> Co-authored-by: Jeffrey Doyle <jeff.doyle@rsginc.com> Co-authored-by: Jeffrey Newman <jeff@newman.me> Co-authored-by: bstabler <benstabler@yahoo.com>
1 parent 200485a commit 8b9df09

5 files changed

Lines changed: 21 additions & 12 deletions

File tree

activitysim/abm/models/joint_tour_destination.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ def joint_tour_destination(
326326
person that's making the tour)
327327
"""
328328

329-
trace_label = 'non_mandatory_tour_destination'
330-
model_settings_file_name = 'non_mandatory_tour_destination.yaml'
329+
trace_label = 'joint_tour_destination'
330+
model_settings_file_name = 'joint_tour_destination.yaml'
331331
model_settings = config.read_model_settings(model_settings_file_name)
332332

333333
logsum_column_name = model_settings.get('DEST_CHOICE_LOGSUM_COLUMN_NAME')

activitysim/abm/models/util/vectorize_tour_scheduling.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
7676
locals_dict.update(constants)
7777
locals_dict.update(skims)
7878

79+
# constrained coefficients can appear in expressions
80+
coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
81+
locals_dict.update(coefficients)
82+
7983
# - run preprocessor to annotate choosers
8084
# allow specification of alternate preprocessor for nontour choosers
8185
preprocessor = model_settings.get('LOGSUM_PREPROCESSOR', 'preprocessor')
@@ -92,17 +96,12 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
9296
trace_label=trace_label)
9397

9498
# - compute logsums
95-
96-
coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
9799
logsum_spec = simulate.read_model_spec(file_name=logsum_settings['SPEC'])
98100
logsum_spec = simulate.eval_coefficients(logsum_spec, coefficients, estimator=None)
99101

100102
nest_spec = config.get_logit_model_settings(logsum_settings)
101103
nest_spec = simulate.eval_nest_coefficients(nest_spec, coefficients)
102104

103-
# constrained coefficients can appear in expressions
104-
locals_dict.update(coefficients)
105-
106105
logsums = simulate.simple_simulate_logsums(
107106
choosers,
108107
logsum_spec,

activitysim/core/simulate.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ def read_model_coefficients(model_settings=None, file_name=None):
140140
file_name = model_settings['COEFFICIENTS']
141141

142142
file_path = config.config_file_path(file_name)
143-
coefficients = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
143+
try:
144+
coefficients = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
145+
except ValueError:
146+
logger.exception("Coefficient File Invalid: %s" % str(file_path))
147+
raise
144148

145149
return coefficients
146150

@@ -188,7 +192,11 @@ def read_model_coefficient_template(model_settings):
188192
coeffs_file_name = model_settings['COEFFICIENT_TEMPLATE']
189193

190194
file_path = config.config_file_path(coeffs_file_name)
191-
template = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
195+
try:
196+
template = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
197+
except ValueError:
198+
logger.exception("Coefficient Template File Invalid: %s" % str(file_path))
199+
raise
192200

193201
# by convention, an empty cell in the template indicates that
194202
# the coefficient name should be propogated to across all segments

activitysim/examples/example_mtc/configs/joint_tour_destination.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ SEGMENTS:
1010
- eatout
1111
- social
1212

13-
1413
SAMPLE_SIZE: 30
1514

15+
# we can't use use household income_segment as this will also be set for non-workers
16+
CHOOSER_SEGMENT_COLUMN_NAME: tour_type
17+
1618
SIMULATE_CHOOSER_COLUMNS:
1719
- tour_type
1820
- TAZ
19-
- household_id
21+
- person_id
2022

2123
LOGSUM_SETTINGS: tour_mode_choice.yaml
2224

activitysim/examples/example_mtc/configs/non_mandatory_tour_destination_coeffs.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ coef_mode_logsum,0.6755,F
33
coef_escort_dist_0_2,-0.1499,F
44
coef_eatout_dist_0_2,-0.5609,F
55
coef_eatout_social_0_2,-0.5609,F
6-
coef_eatout_dist_0_2,-0.7841,F
6+
#coef_eatout_dist_0_2,-0.7841,F
77
coef_othdiscr_dist_0_2,-0.1677,F
88
coef_escort_dist_2_5,-0.8671,F
99
coef_shopping_dist_2_5,-0.5655,F

0 commit comments

Comments
 (0)