diff --git a/MANIFEST.in b/MANIFEST.in index dc734124b..0c83cbffd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,6 @@ include ez_setup.py include README.rst -include LICENSE.txt - -graft notebooks graft activitysim/examples # required for test system diff --git a/activitysim/__init__.py b/activitysim/__init__.py index 0d097ba6c..392063b47 100644 --- a/activitysim/__init__.py +++ b/activitysim/__init__.py @@ -1,5 +1,5 @@ # ActivitySim # See full license in LICENSE.txt. -__version__ = '0.9.5' +__version__ = '0.9.5.1' __doc__ = 'Activity-Based Travel Modeling' diff --git a/activitysim/abm/models/joint_tour_destination.py b/activitysim/abm/models/joint_tour_destination.py index e10fa2c34..8e7c940db 100644 --- a/activitysim/abm/models/joint_tour_destination.py +++ b/activitysim/abm/models/joint_tour_destination.py @@ -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') diff --git a/activitysim/abm/models/util/vectorize_tour_scheduling.py b/activitysim/abm/models/util/vectorize_tour_scheduling.py index bd0eee021..f71e45b24 100644 --- a/activitysim/abm/models/util/vectorize_tour_scheduling.py +++ b/activitysim/abm/models/util/vectorize_tour_scheduling.py @@ -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') @@ -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, diff --git a/activitysim/core/simulate.py b/activitysim/core/simulate.py index 9e8af50df..cb8fc6494 100644 --- a/activitysim/core/simulate.py +++ b/activitysim/core/simulate.py @@ -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 @@ -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 diff --git a/activitysim/examples/example_mtc/configs/joint_tour_destination.yaml b/activitysim/examples/example_mtc/configs/joint_tour_destination.yaml index 36d67bc30..a9cb3fe43 100644 --- a/activitysim/examples/example_mtc/configs/joint_tour_destination.yaml +++ b/activitysim/examples/example_mtc/configs/joint_tour_destination.yaml @@ -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 diff --git a/activitysim/examples/example_mtc/configs/non_mandatory_tour_destination_coeffs.csv b/activitysim/examples/example_mtc/configs/non_mandatory_tour_destination_coeffs.csv index bf02b811f..4096d6e3a 100644 --- a/activitysim/examples/example_mtc/configs/non_mandatory_tour_destination_coeffs.csv +++ b/activitysim/examples/example_mtc/configs/non_mandatory_tour_destination_coeffs.csv @@ -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 diff --git a/notebooks/README.md b/activitysim/examples/example_mtc/notebooks/README.md similarity index 100% rename from notebooks/README.md rename to activitysim/examples/example_mtc/notebooks/README.md diff --git a/notebooks/adding_tncs.ipynb b/activitysim/examples/example_mtc/notebooks/adding_tncs.ipynb similarity index 100% rename from notebooks/adding_tncs.ipynb rename to activitysim/examples/example_mtc/notebooks/adding_tncs.ipynb diff --git a/notebooks/change_in_auto_ownership.ipynb b/activitysim/examples/example_mtc/notebooks/change_in_auto_ownership.ipynb similarity index 100% rename from notebooks/change_in_auto_ownership.ipynb rename to activitysim/examples/example_mtc/notebooks/change_in_auto_ownership.ipynb diff --git a/notebooks/getting_started.ipynb b/activitysim/examples/example_mtc/notebooks/getting_started.ipynb similarity index 99% rename from notebooks/getting_started.ipynb rename to activitysim/examples/example_mtc/notebooks/getting_started.ipynb index 3246b9b75..008e18c76 100644 --- a/notebooks/getting_started.ipynb +++ b/activitysim/examples/example_mtc/notebooks/getting_started.ipynb @@ -75,7 +75,7 @@ } ], "source": [ - "!pip install https://github.com/activitysim/activitysim/zipball/develop" + "!pip install activitysim" ] }, { diff --git a/notebooks/summarizing_results.ipynb b/activitysim/examples/example_mtc/notebooks/summarizing_results.ipynb similarity index 100% rename from notebooks/summarizing_results.ipynb rename to activitysim/examples/example_mtc/notebooks/summarizing_results.ipynb diff --git a/notebooks/trips_in_time_and_space.ipynb b/activitysim/examples/example_mtc/notebooks/trips_in_time_and_space.ipynb similarity index 100% rename from notebooks/trips_in_time_and_space.ipynb rename to activitysim/examples/example_mtc/notebooks/trips_in_time_and_space.ipynb diff --git a/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.dbf b/activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.dbf similarity index 100% rename from notebooks/zone_shapefile/bayarea_rtaz1454_rev1.dbf rename to activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.dbf diff --git a/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.prj b/activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.prj similarity index 100% rename from notebooks/zone_shapefile/bayarea_rtaz1454_rev1.prj rename to activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.prj diff --git a/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shp b/activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shp similarity index 100% rename from notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shp rename to activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shp diff --git a/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shx b/activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shx similarity index 100% rename from notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shx rename to activitysim/examples/example_mtc/notebooks/zone_shapefile/bayarea_rtaz1454_rev1.shx diff --git a/docs/abmexample.rst b/docs/abmexample.rst index 0e66d7545..167fd93b8 100644 --- a/docs/abmexample.rst +++ b/docs/abmexample.rst @@ -929,10 +929,10 @@ To run the estimation example, do the following: * Open the relevant estimation with larch example Jupyter Notebook and re-estimate the submodel: - * `Estimating auto ownership `__ - * `Estimating school location `__ - * `Estimating work location `__ - * `Estimating tour mode choice `__ + * `Estimating auto ownership `__ + * `Estimating school location `__ + * `Estimating work location `__ + * `Estimating tour mode choice `__ * Save the updated coefficient file to the configs folder and run the model in simulation mode. diff --git a/docs/gettingstarted.rst b/docs/gettingstarted.rst index 84eee02e5..75fddda08 100644 --- a/docs/gettingstarted.rst +++ b/docs/gettingstarted.rst @@ -133,12 +133,12 @@ ActivitySim includes a `Jupyter Notebook `__ recipe book wi * Open an Anaconda prompt and activate the Anaconda environment with ActivitySim installed * If needed, ``conda install jupyterlab`` so you can run jupyter notebooks * Type ``jupyter notebook`` to launch the web-based notebook manager -* Navigate to the notebooks folder and select a notebook to learn more: +* Navigate to the examples notebooks folder and select a notebook to learn more: - * `Getting started `__ - * `Summarizing results `__ - * `Testing a change in auto ownership `__ - * `Adding TNCs `__ + * `Getting started `__ + * `Summarizing results `__ + * `Testing a change in auto ownership `__ + * `Adding TNCs `__ Hardware --------