In [1]:
%load_ext autoreload
%autoreload 2
import orca
from activitysim import defaults

Run this cell to use the test data which comes with the repo

import pandas as pd import numpy as np import os orca.add_injectable("store", pd.HDFStore( os.path.join("..", "activitysim", "defaults", "test", "test.h5"), "r")) orca.add_injectable("nonmotskm_matrix", np.ones((1454, 1454)))

In [2]:
orca.run(["school_location_simulate"])


Running model 'school_location_simulate'
WARNING: Some columns have no variability:
['mode_choice_logsums']
WARNING: Some columns have no variability:
['mode_choice_logsums']
WARNING: Some columns have no variability:
['mode_choice_logsums']
Describe of choices:
count     258.000000
mean      246.577519
std       442.402351
min        -1.000000
25%        -1.000000
50%        -1.000000
75%       352.250000
max      1444.000000
Name: TAZ, dtype: float64
Time to execute model 'school_location_simulate': 9.35s
Total time to execute: 9.35s

In [3]:
orca.run(["workplace_location_simulate"])


Running model 'workplace_location_simulate'
WARNING: Some columns have no variability:
['mode_choice_logsums']
Describe of choices:
count     258.000000
mean      808.961240
std       414.539647
min         1.000000
25%       521.000000
50%       781.000000
75%      1172.750000
max      1452.000000
Name: TAZ, dtype: float64
Time to execute model 'workplace_location_simulate': 7.58s
Total time to execute: 7.58s

In [4]:
print orca.get_table("persons").distance_to_work.describe()


count    258.000000
mean       2.042713
std        1.327850
min        0.220000
25%        1.115000
50%        1.765000
75%        2.710000
max        9.260000
dtype: float64

In [5]:
orca.run(["auto_ownership_simulate"])


Running model 'auto_ownership_simulate'
WARNING: Some columns have no variability:
['@1' 'work_tour_auto_time_savings / (workers+1)']
Choices:
2    38
1    26
3    19
0    12
4     5
dtype: int64
Time to execute model 'auto_ownership_simulate': 0.39s
Total time to execute: 0.39s

In [6]:
orca.run(["cdap_simulate"])


Running model 'cdap_simulate'
Choices:
Home            102
NonMandatory     95
Mandatory        61
dtype: int64
Time to execute model 'cdap_simulate': 6.01s
Total time to execute: 6.01s

In [7]:
orca.run(['mandatory_tour_frequency'])


Running model 'mandatory_tour_frequency'
61 persons run for mandatory tour model
count      61.000000
mean      724.868852
std       432.226271
min         1.000000
25%       409.000000
50%       737.000000
75%      1091.000000
max      1419.000000
Name: workplace_taz, dtype: float64
WARNING: Some columns have no variability:
['(ptype == 6) & student_is_employed' '(ptype == 1) & nonstudent_to_school'
 '(ptype == 2) & nonstudent_to_school'
 '(ptype == 4) & nonstudent_to_school'
 '(ptype == 5) & nonstudent_to_school'
 '(ptype == 2) & (auto_ownership == 0)'
 '(ptype == 3) & (auto_ownership == 0)'
 '(ptype == 5) & (auto_ownership == 0)'
 '(ptype == 6) & (auto_ownership == 0)'
 '(ptype == 6) & (auto_ownership < drivers)'
 '(ptype == 1) * (num_young_children)'
 '(ptype == 5) * (num_young_children)'
 '(ptype == 6) * (num_young_children)'
 '(ptype == 7) * (num_young_children)' '(ptype == 2) & non_family'
 '(ptype == 6) & non_family' '(ptype == 6) & home_is_urban'
 '(ptype == 7) & home_is_urban' '~(workplace_taz > -1)']
Choices:
work1      32
work2      22
school2     4
school1     3
dtype: int64
Time to execute model 'mandatory_tour_frequency': 4.23s
Total time to execute: 4.23s

In [8]:
orca.get_table("mandatory_tours").tour_type.value_counts()


Out[8]:
work      76
school    11
dtype: int64

In [9]:
orca.run(["mandatory_scheduling"])


Running model 'mandatory_scheduling'
Running 11 school tour scheduling choices
Running 7 #1 tour choices
WARNING: Some columns have no variability:
['(ptype == 1) * start' '(ptype == 1) * duration' '(ptype == 4) * start'
 '(workers == hhsize) * duration' '(tour_num > 1) & (start < end_previous)'
 '(tour_num > 1) * duration' '(tour_num > 1) & (duration < 6)'
 'work_and_school_and_worker & (duration < 6)'
 'work_and_school_and_student & (duration < 6)']
