-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #585 from AndrewTheTM/develop
Adding small MWCOG example/prototype
- Loading branch information
Showing
207 changed files
with
87,805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
data_*/ | ||
output_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### MWCOG Example | ||
|
||
This is an example of the Metropolitan Washington Council of Governments ActivitySim model. This is a 53 zone portion of the model, centered on the National Mall. |
2 changes: 2 additions & 0 deletions
2
activitysim/examples/prototype_mwcog/configs/_dummy_coefficients.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coefficient_name,value,constrain | ||
coef_one,1,T |
59 changes: 59 additions & 0 deletions
59
activitysim/examples/prototype_mwcog/configs/accessibility.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Description,Target,Expression | ||
#,, | ||
#,, auto peak | ||
#,, | ||
#,, assume peak occurs in AM for outbound and PM for inbound | ||
peak round trip time,_auPkTime,"skim_od[('SOV_TIME', 'AM')] + skim_do[('SOV_TIME', 'PM')]" | ||
decay function,_decay, exp(_auPkTime * dispersion_parameter_automobile) | ||
auto peak retail,auPkRetail,df.RETEMP * _decay | ||
auto peak total,auPkTotal,df.TOTEMP * _decay | ||
#,, | ||
#,, auto off-peak | ||
#,, | ||
#,, assume midday occurs entirely in the midday period | ||
off-peak round trip time,_auOpTime,"skim_od[('SOV_TIME', 'MD')] + skim_do[('SOV_TIME', 'MD')]" | ||
decay function,_decay, exp(_auOpTime * dispersion_parameter_automobile) | ||
auto off-peak retail,auOpRetail,df.RETEMP * _decay | ||
auto off-peak total,auOpTotal,df.TOTEMP * _decay | ||
#,, | ||
#,, transit peak | ||
#,, | ||
#,, assume peak outbound transit occurs in AM | ||
o-d peak transit ivt,_inVehicleTime,"skim_od[('WK_TRN_WK_TOTIVT', 'AM')]" | ||
o-d peak transit ovt,_outOfVehicleTime,"skim_od[('WK_TRN_WK_IWAIT', 'AM')] + skim_od[('WK_TRN_WK_XWAIT', 'AM')] + skim_od[('WK_TRN_WK_WACC_EGR', 'AM')] + skim_od[('WK_TRN_WK_WAUX', 'AM')]" | ||
o-d peak transit time,_trPkTime_od,(_inVehicleTime + out_of_vehicle_time_weight * _outOfVehicleTime) | ||
#,, assume peak inbound transit occurs in PM | ||
d-o peak transit ivt,_inVehicleTime,"skim_od[('WK_TRN_WK_TOTIVT', 'PM')]" | ||
d-o peak transit ovt,_outOfVehicleTime,"skim_od[('WK_TRN_WK_IWAIT', 'PM')] + skim_od[('WK_TRN_WK_XWAIT', 'PM')] + skim_od[('WK_TRN_WK_WACC_EGR', 'PM')] + skim_od[('WK_TRN_WK_WAUX', 'PM')]" | ||
d-o peak transit time,_trPkTime_do,(_inVehicleTime + out_of_vehicle_time_weight * _outOfVehicleTime) | ||
peak transit time,_trPkTime,_trPkTime_od + _trPkTime_do | ||
round trip path is available,_rt_available,(_trPkTime_od > 0) & (_trPkTime_do > 0) | ||
decay function,_decay,_rt_available * exp(_trPkTime * dispersion_parameter_transit) | ||
transit peak retail,trPkRetail,df.RETEMP * _decay | ||
transit peak total,trPkTotal,df.TOTEMP * _decay | ||
#,, | ||
#,, transit off-peak | ||
#,, | ||
#,, assume off-peak outbound transit occurs in the MD time period | ||
o-d off-peak transit ivt,_inVehicleTime,"skim_od[('WK_TRN_WK_TOTIVT', 'MD')]" | ||
o-d off-peak transit ovt,_outOfVehicleTime,"skim_od[('WK_TRN_WK_IWAIT', 'MD')] + skim_od[('WK_TRN_WK_XWAIT', 'MD')] + skim_od[('WK_TRN_WK_WACC_EGR', 'MD')] + skim_od[('WK_TRN_WK_WAUX', 'MD')]" | ||
o-d off-peak transit time,_trOpTime_od,(_inVehicleTime + out_of_vehicle_time_weight * _outOfVehicleTime) | ||
#,, assume off-peak inbound transit occurs in the MD time period | ||
d-o off-peak transit ivt,_inVehicleTime,"skim_do[('WK_TRN_WK_TOTIVT', 'MD')]" | ||
d-o off-peak transit ovt,_outOfVehicleTime,"skim_do[('WK_TRN_WK_IWAIT', 'MD')] + skim_do[('WK_TRN_WK_XWAIT', 'MD')] + skim_do[('WK_TRN_WK_WACC_EGR', 'MD')] + skim_do[('WK_TRN_WK_WAUX', 'MD')]" | ||
d-o off-peak transit time,_trOpTime_do,(_inVehicleTime + out_of_vehicle_time_weight * _outOfVehicleTime) | ||
peak transit time,_trOpTime,_trOpTime_od + _trOpTime_do | ||
#,,FIXME - _rt_available calculation appears to be wrong in mtctm1 accessibility.job | ||
#round trip path is available,_rt_available,(_trOpTime > 0) | ||
round trip path is available,_rt_available,(_trOpTime_od > 0) & (_trOpTime_do > 0) | ||
decay function,_decay,_rt_available * exp(_trOpTime * dispersion_parameter_transit) | ||
transit off-peak retail,trOpRetail,df.RETEMP * _decay | ||
transit off-peak total,trOpTotal,df.TOTEMP * _decay | ||
#,, | ||
#,, non motorized | ||
#,, | ||
non-motorized round trip distance,_nmDist,skim_od['DISTWALK'] + skim_do['DISTWALK'] | ||
round trip path is available,_rt_available,_nmDist <= maximum_walk_distance | ||
decay function,_decay,_rt_available * exp(_nmDist * dispersion_parameter_walk) | ||
retail accessibility,nmRetail,df.RETEMP * _decay | ||
total accessibility,nmTotal,df.TOTEMP * _decay |
13 changes: 13 additions & 0 deletions
13
activitysim/examples/prototype_mwcog/configs/accessibility.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
# columns from land_use table to add to df | ||
land_use_columns: ['RETEMP', 'TOTEMP'] | ||
|
||
CONSTANTS: | ||
# dispersion parameters | ||
dispersion_parameter_automobile: -0.05 | ||
dispersion_parameter_transit: -0.05 | ||
dispersion_parameter_walk: -1.00 | ||
# maximum walk distance in miles | ||
maximum_walk_distance: 3.0 | ||
# perceived minute of in-vehicle time for every minute of out-of-vehicle time | ||
out_of_vehicle_time_weight: 2.0 |
42 changes: 42 additions & 0 deletions
42
activitysim/examples/prototype_mwcog/configs/annotate_households.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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,income,households.hhincadj.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, 50, 100, 150, np.inf], labels=[1, 2, 3, 4]).astype(int)" | ||
#,, | ||
,_MIN_VOT,setting('min_value_of_time') | ||
,_MAX_VOT,setting('max_value_of_time') | ||
,_MU,setting('distributed_vot_mu') | ||
,_SIGMA,setting('distributed_vot_sigma') | ||
median_value_of_time,median_value_of_time,"income_segment.map({k: v for k, v in setting('household_median_value_of_time').items()})" | ||
hh_value_of_time,hh_value_of_time,"rng.lognormal_for_df(df, mu=np.log(median_value_of_time * _MU), sigma=_SIGMA).clip(_MIN_VOT, _MAX_VOT)" | ||
#,, | ||
#num_workers was renamed in import,, | ||
,num_workers,"_PERSON_COUNT('(ESR==1)|(ESR==2)|(ESR==4)|(ESR==5)', persons, households)" | ||
number of non_workers,num_non_workers,households.hhsize - num_workers | ||
#,, | ||
#,,we assume that everyone 16 and older is a potential driver | ||
number of drivers,num_drivers,"_PERSON_COUNT('16 <= age', persons, households)" | ||
num_adults,num_adults,"_PERSON_COUNT('18 <= age', persons, households)" | ||
num_children,num_children,"_PERSON_COUNT('18 > age', persons, households)" | ||
num_young_children,num_young_children,"_PERSON_COUNT('age <= 5', persons, households)" | ||
num_children_5_to_15,num_children_5_to_15,"_PERSON_COUNT('5 <= age <= 15', persons, households)" | ||
num_children_6_to_12,num_children_6_to_12,"_PERSON_COUNT('6 <= age <= 12', persons, households)" | ||
num_children_16_to_17,num_children_16_to_17,"_PERSON_COUNT('16 <= age <= 17', persons, households)" | ||
num_college_age,num_college_age,"_PERSON_COUNT('18 <= age <= 24', persons, households)" | ||
num_young_adults,num_young_adults,"_PERSON_COUNT('25 <= age <= 34', persons, households)" | ||
non_family,non_family,households.HHT.isin(HHT_NONFAMILY) | ||
family,family,households.HHT.isin(HHT_FAMILY) | ||
home_is_urban,home_is_urban,"reindex(land_use.AREATYPE, households.home_zone_id) < setting('urban_threshold')" | ||
home_is_rural,home_is_rural,"reindex(land_use.AREATYPE, households.home_zone_id) > setting('rural_threshold')" | ||
#,, default for work and school location logsums before auto_ownership model is run | ||
,auto_ownership,households.auto_ownership | ||
TAZ column to match settings file,TAZ,households.home_zone_id | ||
number of pre-driving age children in the household,num_predrive_child,"_PERSON_COUNT('ptype == 7', persons, households)" | ||
number of non-working adult in the household,num_nonworker_adults,"_PERSON_COUNT('ptype == 4', persons, households)" | ||
number of full time workers,num_fullTime_workers,"_PERSON_COUNT('is_fulltime_worker', persons, households)" | ||
number of part time workers,num_partTime_workers,"_PERSON_COUNT('is_parttime_worker', persons, households)" | ||
number of retired adults in the household,_num_retired_adults,"_PERSON_COUNT('ptype == 5', persons, households)" | ||
Retired Adults Only Households,retired_adults_only_hh,(households.hhsize > 0) & (households.hhsize == _num_retired_adults) |
9 changes: 9 additions & 0 deletions
9
activitysim/examples/prototype_mwcog/configs/annotate_households_cdap.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Description,Target,Expression | ||
#,, annotate households table after cdap model has run | ||
num_under16_not_at_school,num_under16_not_at_school,persons.under16_not_at_school.astype(int).groupby(persons.household_id).sum().reindex(households.index).fillna(0).astype(np.int8) | ||
num_travel_active,num_travel_active,persons.travel_active.astype(int).groupby(persons.household_id).sum().reindex(households.index).fillna(0).astype(np.int8) | ||
num_travel_active_adults,num_travel_active_adults,(persons.adult & persons.travel_active).astype(int).groupby(persons.household_id).sum().reindex(households.index).fillna(0).astype(np.int8) | ||
num_travel_active_preschoolers,num_travel_active_preschoolers,((persons.ptype == PTYPE_PRESCHOOL) & persons.travel_active).astype(int).groupby(persons.household_id).sum().reindex(households.index).fillna(0).astype(np.int8) | ||
num_travel_active_children,num_travel_active_children,num_travel_active - num_travel_active_adults | ||
num_travel_active_non_preschoolers,num_travel_active_non_preschoolers,num_travel_active - num_travel_active_preschoolers | ||
participates_in_jtf_model,participates_in_jtf_model,(num_travel_active > 1) & (num_travel_active_non_preschoolers > 0) |
5 changes: 5 additions & 0 deletions
5
activitysim/examples/prototype_mwcog/configs/annotate_households_workplace.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Description,Target,Expression | ||
#,, annotate households table after workplace_location model has run | ||
#,, hh_work_auto_savings_ratio is sum of persons work_auto_savings_ratio | ||
,hh_work_auto_savings_ratio,persons.work_auto_savings_ratio.groupby(persons.household_id).sum().reindex(households.index).fillna(0.0) | ||
#,,handle persons with no locatcion |
9 changes: 9 additions & 0 deletions
9
activitysim/examples/prototype_mwcog/configs/annotate_landuse.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Description,Target,Expression | ||
#,, annotate landuse table after import | ||
household_density,household_density,land_use.HH / (land_use.LANDAREA * 640) | ||
employment_density,employment_density,land_use.TOTEMP / (land_use.LANDAREA * 640) | ||
,employment_density,employment_density.fillna(0) | ||
density_index,density_index,(household_density *employment_density) / (household_density + employment_density).clip(lower=1) | ||
topology (assume flat),TOPOLOGY,1 | ||
zero out land use for zero area,Park_Acres,"np.where(land_use.LANDAREA==0,0,land_use.Park_Acres)" | ||
zero out land use for zero area,GC_Acres,"np.where(land_use.LANDAREA==0,0,land_use.GC_Acres)" |
68 changes: 68 additions & 0 deletions
68
activitysim/examples/prototype_mwcog/configs/annotate_persons.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Description,Target,Expression | ||
#,, annotate persons table after import | ||
age_0_to_5,age_0_to_5,"persons.age.between(0,5)" | ||
age_6_to_12,age_6_to_12,"persons.age.between(6,12)" | ||
age_16_to_19,age_16_to_19,"persons.age.between(16, 19)" | ||
age_16_p,age_16_p,persons.age >= 16 | ||
adult,adult,persons.age >= 18 | ||
young,young,persons.age <= 25 | ||
old,old,persons.age >= 65 | ||
male,male,persons.SEX == 1 | ||
female,female,persons.SEX == 2 | ||
,esr,persons.ESR.fillna(0) | ||
,wkhp,persons.WKHP.fillna(0) | ||
,wkw,persons.WKW.fillna(0) | ||
,schg,persons.SCHG.fillna(0) | ||
,mil,persons.MIL.fillna(0) | ||
employment status type,pemploy,np.zeros(len(persons)) | ||
,pemploy,"np.where(persons.age < 16, PEMPLOY_CHILD, PEMPLOY_PART)" | ||
,pemploy,"np.where((persons['age'] >= 16) & ((esr == 3) | (esr == 6)), PEMPLOY_NOT, pemploy)" | ||
,pemploy,"np.where((persons.age>=16)&((esr != 3)&(esr != 6))&(wkhp >= 35) & (wkw >= 1) & (wkw <= 4), PEMPLOY_FULL, pemploy)" | ||
student category,pstudent,np.zeros(len(persons)) | ||
,pstudent,"np.where((pemploy == 1) & (persons.age >= 16), PSTUDENT_NOT, pstudent)" | ||
,pstudent,"np.where((pemploy == 1) & (persons.age < 16), PSTUDENT_GRADE_OR_HIGH, pstudent)" | ||
,pstudent,"np.where((schg < 1) & (persons.age >= 16), PSTUDENT_NOT, pstudent)" | ||
,pstudent,"np.where((schg < 1) & (persons.age < 16), PSTUDENT_GRADE_OR_HIGH, pstudent)" | ||
,pstudent,"np.where((schg >= 15) & (persons.age >= 16) & (pemploy != 1), PSTUDENT_UNIVERSITY, pstudent)" | ||
,pstudent,"np.where((schg >= 15) & (persons.age < 16) & (pemploy != 1), PSTUDENT_GRADE_OR_HIGH, pstudent)" | ||
,pstudent,"np.where((persons.age <= 19) & (pemploy != 1) & (schg >=1) & (schg<=14), PSTUDENT_GRADE_OR_HIGH, pstudent)" | ||
,pstudent,"np.where((persons.age > 19) & (pemploy != 1) & (schg >=1) & (schg<=14), PSTUDENT_UNIVERSITY, pstudent)" | ||
,pstudent,"np.where(pstudent == 0, 3, pstudent)" | ||
person type,ptype,np.zeros(len(persons)) | ||
,ptype,"np.where((pemploy == 1), PTYPE_FULL, PTYPE_NONWORK)" | ||
,ptype,"np.where((pstudent == 3) & (pemploy == 2), PTYPE_PART, ptype)" | ||
,ptype,"np.where((pstudent == 3) & (persons['age'] >= 65) & ((pemploy == 3) | (pemploy == 4)), PTYPE_RETIRED, ptype)" | ||
,ptype,"np.where((pstudent == 3) & (persons['age'] < 6) & ((pemploy == 3) | (pemploy == 4)), PTYPE_PRESCHOOL, ptype)" | ||
,ptype,"np.where((pstudent == 3) & (persons['age'] >= 6) & (persons['age'] <= 64) & ((pemploy == 3) | (pemploy == 4)), PTYPE_NONWORK, ptype)" | ||
,ptype,"np.where((pstudent == 2) & ((pemploy == 2) | (pemploy == 3) | (pemploy == 4)), PTYPE_UNIVERSITY, ptype)" | ||
,ptype,"np.where((pstudent == 1) & (persons['age'] < 6) & ((pemploy == 2) | (pemploy == 3) | (pemploy == 4)), PTYPE_PRESCHOOL, ptype)" | ||
,ptype,"np.where((pstudent == 1) & (persons['age'] >= 16) & ((pemploy == 2) | (pemploy == 3) | (pemploy == 4)), PTYPE_DRIVING, ptype)" | ||
,ptype,"np.where((pstudent == 1) & (persons['age'] >= 6) & (persons['age'] < 16) & ((pemploy == 2) | (pemploy == 3) | (pemploy == 4)), PTYPE_SCHOOL, ptype)" | ||
presence of non_worker other than self in household,has_non_worker,"other_than(persons.household_id, ptype == PTYPE_NONWORK)" | ||
presence of retiree other than self in household,has_retiree,"other_than(persons.household_id, ptype == PTYPE_RETIRED)" | ||
presence of preschooler other than self in household,has_preschool_kid,"other_than(persons.household_id, ptype == PTYPE_PRESCHOOL)" | ||
presence of driving_kid other than self in household,has_driving_kid,"other_than(persons.household_id, ptype == PTYPE_DRIVING)" | ||
presence of school_kid other than self in household,has_school_kid,"other_than(persons.household_id, ptype == PTYPE_SCHOOL)" | ||
presence of full_time worker other than self in household (independent of person type),has_full_time,"other_than(persons.household_id, pemploy==PEMPLOY_FULL)" | ||
presence of part_time worker other than self in household (independent of person type),has_part_time,"other_than(persons.household_id, pemploy==PEMPLOY_PART)" | ||
presence of university student other than self in household,has_university,"other_than(persons.household_id, ptype == PTYPE_UNIVERSITY)" | ||
student_is_employed,student_is_employed,"np.where(((ptype == PTYPE_UNIVERSITY) | (ptype == PTYPE_DRIVING)) & ((pemploy == PEMPLOY_FULL) | (pemploy == PEMPLOY_PART)), True, False)" | ||
nonstudent_to_school,nonstudent_to_school,"np.where(((ptype == PTYPE_FULL) | (ptype == PTYPE_PART) | (ptype == PTYPE_NONWORK) | (ptype == PTYPE_RETIRED)) & ((pstudent == PSTUDENT_GRADE_OR_HIGH) | (pstudent == PSTUDENT_UNIVERSITY)), True, False)" | ||
is_student,is_student,"np.where((pstudent == PSTUDENT_GRADE_OR_HIGH) | (pstudent == PSTUDENT_UNIVERSITY), True, False)" | ||
preschool age can go to preschool,is_student,"np.where((pstudent == PSTUDENT_GRADE_OR_HIGH) | (pstudent == PSTUDENT_UNIVERSITY) & (persons.age > GRADE_SCHOOL_MIN_AGE), True, is_student)" | ||
is_gradeschool,is_gradeschool,(pstudent == PSTUDENT_GRADE_OR_HIGH) & (persons.age <= GRADE_SCHOOL_MAX_AGE) | ||
is_highschool,is_highschool,(pstudent == PSTUDENT_GRADE_OR_HIGH) & (persons.age > GRADE_SCHOOL_MAX_AGE) | ||
is_university,is_university,pstudent == PSTUDENT_UNIVERSITY | ||
school_segment gradeschool,school_segment,"np.where(is_gradeschool, SCHOOL_SEGMENT_GRADE, SCHOOL_SEGMENT_NONE)" | ||
school_segment highschool,school_segment,"np.where(is_highschool, SCHOOL_SEGMENT_HIGH, school_segment)" | ||
school_segment university,school_segment,"np.where(is_university, SCHOOL_SEGMENT_UNIV, school_segment).astype(np.int8)" | ||
#,, | ||
is_worker,is_worker,"np.where((pemploy == PEMPLOY_FULL) |( pemploy == PEMPLOY_PART), True, False)" | ||
#,, | ||
home_zone_id,home_zone_id,"reindex(households.home_zone_id, persons.household_id)" | ||
person number,PNUM,persons.per_num | ||
income,income,"reindex(households.hhincadj, persons.household_id)" | ||
income_in_thousands,income_in_thousands,(income / 1000).clip(lower=0) | ||
income_segment,income_segment,"pd.cut(income_in_thousands, bins=[-np.inf, 50, 100, 150, np.inf], labels=[1, 2, 3, 4]).astype(int)" | ||
is_fulltime_worker,is_fulltime_worker,"((age_16_p) & (wkhp >=35) & (wkw>=1) & (wkw<=4) & (~esr.isin([3,6])))" | ||
is_parttime_worker,is_parttime_worker,"((age_16_p) & (~esr.isin([3,6])) & (is_fulltime_worker == False))" |
23 changes: 23 additions & 0 deletions
23
activitysim/examples/prototype_mwcog/configs/annotate_persons_after_hh.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Description,Target,Expression | ||
#,, annotate persons table after annotate_households | ||
#,, adults get full hh_value_of_time and children get 60% | ||
,_hh_vot,"reindex(households.hh_value_of_time, persons.household_id)" | ||
,value_of_time,"_hh_vot.where(persons.age>=18, _hh_vot * 0.667)" | ||
,_hh_income,"reindex(households.hhincadj, persons.household_id)" | ||
,_num_adults,"reindex(households.num_adults, persons.household_id)" | ||
,_num_predrive_child,"reindex(households.num_predrive_child, persons.household_id)" | ||
,_num_nonworker_adults,"reindex(households.num_nonworker_adults, persons.household_id)" | ||
,_num_full_time_workers,"reindex(households.num_fullTime_workers, persons.household_id)" | ||
Income less than 25K,is_income_less25K,(_hh_income)<25000 | ||
Income 25K to 60K,is_income_25K_to_60K,((_hh_income)>=25000) & ((_hh_income)<60000) | ||
Income 60K to 120K,is_income_60K_to_120K, ((_hh_income)>=60000) & ((_hh_income)<120000) | ||
Income greater than 60K,is_income_greater60K,((_hh_income)>=60000) | ||
Income greater than 120K,is_income_greater120K,((_hh_income)>=120000) | ||
Presence of nonworker in HHs,is_non_worker_in_HH,_num_nonworker_adults>0 | ||
all the adults in the HH are full time workers,is_all_adults_full_time_workers,(_num_adults) == (_num_full_time_workers) | ||
Presence of predrive child in HHs,is_pre_drive_child_in_HH,_num_predrive_child>0 | ||
,_has_young_children,"reindex(households.num_young_children, persons.household_id)" | ||
,_has_children_6_to_12,"reindex(households.num_children_6_to_12, persons.household_id)" | ||
has_young_children,has_young_children,_has_young_children>0 | ||
has_children_6_to_12,has_children_6_to_12,_has_children_6_to_12>0 | ||
hh_child,hh_child,"reindex(households.num_children, persons.household_id)" |
6 changes: 6 additions & 0 deletions
6
activitysim/examples/prototype_mwcog/configs/annotate_persons_cdap.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Description,Target,Expression | ||
#,, annotate persons table after cdap model has run | ||
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'))" |
3 changes: 3 additions & 0 deletions
3
activitysim/examples/prototype_mwcog/configs/annotate_persons_jtp.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Description,Target,Expression | ||
#,, annotate persons table after joint_tour_participation model has run | ||
num_joint_tours,num_joint_tours,"joint_tour_participants.groupby('person_id').size().reindex(persons.index).fillna(0).astype(np.int8)" |
Oops, something went wrong.