Skip to content

Commit

Permalink
making fixes per review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aletzdy committed May 12, 2023
1 parent d52496e commit c05c7f3
Show file tree
Hide file tree
Showing 224 changed files with 150 additions and 237 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
- prototype_mtc_extended
- placeholder_sandag
- prototype_sandag_xborder
- example_semcog
- production_semcog
- prototype_mwcog
- placeholder_multiple_zone
fail-fast: false
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
16 changes: 16 additions & 0 deletions activitysim/estimation/larch/simple_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,19 @@ def joint_tour_participation_model(
1: 2, # 1 means not participate, alternative 2
},
)

def work_from_home_model(
name="work_from_home",
edb_directory="output/estimation_data_bundle/{name}/",
return_data=False,
):
return simple_simulate_model(
name=name,
edb_directory=edb_directory,
return_data=return_data,
choices={
True: 1,
False: 2,
}, # True is work from home, false is does not work from home, names match spec positions
)

40 changes: 20 additions & 20 deletions activitysim/examples/example_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,34 +488,34 @@
data/final_accessibility.csv
949994345c9965054be260589fd64079e4032d2e4079e46b9eb9c758a40527c3

- name: example_semcog
- name: production_semcog
description: 67 zone test example for the SEMCOG region
# activitysim create -e example_semcog -d test_example_semcog
# cd test_example_semcog
# activitysim create -e production_semcog -d test_production_semcog
# cd test_production_semcog
# python simulation.py -c configs -o output -d data
# cd ..
include:
- example_semcog/extensions
- example_semcog/data
- example_semcog/configs
- example_semcog/configs_mp
- example_semcog/output
- example_semcog/README.MD
- example_semcog/simulation.py
- production_semcog/extensions
- production_semcog/data
- production_semcog/configs
- production_semcog/configs_mp
- production_semcog/output
- production_semcog/README.MD
- production_semcog/simulation.py