Running 4 #2 tour choices
WARNING: Some columns have no variability:
['(ptype == 1) * start' '(ptype == 1) * duration' '(ptype == 4) * start'
 '(workers == hhsize) * duration' '(tour_num == 1) * start'
 '(tour_num == 1) * duration' '(income_in_thousands >= 100) & (start < 6)'
 '(income_in_thousands >= 100) & (end > 22)'
 '(tour_num == 1) & (duration < 6)'
 'work_and_school_and_worker & (duration < 6)'
 'work_and_school_and_student & (duration < 6)']
Running 76 work tour scheduling choices
Running 54 #1 tour choices
WARNING: Some columns have no variability:
['(start <= end_previous) & (tour_num == 2)' '(tour_num == 2) * start'
 '(tour_num == 2) * duration' 'home_is_rural & (start < 6)'
 'home_is_rural & (end > 22)' '(tour_num == 2) & (duration < 8)'
 "(mandatory_tour_frequency == 'work_and_school') & is_worker & (duration < 8)"
 "(mandatory_tour_frequency == 'work_and_school') & is_student & (duration < 8)"]
Running 22 #2 tour choices
WARNING: Some columns have no variability:
['(ptype == 3) * start' '(tour_num == 1) * start'
 '(tour_num == 1) * duration' 'home_is_rural & (start < 6)'
 'home_is_rural & (end > 22)' '(tour_num == 1) & (duration < 8)'
 "(mandatory_tour_frequency == 'work_and_school') & is_worker & (duration < 8)"
 "(mandatory_tour_frequency == 'work_and_school') & is_student & (duration < 8)"]
Choices:
count     87.000000
mean     151.563218
std       71.138042
min        0.000000
25%      171.500000
50%      188.000000
75%      189.000000
max      189.000000
dtype: float64
Time to execute model 'mandatory_scheduling': 5.17s
Total time to execute: 5.17s

In [10]:
orca.run(['non_mandatory_tour_frequency'])


Running model 'non_mandatory_tour_frequency'
156 persons run for non-mandatory tour model
Running segment 'driving' of size 6
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'
 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'
 'no_cars & (tot_tours >  4)' '(car_sufficiency > 0) & (tot_tours == 1)'
 '(car_sufficiency > 0) & (tot_tours == 2)'
 '(car_sufficiency > 0) & (tot_tours == 3)'
 '(car_sufficiency > 0) & (tot_tours == 4)'
 '(car_sufficiency > 0) & (tot_tours > 4)' 'has_driving_kid * escort'
 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'
 'has_driving_kid * shopping' 'has_school_kid_at_home * shopping'
 'has_preschool_kid_at_home * shopping' 'has_driving_kid * othmaint'
 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'
 'has_driving_kid * eatout' 'has_school_kid_at_home * eatout'
 'has_preschool_kid_at_home * eatout' 'has_driving_kid * othdiscr'
 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'
 'escort * no_cars']
Running segment 'full' of size 46
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 '(car_sufficiency > 0) & (tot_tours == 1)'
 '(car_sufficiency > 0) & (tot_tours == 2)'
 '(car_sufficiency > 0) & (tot_tours == 3)'
 '(car_sufficiency > 0) & (tot_tours == 4)'
 '(car_sufficiency > 0) & (tot_tours > 4)'
 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'
 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'
 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'
 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'
 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']
Running segment 'nonwork' of size 38
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 'has_retiree & (tot_tours == 1)' 'has_retiree & (tot_tours == 2)'
 'has_retiree & (tot_tours == 3)' 'has_retiree & (tot_tours == 4)'
 'has_retiree & (tot_tours == 5)' 'has_retiree * escort'
 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'
 'has_retiree * shopping' 'has_school_kid_at_home * shopping'
 'has_preschool_kid_at_home * shopping' 'has_retiree * othmaint'
 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'
 'has_retiree * eatout' 'has_school_kid_at_home * eatout'
 'has_preschool_kid_at_home * eatout' 'has_retiree * othdiscr'
 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']
Running segment 'part' of size 13
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'
 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'
 'no_cars & (tot_tours >  4)' '(car_sufficiency > 0) & (tot_tours == 1)'
 '(car_sufficiency > 0) & (tot_tours == 2)'
 '(car_sufficiency > 0) & (tot_tours == 3)'
 '(car_sufficiency > 0) & (tot_tours == 4)'
 '(car_sufficiency > 0) & (tot_tours > 4)'
 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'
 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'
 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'
 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'
 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'
 'escort * no_cars']
Running segment 'preschool' of size 12
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 '(100 < income_in_thousands) & (tot_tours == 1)'
 '(100 < income_in_thousands) & (tot_tours == 2)'
 '(100 < income_in_thousands) & (tot_tours == 3)'
 '(100 < income_in_thousands) & (tot_tours == 4)'
 '(100 < income_in_thousands) & (tot_tours >  4)'
 '(100 < income_in_thousands) * shopping'
 '(100 < income_in_thousands) * othmaint'
 '(100 < income_in_thousands) * eatout'
 '(100 < income_in_thousands) * othdiscr'
 '(100 < income_in_thousands) * social' 'no_cars & (tot_tours == 1)'
 'no_cars & (tot_tours == 2)' 'no_cars & (tot_tours == 3)'
 'no_cars & (tot_tours == 4)' 'no_cars & (tot_tours >  4)'
 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'
 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'
 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'
 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'
 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'
 'escort * no_cars']
