Skip to content

Commit

Permalink
mand tour sched preprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Apr 5, 2024
1 parent 14a3677 commit ffa3778
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions configs/resident/cdap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ annotate_households:
DF: households
TABLES:
- persons

sharrow_settings:
skip: true
4 changes: 4 additions & 0 deletions configs/resident/mandatory_tour_scheduling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ TOUR_SPEC_SEGMENTS:
school: school
univ: univ

preprocessor:
SPEC: mandatory_tour_scheduling_annotate_choosers_preprocessor.csv
DF: df

ALTS_PREPROCESSOR:
work:
SPEC: mandatory_tour_scheduling_annotate_alts_preprocessor.csv
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Description,Target,Expression
subsequent_tour_is_work,subsequent_tour_is_work,df.tour_type.shift(-1) == 'work'
subsequent_tour_is_school,subsequent_tour_is_school,df.tour_type.shift(-1) == 'school'
10 changes: 5 additions & 5 deletions configs/resident/tour_scheduling_school.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ util_All_adults_in_the_household_are_fulltime_workers_Departure_before_730_am__L
util_All_adults_in_the_household_are_fulltime_workers_Departure_after_800_am_Linear,SCHOOL - All adults in the household are fulltime workers - Departure after 8:00 am - Linear,"@((df.is_all_adults_full_time_workers) & (df.start > df.departureRefBin_school)) *df.departureLinearShift1",coef_All_adults_in_the_household_are_fulltime_workers_Departure_after_800_am_Linear
util_All_adults_in_the_household_are_fulltime_workers_arrival_before_ref,SCHOOL - All adults in the household are fulltime workers - Duration < 8hrs,"@((df.is_all_adults_full_time_workers) & (df.end < df.arrivalRefBin_school)) * df.arrivalLinearShift1_school",coef_All_adults_in_the_household_are_fulltime_workers_arrival_before_ref
util_All_adults_in_the_household_are_fulltime_workers_arrival_after_ref,SCHOOL - All adults in the household are fulltime workers - Duration > 8hrs,"@((df.is_all_adults_full_time_workers) & (df.end > df.arrivalRefBin_school)) * df.arrivalLinearShift1_school",coef_All_adults_in_the_household_are_fulltime_workers_arrival_after_ref
util_Subsequent_tour_is_work_tour_Duration_lt_8_hours,SCHOOL - Subsequent tour is work tour: Duration < 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.tour_type.shift(-1) == 'work') & (df.start < df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_work_tour_Duration_lt_8_hours
util_Subsequent_tour_is_work_tour_Duration_gt_8_hours,SCHOOL - Subsequent tour is work tour: Duration > 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.tour_type.shift(-1) == 'work') & (df.start > df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_work_tour_Duration_gt_8_hours
util_Subsequent_tour_is_school_tour_Departure_after_800_am,SCHOOL - Subsequent tour is school tour: Departure after 8:00 am,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.tour_type.shift(-1) == 'school') & (df.start > df.departureRefBin_school))) *df.departureLinearShift1",coef_Subsequent_tour_is_school_tour_Departure_after_800_am
util_Subsequent_tour_is_school_tour_Duration_lt_8_hours,SCHOOL - Subsequent tour is school tour: Duration < 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.tour_type.shift(-1) == 'school') & (df.start < df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_school_tour_Duration_lt_8_hours
util_Subsequent_tour_is_school_tour_Duration_gt_8_hours,SCHOOL - Subsequent tour is school tour: Duration > 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.tour_type.shift(-1) == 'school') & (df.start > df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_school_tour_Duration_gt_8_hours
util_Subsequent_tour_is_work_tour_Duration_lt_8_hours,SCHOOL - Subsequent tour is work tour: Duration < 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.subsequent_tour_is_work) & (df.start < df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_work_tour_Duration_lt_8_hours
util_Subsequent_tour_is_work_tour_Duration_gt_8_hours,SCHOOL - Subsequent tour is work tour: Duration > 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.subsequent_tour_is_work) & (df.start > df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_work_tour_Duration_gt_8_hours
util_Subsequent_tour_is_school_tour_Departure_after_800_am,SCHOOL - Subsequent tour is school tour: Departure after 8:00 am,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.subsequent_tour_is_school) & (df.start > df.departureRefBin_school))) *df.departureLinearShift1",coef_Subsequent_tour_is_school_tour_Departure_after_800_am
util_Subsequent_tour_is_school_tour_Duration_lt_8_hours,SCHOOL - Subsequent tour is school tour: Duration < 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.subsequent_tour_is_school) & (df.start < df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_school_tour_Duration_lt_8_hours
util_Subsequent_tour_is_school_tour_Duration_gt_8_hours,SCHOOL - Subsequent tour is school tour: Duration > 8 hours,"@(((df.tour_count>1) & (df.tour_num == 1) & (df.subsequent_tour_is_school) & (df.start > df.durationRefBin_school))) * df.durationShift_school",coef_Subsequent_tour_is_school_tour_Duration_gt_8_hours
util_Second_tour_of_two_mandatory_tours_Duration_lt_4_hours,SCHOOL - Second tour of two mandatory tours: Duration < 4 hours,"@(((df.tour_count>1) & (df.tour_num > 1)) & (df.duration<7)) * (((7-df.duration)*(df.duration<=7)) + ((df.duration-7)*(df.duration>7)))",coef_Second_tour_of_two_mandatory_tours_Duration_lt_4_hours
util_Second_tour_of_two_mandatory_tours_Duration_gt_4_hours,SCHOOL - Second tour of two mandatory tours: Duration > 4 hours,"@(((df.tour_count>1) & (df.tour_num > 1)) & (df.duration>7)) * (((7-df.duration)*(df.duration<=7)) + ((df.duration-7)*(df.duration>7)))",coef_Second_tour_of_two_mandatory_tours_Duration_gt_4_hours
util_Departure_Constant_Before_0600_AM,SCHOOL - Departure Constant: Before 06:00 AM,@(df.start<7),coef_Departure_Constant_Before_0600_AM
Expand Down
2 changes: 1 addition & 1 deletion test/test_sandag_abm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_sandag_abm3_sharrow():
def test_sandag_abm3_progressive(use_sharrow):
import activitysim.abm # register components # noqa: F401

out_dir = _test_path("output-progressive")
out_dir = _test_path("output-progressive-sharrow" if use_sharrow else "output-progressive")
out_dir.mkdir(exist_ok=True)
out_dir.joinpath(".gitignore").write_text("**\n")

Expand Down

0 comments on commit ffa3778

Please sign in to comment.