Skip to content

Commit

Permalink
Address Minor Issues Associated with ARC Update to Develop Branch (#342)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
8 people authored Sep 16, 2020
1 parent 200485a commit 8b9df09
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions activitysim/abm/models/joint_tour_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ def joint_tour_destination(
person that's making the tour)
"""

trace_label = 'non_mandatory_tour_destination'
model_settings_file_name = 'non_mandatory_tour_destination.yaml'
trace_label = 'joint_tour_destination'
model_settings_file_name = 'joint_tour_destination.yaml'
model_settings = config.read_model_settings(model_settings_file_name)

logsum_column_name = model_settings.get('DEST_CHOICE_LOGSUM_COLUMN_NAME')
Expand Down
9 changes: 4 additions & 5 deletions activitysim/abm/models/util/vectorize_tour_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
locals_dict.update(constants)
locals_dict.update(skims)

# constrained coefficients can appear in expressions
coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
locals_dict.update(coefficients)

# - run preprocessor to annotate choosers
# allow specification of alternate preprocessor for nontour choosers
preprocessor = model_settings.get('LOGSUM_PREPROCESSOR', 'preprocessor')
Expand All @@ -92,17 +96,12 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
trace_label=trace_label)

# - compute logsums

coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
logsum_spec = simulate.read_model_spec(file_name=logsum_settings['SPEC'])
logsum_spec = simulate.eval_coefficients(logsum_spec, coefficients, estimator=None)

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

# constrained coefficients can appear in expressions
locals_dict.update(coefficients)

logsums = simulate.simple_simulate_logsums(
choosers,
logsum_spec,
Expand Down
12 changes: 10 additions & 2 deletions activitysim/core/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def read_model_coefficients(model_settings=None, file_name=None):
file_name = model_settings['COEFFICIENTS']

file_path = config.config_file_path(file_name)
coefficients = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
try:
coefficients = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
except ValueError:
logger.exception("Coefficient File Invalid: %s" % str(file_path))
raise

return coefficients

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

file_path = config.config_file_path(coeffs_file_name)
template = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
try:
template = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
except ValueError:
logger.exception("Coefficient Template File Invalid: %s" % str(file_path))
raise

# by convention, an empty cell in the template indicates that
# the coefficient name should be propogated to across all segments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ SEGMENTS:
- eatout
- social


SAMPLE_SIZE: 30

# we can't use use household income_segment as this will also be set for non-workers
CHOOSER_SEGMENT_COLUMN_NAME: tour_type

SIMULATE_CHOOSER_COLUMNS:
- tour_type
- TAZ
- household_id
- person_id

LOGSUM_SETTINGS: tour_mode_choice.yaml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coef_mode_logsum,0.6755,F
coef_escort_dist_0_2,-0.1499,F
coef_eatout_dist_0_2,-0.5609,F
coef_eatout_social_0_2,-0.5609,F
coef_eatout_dist_0_2,-0.7841,F
#coef_eatout_dist_0_2,-0.7841,F
coef_othdiscr_dist_0_2,-0.1677,F
coef_escort_dist_2_5,-0.8671,F
coef_shopping_dist_2_5,-0.5655,F
Expand Down

0 comments on commit 8b9df09

Please sign in to comment.