Running segment 'retired' of size 14
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 '(100 < income_in_thousands) & (tot_tours == 1)'
 '(100 < income_in_thousands) & (tot_tours == 2)'
 '(100 < income_in_thousands) & (tot_tours == 3)'
 '(100 < income_in_thousands) & (tot_tours == 4)'
 '(100 < income_in_thousands) & (tot_tours >  4)'
 '(100 < income_in_thousands) * shopping'
 '(100 < income_in_thousands) * othmaint'
 '(100 < income_in_thousands) * eatout'
 '(100 < income_in_thousands) * othdiscr'
 '(100 < income_in_thousands) * social'
 '(car_sufficiency > 0) & (tot_tours == 1)'
 '(car_sufficiency > 0) & (tot_tours == 2)'
 '(car_sufficiency > 0) & (tot_tours == 3)'
 '(car_sufficiency > 0) & (tot_tours == 4)'
 '(car_sufficiency > 0) & (tot_tours > 4)'
 'has_non_worker & (tot_tours == 1)' 'has_non_worker & (tot_tours == 2)'
 'has_non_worker & (tot_tours == 3)' 'has_non_worker & (tot_tours == 4)'
 'has_non_worker & (tot_tours == 5)' 'has_preschool_kid & (tot_tours == 1)'
 'has_preschool_kid & (tot_tours == 2)'
 'has_preschool_kid & (tot_tours == 3)'
 'has_preschool_kid & (tot_tours == 4)'
 'has_preschool_kid & (tot_tours == 5)' 'has_non_worker * escort'
 'has_driving_kid * escort' 'has_preschool_kid * escort'
 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'
 'has_non_worker * shopping' 'has_driving_kid * shopping'
 'has_preschool_kid * shopping' 'has_school_kid_at_home * shopping'
 'has_preschool_kid_at_home * shopping' 'has_non_worker * othmaint'
 'has_driving_kid * othmaint' 'has_preschool_kid * othmaint'
 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'
 'has_non_worker * eatout' 'has_driving_kid * eatout'
 'has_preschool_kid * eatout' 'has_school_kid_at_home * eatout'
 'has_preschool_kid_at_home * eatout' 'has_non_worker * othdiscr'
 'has_driving_kid * othdiscr' 'has_preschool_kid * othdiscr'
 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']
Running segment 'school' of size 19
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 'has_university * escort' 'has_school_kid_at_home * escort'
 'has_preschool_kid_at_home * escort' 'has_university * shopping'
 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'
 'has_university * othmaint' 'has_school_kid_at_home * othmaint'
 'has_preschool_kid_at_home * othmaint' 'has_university * eatout'
 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'
 'has_university * othdiscr' 'has_school_kid_at_home * othdiscr'
 'has_preschool_kid_at_home * othdiscr']
Running segment 'university' of size 8
WARNING: Some columns have no variability:
['num_joint_tours*(tot_tours == 0)' 'num_joint_tours*(tot_tours == 1)'
 'num_joint_tours*(tot_tours == 2)' 'num_joint_tours*(tot_tours == 3)'
 'num_joint_tours*(tot_tours == 4)' 'num_joint_tours*(tot_tours >  4)'
 'num_shop_j' 'num_main_j' 'num_eat_j' 'num_visi_j' 'num_disc_j'
 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'
 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'
 'max_window*(tot_tours == 4)' 'max_window*(tot_tours >  4)'
 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'
 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'
 'no_cars & (tot_tours >  4)' 'has_retiree & (tot_tours == 1)'
 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'
 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'
 'has_school_kid & (tot_tours == 1)' 'has_school_kid & (tot_tours == 2)'
 'has_school_kid & (tot_tours == 3)' 'has_school_kid & (tot_tours == 4)'
 'has_school_kid & (tot_tours == 5)' 'has_retiree * escort'
 'has_school_kid * escort' 'has_school_kid_at_home * escort'
 'has_preschool_kid_at_home * escort' 'has_retiree * shopping'
 'has_school_kid * shopping' 'has_school_kid_at_home * shopping'
 'has_preschool_kid_at_home * shopping' 'has_retiree * othmaint'
 'has_school_kid * othmaint' 'has_school_kid_at_home * othmaint'
 'has_preschool_kid_at_home * othmaint' 'has_retiree * eatout'
 'has_school_kid * eatout' 'has_school_kid_at_home * eatout'
 'has_preschool_kid_at_home * eatout' 'has_retiree * othdiscr'
 'has_school_kid * othdiscr' 'has_school_kid_at_home * othdiscr'
 'has_preschool_kid_at_home * othdiscr' 'escort * no_cars']