- name: example_semcog_full
description: 2899 zone full size example for the SEMCOG region
# activitysim create -e example_semcog_full -d test_example_semcog_full
# cd test_example_semcog_full
- name: production_semcog_full
description: 2899 zone full size production model for the SEMCOG region
# activitysim create -e production_semcog_full -d test_production_semcog_full
# cd test_production_semcog_full
# python simulation.py -c configs_mp -c configs -o output -d data
# cd ..
include:
- example_semcog/extensions
- example_semcog/configs
- example_semcog/configs_mp
- example_semcog/output
- example_semcog/README.MD
- example_semcog/simulation.py
- production_semcog/extensions
- production_semcog/configs
- production_semcog/configs_mp
- production_semcog/output
- production_semcog/README.MD
- production_semcog/simulation.py
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/semcog_data_full/skims_offpeak.omx
data/skims_offpeak.omx
685e93a725e2c04e4b1fc11b92609472c347ce830475448e39b52947fa729d80
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Description,Target,Expression
#,, annotate households table after import
,_PERSON_COUNT,"lambda query, persons, households: persons.query(query).groupby('household_id').size().reindex(households.index).fillna(0).astype(np.int8)"
#,,FIXME households.income can be negative - so we clip?
#,income,households.hincp * households.adjinc/100000
income,income,households.hincp.fillna(0)
income_in_thousands,income_in_thousands,(income / 1000).clip(lower=0)
income_segment,income_segment,"pd.cut(income_in_thousands, bins=[-np.inf, 30, 60, 100, np.inf], labels=[1, 2, 3, 4]).astype(int)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ travel_active,travel_active,persons.cdap_activity != CDAP_ACTIVITY_HOME
under16_not_at_school,under16_not_at_school,"persons.ptype.isin([PTYPE_SCHOOL, PTYPE_PRESCHOOL]) & persons.cdap_activity.isin(['N', 'H'])"
has_preschool_kid_at_home,has_preschool_kid_at_home,"other_than(persons.household_id, (persons.ptype == PTYPE_PRESCHOOL) & (persons.cdap_activity == 'H'))"
has_school_kid_at_home,has_school_kid_at_home,"other_than(persons.household_id, (persons.ptype == PTYPE_SCHOOL) & (persons.cdap_activity == 'H'))"
#,cdap_activity,"np.where((persons.work_from_home) & (persons.cdap_activity=='M'), np.random.choice(['N','H']), persons.cdap_activity)"
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ Description,Target,Expression
temp auto_time_to_school,_auto_time_to_school,"skim_dict.lookup(persons.home_zone_id, persons.school_zone_id, ('SOV_TIME', 'MD'))"
temp auto_time_return,_auto_time_return,"skim_dict.lookup(persons.school_zone_id, persons.home_zone_id, ('SOV_TIME', 'MD'))"
free flow roundtrip_auto_time_to_school,roundtrip_auto_time_to_school,"np.where(persons.school_zone_id>=0,_auto_time_to_school + _auto_time_return,0)"
#,,
#,home_county,"reindex(land_use.COUNTY, persons.home_zone_id)"
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ work_zone_area_type,work_zone_area_type,"reindex(land_use.AreaType, persons.work
,work_auto_savings_ratio,"(work_auto_savings / 120.0).clip(-1.0, 1.0)"
,umich_student,df.school_zone_id.isin(land_use[land_use.University_Name=='University of Michigan'].index.values)
,umich_worker,df.workplace_zone_id.isin(land_use[land_use.University_Name=='University of Michigan'].index.values)
#,umich_affiliate,"df.get(umich_worker, default=False) | df.get(umich_student, default=False)"
#,,
,dest_hourly_peak_parking_cost,"reindex(land_use.parking_hourly, df.workplace_zone_id)"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ util_dummy_for_non_full_time_worker,pemploy!=1,coefficient_dummy_for_non_full_ti
util_dummy_for_non_workers,"ptype in [4, 5]",coefficient_dummy_for_non_workers_no_subtours,coefficient_dummy_for_non_workers_eat,coefficient_dummy_for_non_workers_business1,coefficient_dummy_for_non_workers_maint,coefficient_dummy_for_non_workers_business2,coefficient_dummy_for_non_workers_eat_business
util_medium_hh_income_dummy,income_segment == 2,coefficient_medium_hh_income_dummy_no_subtours,coefficient_medium_hh_income_dummy_eat,coefficient_medium_hh_income_dummy_business1,coefficient_medium_hh_income_dummy_maint,coefficient_medium_hh_income_dummy_business2,coefficient_medium_hh_income_dummy_eat_business
util_high_hh_income_dummy,(income_segment > 2) & (income_segment < 5),coefficient_high_hh_income_dummy_no_subtours,coefficient_high_hh_income_dummy_eat,coefficient_high_hh_income_dummy_business1,coefficient_high_hh_income_dummy_maint,coefficient_high_hh_income_dummy_business2,coefficient_high_hh_income_dummy_eat_business
util_zero_cars_owned_by_hh_dummy, auto_ownership == 0,coefficient_zero_cars_owned_by_hh_dummy_no_subtours,coefficient_zero_cars_owned_by_hh_dummy_eat,coefficient_zero_cars_owned_by_hh_dummy_business1,coefficient_zero_cars_owned_by_hh_dummy_maint,coefficient_zero_cars_owned_by_hh_dummy_business2,coefficient_zero_cars_owned_by_hh_dummy_eat_business
util_zero_cars_owned_by_hh_dummy,auto_ownership == 0,coefficient_zero_cars_owned_by_hh_dummy_no_subtours,coefficient_zero_cars_owned_by_hh_dummy_eat,coefficient_zero_cars_owned_by_hh_dummy_business1,coefficient_zero_cars_owned_by_hh_dummy_maint,coefficient_zero_cars_owned_by_hh_dummy_business2,coefficient_zero_cars_owned_by_hh_dummy_eat_business
util_individual_discretionary_tours_made_by_full_time_worker,@(df.pemploy==1)*df.num_discr_tours,coefficient_individual_discretionary_tours_made_by_full_time_worker_no_subtours,coefficient_individual_discretionary_tours_made_by_full_time_worker_eat,coefficient_individual_discretionary_tours_made_by_full_time_worker_business1,coefficient_individual_discretionary_tours_made_by_full_time_worker_maint,coefficient_individual_discretionary_tours_made_by_full_time_worker_business2,coefficient_individual_discretionary_tours_made_by_full_time_worker_eat_business
util_individual_discretionary_tours_made_by_part_time_worker,@(df.pemploy==2)*df.num_discr_tours,coefficient_individual_discretionary_tours_made_by_part_time_worker_no_subtours,coefficient_individual_discretionary_tours_made_by_part_time_worker_eat,coefficient_individual_discretionary_tours_made_by_part_time_worker_business1,coefficient_individual_discretionary_tours_made_by_part_time_worker_maint,coefficient_individual_discretionary_tours_made_by_part_time_worker_business2,coefficient_individual_discretionary_tours_made_by_part_time_worker_eat_business
util_individual_eating_out_tours_made_by_person,num_eatout_tours,coefficient_individual_eating_out_tours_made_by_person_no_subtours,coefficient_individual_eating_out_tours_made_by_person_eat,coefficient_individual_eating_out_tours_made_by_person_business1,coefficient_individual_eating_out_tours_made_by_person_maint,coefficient_individual_eating_out_tours_made_by_person_business2,coefficient_individual_eating_out_tours_made_by_person_eat_business
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ util_can_walk_to_work_retired,Can walk to work - Retired interaction,(ptype == 5
util_can_walk_to_school_univ,Can walk to school - University student interaction,(ptype == 3) & (distance_to_school < 3),,,,coef_can_walk_to_work_school2,
util_can_walk_to_school_driving_age_child,Can walk to school - Driving-age child interaction,(ptype == 6) & (distance_to_school < 3),,,,coef_can_walk_to_work_school2,
util_can_walk_to_school_pre_driving_age_child,Can walk to school - Pre-driving age child who is in school interaction,(ptype == 7) & (distance_to_school < 3),,,,coef_can_walk_to_work_school2,
util_can_walk_to_work_or_school_ft,Can walk to work or school - Full-time worker interaction,(ptype == 1) & (distance_to_work < 3 | distance_to_school < 3),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_pt,Can walk to work or school - Part-time worker interaction,(ptype == 2) & (distance_to_work < 3 | distance_to_school < 3),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_univ,Can walk to work or school - University student interaction,(ptype == 3) & (distance_to_work < 3 | distance_to_school < 3),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_driving_age_child,Can walk to work or school - Driving-age child interaction,(ptype == 6) & (distance_to_work < 3 | distance_to_school < 3),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_ft,Can walk to work or school - Full-time worker interaction,(ptype == 1) & ((distance_to_work < 3) | (distance_to_school < 3)),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_pt,Can walk to work or school - Part-time worker interaction,(ptype == 2) & ((distance_to_work < 3) | (distance_to_school < 3)),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_univ,Can walk to work or school - University student interaction,(ptype == 3) & ((distance_to_work < 3) | (distance_to_school < 3)),,,,,coef_can_walk_to_work_and_school
util_can_walk_to_work_or_school_driving_age_child,Can walk to work or school - Driving-age child interaction,(ptype == 6) & ((distance_to_work < 3) | (distance_to_school < 3)),,,,,coef_can_walk_to_work_and_school
util_round_trip_auto_time_to_work_ft,Round trip auto time to work - Full-time worker interaction,(ptype == 1) * roundtrip_auto_time_to_work,,coef_round_trip_auto_time_to_work_work2,,,coef_round_trip_auto_time_to_work_school2
util_round_trip_auto_time_to_work_pt,Round trip auto time to work - Part-time worker interaction,(ptype == 2) * roundtrip_auto_time_to_work,,coef_round_trip_auto_time_to_work_work2,,,coef_round_trip_auto_time_to_work_school2
util_round_trip_auto_time_to_work_univ,Round trip auto time to work - University student interaction,(ptype == 3) * roundtrip_auto_time_to_work,,coef_round_trip_auto_time_to_work_work2,,,coef_round_trip_auto_time_to_work_school2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ COEFFICIENTS: tour_mode_choice_coeffs.csv
COEFFICIENT_TEMPLATE: tour_mode_choice_coeffs_template.csv

CONSTANTS:
# valueOfTime: 8.00
# costPerMile: 18.29
# costShareSr2: 1.75
# costShareSr3: 2.50
# waitThresh: 10.00
# walkThresh: 1.50
# shortWalk: 0.333
# longWalk: 0.667
# walkSpeed: 3.00
# bikeThresh: 6.00
# bikeSpeed: 12.00
maxCbdAreaTypeThresh: 2
indivTour: 1.00000
upperEA: 5
Expand Down Expand Up @@ -166,11 +155,6 @@ CONSTANTS:
8: 1.0
transit_subsidy_fare_discount_percent_worktour: 0.9

# joint_sr2_ASC_no_auto: 0
# joint_sr2_ASC_auto_deficient: 0
# joint_sr2_ASC_auto_sufficient: 0
# joint_drive_transit_ASC_no_auto: 0

# so far, we can use the same spec as for non-joint tours
preprocessor:
SPEC: tour_mode_choice_annotate_choosers_preprocessor
Expand Down
Loading

0 comments on commit c05c7f3

Please sign in to comment.