Skip to content

Commit

Permalink
update license, fix univ coeff bug, update estimation example (#339)
Browse files Browse the repository at this point in the history
* improve example setup for specifying input tables (#27)
* improve LICENSE (#30)
* correct univ coeff template lookup (#28)
  • Loading branch information
bstabler authored Sep 3, 2020
1 parent 05a25f6 commit fba45b3
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 20 deletions.
26 changes: 14 additions & 12 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
ActivitySim
Contributions prior to March 2016 Copyright (C) by UrbanSim Inc.
Contributions subsequent to March 2016 Copyright (C) by the contributing authors
BSD 3-Clause License

Copyright (c) After March 2016, Contributing Authors
Copyright (c) Before March 2016, UrbanSim Inc
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of [project] nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand All @@ -25,4 +27,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 changes: 12 additions & 8 deletions activitysim/abm/models/tour_mode_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,31 @@ def tour_mode_choice_simulate(tours, persons_merged,
# FIXME run_tour_mode_choice_simulate writes choosers post-annotation

choices_list = []
for tour_type, segment in primary_tours_merged.groupby('tour_type'):
primary_tours_merged['primary_purpose'] = \
primary_tours_merged.tour_type.where((primary_tours_merged.tour_type != 'school') |
~primary_tours_merged.is_university, 'univ')

logger.info("tour_mode_choice_simulate tour_type '%s' (%s tours)" %
(tour_type, len(segment.index), ))
for primary_purpose, tours_segment in primary_tours_merged.groupby('primary_purpose'):

logger.info("tour_mode_choice_simulate primary_purpose '%s' (%s tours)" %
(primary_purpose, len(tours_segment.index), ))

# name index so tracing knows how to slice
assert segment.index.name == 'tour_id'
assert tours_segment.index.name == 'tour_id'

choices_df = run_tour_mode_choice_simulate(
segment,
tour_type, model_settings,
tours_segment,
primary_purpose, model_settings,
mode_column_name=mode_column_name,
logsum_column_name=logsum_column_name,
skims=skims,
constants=constants,
estimator=estimator,
chunk_size=chunk_size,
trace_label=tracing.extend_trace_label(trace_label, tour_type),
trace_label=tracing.extend_trace_label(trace_label, primary_purpose),
trace_choice_name='tour_mode_choice')

tracing.print_summary('tour_mode_choice_simulate %s choices_df' % tour_type,
tracing.print_summary('tour_mode_choice_simulate %s choices_df' % primary_purpose,
choices_df.tour_mode, value_counts=True)

choices_list.append(choices_df)
Expand Down
40 changes: 40 additions & 0 deletions activitysim/examples/example_estimation/configs/settings.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@

inherit_settings: True

# input tables
input_table_list:
- tablename: households
filename: survey_data/override_households.csv
index_col: household_id
- tablename: persons
filename: survey_data/override_persons.csv
index_col: person_id
- tablename: land_use
filename: land_use.csv
index_col: TAZ
rename_columns:
ZONE: TAZ
COUNTY: county_id
keep_columns:
- DISTRICT
- SD
- county_id
- TOTHH
- TOTPOP
- TOTACRE
- RESACRE
- CIACRE
- TOTEMP
- AGE0519
- RETEMPN
- FPSEMPN
- HEREMPN
- OTHEMPN
- AGREMPN
- MWTEMPN
- PRKCST
- OPRKCST
- area_type
- HSENROLL
- COLLFTE
- COLLPTE
- TOPOLOGY
- TERMINAL

write_raw_tables: False
rng_base_seed: 0

Expand Down

0 comments on commit fba45b3

Please sign in to comment.