Choices:
0     61
1     21
16    17
8      9
4      8
2      7
64     6
32     5
17     3
3      2
80     2
33     2
20     1
72     1
21     1
24     1
13     1
12     1
9      1
25     1
5      1
48     1
53     1
56     1
18     1
dtype: int64
Time to execute model 'non_mandatory_tour_frequency': 11.53s
Total time to execute: 11.53s

In [11]:
orca.get_table("non_mandatory_tours").tour_type.value_counts()


Out[11]:
othdiscr    34
shopping    30
escort      28
othmaint    16
eatout      14
social      10
dtype: int64

In [12]:
orca.run(["destination_choice"])


Running model 'destination_choice'
Running segment 'eatout' of size 14
Running segment 'shopping' of size 28
Running segment 'othdiscr' of size 34
Running segment 'othmaint' of size 16
Running segment 'shopping' of size 30
Running segment 'social' of size 10
Choices:
count     132.000000
mean      807.893939
std       402.766374
min         1.000000
25%       559.000000
50%       746.500000
75%      1134.250000
max      1452.000000
Name: TAZ, dtype: float64
Time to execute model 'destination_choice': 5.24s
Total time to execute: 5.24s

In [13]:
orca.run(["non_mandatory_scheduling"])


Running model 'non_mandatory_scheduling'
Running 132 non-mandatory tour scheduling choices
Running 95 #1 tour choices
WARNING: Some columns have no variability:
['(start <= end_previous) & (tour_num > 1)'
 '(tour_type == "oth_maint") * start'
 '(tour_type == "oth_maint") * duration' 'num_mand  * start'
 'num_joint_tours * start' '(tour_num > 1) * duration'
 '(tour_type == "oth_maint") & (start < 7)'
 '(tour_type == "othdisc") & (duration < 2)']
Running 28 #2 tour choices
WARNING: Some columns have no variability:
['(tour_type == "oth_maint") * start'
 '(tour_type == "oth_maint") * duration' '(ptype == 6) * start'
 '(ptype == 6) * duration' 'num_mand  * start' 'num_joint_tours * start'
 '(tour_num == 1) * start' '(tour_type == "oth_maint") & (start < 7)'
 '(tour_type == "othdisc") & (duration < 2)']
Running 8 #3 tour choices
WARNING: Some columns have no variability:
['(tour_type == "oth_maint") * start'
 '(tour_type == "oth_maint") * duration' '(tour_type == "social") * start'
 '(tour_type == "social") * duration' '(ptype == 6) * start'
 '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'
 'destination_in_cbd * duration' 'num_mand  * start'
 'num_joint_tours * start' '(tour_num == 1) * start'
 '(tour_type == "oth_maint") & (start < 7)' '(ptype == 7) & (end > 22)'
 '(tour_type == "othdisc") & (duration < 2)'
 '(tour_type == "escort") & (start < 6)'
 '(tour_type == "escort") & (start == 6)'
 '(tour_type == "escort") & (start == 7)'
 '(tour_type == "escort") & (start == 8)'
 '(tour_type == "escort") & (start == 9)'
 '(tour_type == "escort") & (start > 9) & (start < 13)'
 '(tour_type == "escort") & (start > 12) & (start < 16)'
 '(tour_type == "escort") & (start > 15) & (start < 19)'
 '(tour_type == "escort") & (start > 18) & (start < 22)'
 '(tour_type == "escort") & (start > 21)'
 '(tour_type == "escort") & (end < 7)'
 '(tour_type == "escort") & (end > 6) & (end < 10)'
 '(tour_type == "escort") & (end > 9) & (end < 13)'
 '(tour_type == "escort") & (end > 12) & (end < 15)'
 '(tour_type == "escort") & (end == 15)'
 '(tour_type == "escort") & (end == 16)'
 '(tour_type == "escort") & (end == 17)'
 '(tour_type == "escort") & (end == 18)'
 '(tour_type == "escort") & (end > 18) & (end < 22)'
 '(tour_type == "escort") & (end > 21)'
 '(tour_type == "escort") & (duration < 2)'
 '(tour_type == "escort") & (duration > 1) & (duration < 4)'
 '(tour_type == "escort") & (duration > 3) & (duration < 6)'
 '(tour_type == "escort") & (duration > 5) & (duration < 8)'
 '(tour_type == "escort") & (duration > 7) & (duration < 11)'
 '(tour_type == "escort") & (duration > 10) & (duration < 14)'
 '(tour_type == "escort") & (duration > 13) & (duration < 19)']
Running 1 #4 tour choices
WARNING: Some columns have no variability:
['(start <= end_previous) & (tour_num > 1)'
 '(tour_type == "shopping") * start' '(tour_type == "shopping") * duration'
 '(tour_type == "oth_maint") * start'
 '(tour_type == "oth_maint") * duration' '(tour_type == "social") * start'
 '(tour_type == "social") * duration' '(ptype == 6) * start'
 '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'
 'destination_in_cbd * duration' 'num_mand  * start'
 'num_joint_tours * start' '(tour_num == 1) * start'
 '(tour_type == "oth_maint") & (start < 7)'
 '(tour_type == "shopping") & (start < 8)'
 '(tour_type == "shopping") & (end > 22)' '(ptype == 7) & (end > 22)'
 '(ptype == 3) & (end > 22)' '(tour_type == "shopping") & (duration < 2)'
 '(tour_type == "othdisc") & (duration < 2)'
 'adult & (num_children > 0) & ( end > 18 ) & ( end < 22 )'
 '(tour_type == "escort") & (start < 6)'
 '(tour_type == "escort") & (start == 6)'
 '(tour_type == "escort") & (start == 7)'
 '(tour_type == "escort") & (start == 8)'
 '(tour_type == "escort") & (start == 9)'
 '(tour_type == "escort") & (start > 9) & (start < 13)'
 '(tour_type == "escort") & (start > 12) & (start < 16)'
 '(tour_type == "escort") & (start > 15) & (start < 19)'
 '(tour_type == "escort") & (start > 18) & (start < 22)'
 '(tour_type == "escort") & (start > 21)'
 '(tour_type == "escort") & (end < 7)'
 '(tour_type == "escort") & (end > 6) & (end < 10)'
 '(tour_type == "escort") & (end > 9) & (end < 13)'
 '(tour_type == "escort") & (end > 12) & (end < 15)'
 '(tour_type == "escort") & (end == 15)'
 '(tour_type == "escort") & (end == 16)'
 '(tour_type == "escort") & (end == 17)'
 '(tour_type == "escort") & (end == 18)'
 '(tour_type == "escort") & (end > 18) & (end < 22)'
 '(tour_type == "escort") & (end > 21)'
 '(tour_type == "escort") & (duration < 2)'
 '(tour_type == "escort") & (duration > 1) & (duration < 4)'
 '(tour_type == "escort") & (duration > 3) & (duration < 6)'
 '(tour_type == "escort") & (duration > 5) & (duration < 8)'
 '(tour_type == "escort") & (duration > 7) & (duration < 11)'
 '(tour_type == "escort") & (duration > 10) & (duration < 14)'
 '(tour_type == "escort") & (duration > 13) & (duration < 19)']
Choices:
count    132.000000
mean     150.969697
std       75.061597
min        0.000000
25%      187.000000
50%      188.000000
75%      189.000000
max      189.000000
dtype: float64
Time to execute model 'non_mandatory_scheduling': 6.12s
Total time to execute: 6.12s

In [14]:
orca.run(['mode_choice_simulate'])


Running model 'mode_choice_simulate'
Expression                                                             Rowid  Alternative   
sov_available == False                                                 0      DRIVEALONEFREE   -999.000000
auto_ownership == 0                                                    1      DRIVEALONEFREE   -999.000000
age < 16                                                               2      DRIVEALONEFREE   -999.000000
is_joint                                                               3      DRIVEALONEFREE   -999.000000
work_tour_is_drive                                                     4      DRIVEALONEFREE   -999.000000
@out_skims['SOV_TIME'] + in_skims['SOV_TIME']                          5      DRIVEALONEFREE     -0.017500
2 * terminal_time                                                      6      DRIVEALONEFREE     -0.035000
@costPerMile * (out_skims['SOV_DIST'] + in_skims['SOV_DIST'])          7      DRIVEALONEFREE     -0.001313
daily_parking_cost                                                     8      DRIVEALONEFREE     -0.001313
@out_skims['SOV_BTOLL'] + in_skims['SOV_BTOLL']                        9      DRIVEALONEFREE     -0.001313
age_16_to_19                                                           10     DRIVEALONEFREE      0.000000
sovtoll_available == False                                             11     DRIVEALONEPAY    -999.000000
auto_ownership == 0                                                    12     DRIVEALONEPAY    -999.000000
age < 16                                                               13     DRIVEALONEPAY    -999.000000
is_joint                                                               14     DRIVEALONEPAY    -999.000000
work_tour_is_drive                                                     15     DRIVEALONEPAY    -999.000000
@out_skims['SOVTOLL_TIME'] + in_skims['SOVTOLL_TIME']                  16     DRIVEALONEPAY      -0.017500
2 * terminal_time                                                      17     DRIVEALONEPAY      -0.035000
@costPerMile * (out_skims['SOVTOLL_DIST'] + in_skims['SOVTOLL_DIST'])  18     DRIVEALONEPAY      -0.001313
daily_parking_cost                                                     19     DRIVEALONEPAY      -0.001313
@out_skims['SOVTOLL_BTOLL'] + in_skims['SOVTOLL_BTOLL']                20     DRIVEALONEPAY      -0.001313
@out_skims['SOVTOLL_VTOLL'] + in_skims['SOVTOLL_VTOLL']                21     DRIVEALONEPAY      -0.001313
age_16_to_19                                                           22     DRIVEALONEPAY       0.000000
hov2_available == False                                                23     SHARED2FREE      -999.000000
is_joint & (number_of_participants > 2)                                24     SHARED2FREE      -999.000000
@out_skims['HOV2_TIME'] + in_skims['HOV2_TIME']                        25     SHARED2FREE        -0.017500
2 * terminal_time                                                      26     SHARED2FREE        -0.035000
@costPerMile * (out_skims['HOV2_DIST'] + in_skims['HOV2_DIST'])        27     SHARED2FREE        -0.001313
@df.daily_parking_cost / costShareSr2                                  28     SHARED2FREE        -0.001313
@(out_skims['HOV2_BTOLL'] + in_skims['HOV2_BTOLL']) / costShareSr2     29     SHARED2FREE        -0.001313
                                                                                                   ...    
1                                                                      257    DRIVE_EXP           0.525000
                                                                              DRIVE_HVY           0.525000
                                                                              DRIVE_COM           0.525000
                                                                       258    DRIVE_LOC           0.525000
                                                                              DRIVE_LRF           0.525000
                                                                              DRIVE_EXP           0.525000
                                                                              DRIVE_HVY           0.525000
                                                                              DRIVE_COM           0.525000
                                                                       259    WALK_LOC           -0.090703
                                                                              DRIVE_LOC          -0.090703
                                                                       260    WALK_LRF            0.940124
                                                                       261    DRIVE_LRF           0.940124
                                                                       262    WALK_LRF            0.940124
                                                                       263    DRIVE_LRF           0.940124
                                                                       264    WALK_EXP            0.969232
                                                                              DRIVE_EXP           0.969232
                                                                       265    WALK_HVY            0.770612
                                                                              DRIVE_HVY           0.770612
                                                                       266    WALK_COM            0.727019
                                                                              DRIVE_COM           0.727019
                                                                       267    WALK_LOC            0.525000
                                                                              WALK_LRF            0.525000
                                                                              WALK_EXP            0.525000
                                                                              WALK_HVY            0.525000
                                                                              WALK_COM            0.525000
                                                                       268    DRIVE_LOC           0.525000
                                                                              DRIVE_LRF           0.525000
                                                                              DRIVE_EXP           0.525000
                                                                              DRIVE_HVY           0.525000
                                                                              DRIVE_COM           0.525000
Name: eatout, dtype: float64
WARNING, skipping key:  DISTANCE
WARNING, skipping key:  DISTANCE
WARNING: Some columns have no variability:
['1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1'
 '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1'
 '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '2 * destination_walk_time'
 '2 * destination_walk_time' '2 * destination_walk_time'
 '2 * destination_walk_time' '2 * destination_walk_time'
 '2 * destination_walk_time' '2 * destination_walk_time'
 '2 * destination_walk_time' '2 * destination_walk_time'
 '2 * destination_walk_time' '2 * origin_walk_time' '2 * origin_walk_time'
 '2 * origin_walk_time' '2 * origin_walk_time' '2 * origin_walk_time'
 '2 * origin_walk_time' '2 * origin_walk_time' '2 * origin_walk_time'
 '2 * origin_walk_time' '2 * origin_walk_time' '2 * terminal_time'
 '2 * terminal_time' '2 * terminal_time' '2 * terminal_time'
 '2 * terminal_time' '2 * terminal_time'
 "@(out_skims['DRV_COM_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_COM_DRV_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['DRV_EXP_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_EXP_DRV_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['DRV_HVY_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_HVY_DRV_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['DRV_LOC_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_LOC_DRV_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['DRV_LRF_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_LRF_DRV_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['WLK_COM_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_COM_WLK_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['WLK_EXP_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_EXP_WLK_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['WLK_HVY_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_HVY_WLK_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['WLK_LOC_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_LOC_WLK_IWAIT']/100-waitThresh).clip(0)"
 "@(out_skims['WLK_LRF_WLK_IWAIT']/100-waitThresh).clip(0)+ (in_skims['WLK_LRF_WLK_IWAIT']/100-waitThresh).clip(0)"
 '@df.daily_parking_cost / costShareSr2'
 '@df.daily_parking_cost / costShareSr2'
 '@df.daily_parking_cost / costShareSr3'
 '@df.daily_parking_cost / costShareSr3' 'auto_ownership == 0'
 'auto_ownership == 0' 'auto_ownership == 0' 'auto_ownership == 0'
 'auto_ownership == 0' 'auto_ownership == 0' 'auto_ownership == 0'
 'daily_parking_cost' 'daily_parking_cost'
 'drive_commuter_available == False' 'drive_express_available == False'
 'drive_heavyrail_available == False' 'drive_local_available == False'
 'drive_lrf_available == False' 'hhsize == 1' 'hhsize == 1' 'hhsize == 1'
 'hhsize == 1' 'hov2_available == False' 'hov2toll_available == False'
 'hov3_available == False' 'hov3_available == False' 'is_joint' 'is_joint'
 'is_joint & (number_of_participants > 2)'
 'is_joint & (number_of_participants > 2)' 'sov_available == False'
 'sovtoll_available == False' 'walk_commuter_available == False'
 'walk_express_available == False' 'walk_heavyrail_available == False'
 'walk_local_available == False' 'walk_lrf_available == False'
 'work_tour_is_drive' 'work_tour_is_drive']
Choices:
WALK_LRF     3
WALK_EXP     3
DRIVE_LOC    2
DRIVE_HVY    2
WALK_LOC     1
WALK_COM     1
DRIVE_LRF    1
DRIVE_EXP    1
dtype: int64
Time to execute model 'mode_choice_simulate': 6.96s
Total time to execute: 6.96s

In [17]:
orca.get_table("land_use").to_frame().info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 1454 entries, 1 to 1454
Data columns (total 49 columns):
DISTRICT              1454 non-null int64
SD                    1454 non-null int64
COUNTY                1454 non-null int64
TOTHH                 1454 non-null int64
HHPOP                 1454 non-null int64
TOTPOP                1454 non-null int64
EMPRES                1454 non-null int64
SFDU                  1454 non-null int64
MFDU                  1454 non-null int64
HHINCQ1               1454 non-null int64
HHINCQ2               1454 non-null int64
HHINCQ3               1454 non-null int64
HHINCQ4               1454 non-null int64
TOTACRE               1454 non-null float64
RESACRE               1454 non-null int64
CIACRE                1454 non-null int64
SHPOP62P              1454 non-null float64
TOTEMP                1454 non-null int64
AGE0004               1454 non-null int64
AGE0519               1454 non-null int64
AGE2044               1454 non-null int64
AGE4564               1454 non-null int64
AGE65P                1454 non-null int64
RETEMPN               1454 non-null int64
FPSEMPN               1454 non-null int64
HEREMPN               1454 non-null int64
OTHEMPN               1454 non-null int64
AGREMPN               1454 non-null int64
MWTEMPN               1454 non-null int64
PRKCST                1454 non-null float64
OPRKCST               1454 non-null float64
area_type             1454 non-null int64
HSENROLL              1454 non-null float64
COLLFTE               1454 non-null float64
COLLPTE               1454 non-null float64
TOPOLOGY              1454 non-null int64
TERMINAL              1454 non-null float64
ZERO                  1454 non-null int64
hhlds                 1454 non-null int64
sftaz                 1454 non-null int64
gqpop                 1454 non-null int64
employment_density    1454 non-null float64
total_acres           1454 non-null float64
county_name           1454 non-null object
density_index         1453 non-null float64
household_density     1454 non-null float64
county_id             1454 non-null int64
total_households      1454 non-null int64
total_employment      1454 non-null int64
dtypes: float64(12), int64(36), object(1)
memory usage: 568.0 KB

In [18]:
orca.get_table("households").to_frame().info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 100 entries, 2624246 to 558870
Data columns (total 67 columns):
TAZ                            100 non-null int64
SERIALNO                       100 non-null int64
PUMA5                          100 non-null int64
income                         100 non-null int64
PERSONS                        100 non-null int64
HHT                            100 non-null int64
UNITTYPE                       100 non-null int64
NOC                            100 non-null int64
BLDGSZ                         100 non-null int64
TENURE                         100 non-null int64
VEHICL                         100 non-null int64
hinccat1                       100 non-null int64
hinccat2                       100 non-null int64
hhagecat                       100 non-null int64
hsizecat                       100 non-null int64
hfamily                        100 non-null int64
hunittype                      100 non-null int64
hNOCcat                        100 non-null int64
hwrkrcat                       100 non-null int64
h0004                          100 non-null int64
h0511                          100 non-null int64
h1215                          100 non-null int64
h1617                          100 non-null int64
h1824                          100 non-null int64
h2534                          100 non-null int64
h3549                          100 non-null int64
h5064                          100 non-null int64
h6579                          100 non-null int64
h80up                          100 non-null int64
workers                        100 non-null int64
hwork_f                        100 non-null int64
hwork_p                        100 non-null int64
huniv                          100 non-null int64
hnwork                         100 non-null int64
hretire                        100 non-null int64
hpresch                        100 non-null int64
hschpred                       100 non-null int64
hschdriv                       100 non-null int64
htypdwel                       100 non-null int64
hownrent                       100 non-null int64
hadnwst                        100 non-null int64
hadwpst                        100 non-null int64
hadkids                        100 non-null int64
bucketBin                      100 non-null int64
originalPUMA                   100 non-null int64
hmultiunit                     100 non-null int64
num_college_age                100 non-null float64
non_workers                    100 non-null int64
income_segment                 100 non-null category
family                         100 non-null bool
num_young_adults               100 non-null float64
household_type                 96 non-null object
auto_ownership                 100 non-null int64
drivers                        100 non-null int64
income_in_thousands            100 non-null float64
home_is_rural                  100 non-null bool
work_tour_auto_time_savings    100 non-null int64
num_under16_not_at_school      100 non-null int64
hhsize                         100 non-null int64
num_children                   100 non-null float64
car_sufficiency                100 non-null int64
non_family                     100 non-null bool
num_adolescents                100 non-null float64
no_cars                        100 non-null bool
num_young_children             100 non-null float64
home_is_urban                  100 non-null bool
home_taz                       100 non-null int64
dtypes: bool(5), category(1), float64(6), int64(54), object(1)
memory usage: 49.1 KB

In [19]:
orca.get_table("persons").to_frame().info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 267 entries, 84601 to 6968468
Data columns (total 68 columns):
household_id                     267 non-null int64
age                              267 non-null int64
RELATE                           267 non-null int64
ESR                              267 non-null int64
GRADE                            267 non-null int64
PNUM                             267 non-null int64
PAUG                             267 non-null int64
DDP                              267 non-null int64
sex                              267 non-null int64
WEEKS                            267 non-null int64
HOURS                            267 non-null int64
MSP                              267 non-null int64
POVERTY                          267 non-null int64
EARNS                            267 non-null int64
pagecat                          267 non-null int64
pemploy                          267 non-null int64
pstudent                         267 non-null int64
ptype                            267 non-null int64
padkid                           267 non-null int64
has_preschool_kid                267 non-null bool
student_cat                      267 non-null object
num_eat_j                        267 non-null int64
has_driving_kid                  267 non-null bool
home_taz                         267 non-null int64
work_and_school_and_worker       267 non-null bool
work_and_school_and_student      267 non-null bool
female                           267 non-null bool
has_preschool_kid_at_home        267 non-null bool
has_full_time                    267 non-null bool
is_university                    267 non-null bool
max_window                       267 non-null int64
employed_cat                     267 non-null object
student_is_employed              267 non-null bool
is_gradeschool                   267 non-null bool
is_highschool                    267 non-null bool
has_retiree                      267 non-null bool
cdap_activity                    267 non-null object
num_main_j                       267 non-null int64
num_joint_tours                  267 non-null int64
has_non_worker                   267 non-null bool
ptype_cat                        267 non-null object
is_student                       267 non-null bool
under16_not_at_school            267 non-null bool
has_school_kid                   267 non-null bool
school_taz                       267 non-null float64
is_worker                        267 non-null bool
roundtrip_auto_time_to_school    267 non-null float64
distance_to_school               267 non-null float64
age_16_p                         267 non-null bool
workplace_taz                    267 non-null int64
workplace_in_cbd                 267 non-null bool
has_university                   267 non-null bool
adult                            267 non-null bool
non_mandatory_tour_frequency     164 non-null float64
nonstudent_to_school             267 non-null bool
age_16_to_19                     267 non-null bool
num_non_escort_tours             267 non-null float64
mandatory_tour_frequency         80 non-null object
num_shop_j                       267 non-null int64
num_mand                         267 non-null float64
num_visi_j                       267 non-null int64
num_escort_tours                 267 non-null float64
roundtrip_auto_time_to_work      267 non-null float64
num_disc_j                       267 non-null int64
has_part_time                    267 non-null bool
has_school_kid_at_home           267 non-null bool
distance_to_work                 267 non-null float64
male                             267 non-null bool
dtypes: bool(26), float64(9), int64(28), object(5)
memory usage: 96.5 KB

The cell below is used to create small a dataset for testing

import orca from activitysim import activitysim as asim from activitysim import defaults import pandas as pd old_store = orca.get_injectable('store') print old_store # subset of the whole store new_store = pd.HDFStore('test.h5', 'w') new_store["land_use/taz_data"] = old_store["land_use/taz_data"] new_store["skims/accessibility"] = old_store["skims/accessibility"] new_store["households"] = asim.random_rows(old_store["households"], 1000) new_store["persons"] = old_store["persons"][ old_store["persons"].household_id.isin(new_store["households"].index) ] print new_store new_store.close()

In [19]:


In [19]:


In [ ]: