Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include in notebooks #76

Open
ifarah opened this issue May 16, 2019 · 0 comments
Open

Include in notebooks #76

ifarah opened this issue May 16, 2019 · 0 comments
Assignees

Comments

@ifarah
Copy link
Collaborator

ifarah commented May 16, 2019

Automated case

years=list(range(1990, 2011, 10))
years_string=list(map(str, years))
all_y=[x[2:] for x in years_string]

Matrix:

from spatial_access.p2p import TransitMatrix
from spatial_access.Configs import Configs
custom_config = Configs()
custom_config.disable_area_threshold=True


for i in all_y:
    w_asym_mat = TransitMatrix(network_type='walk',
                       primary_input='ORIG/tracts_chi.csv',
                       primary_hints={'lon': 'lon', 'lat': 'lat', 'idx': 'ID'},
                       secondary_hints={'lon': 'lon', 'lat': 'lat', 'idx': 'ID'},
                       secondary_input='DEST/nets_ws/chi_nets'+str(i)+'.csv', 
                       configs=custom_config)
    w_asym_mat.process()
    w_asym_mat.write_tmx('matrices/mat_chi'+str(i)+'.tmx')

Models:

from spatial_access.Models import *

dict = {
"groceries": [3,3,3,3,3,3,3,3,3,3],
"restaurants": [1,1,1,1,1, 1, .75, .75, .75, .75],
"shopping": [1,1,1, 1, 1,1, 1, 1, .5, .5],
"coffee": [1,1,1, 1,1,1,.75,.75,.75, .75],
"banks": [1,1,1,1,1,1,1,1,1,1],
"park": [1,1,1,1,1,1,1,1,1,1],
"school": [1,1,1,1,1,1,1,1,1,1],
"books": [1,1,1,1,1,1,1,1,1,1],
"entertainment": [1,1,1,1,1,1,1,1,1,1],
}

for i in all_y:
    accesst = AccessModel(network_type='walk',
                     transit_matrix_filename='matrices/mat_chi'+str(i)+'.tmx',
                     sources_filename='ORIG/tracts_chi.csv',
                     source_column_names={'idx': 'ID', 'population': 'skip', 'lat': 'lat', 'lon': 'lon'},
                     dest_column_names={'idx': 'ID', 'category': 'cat', 'capacity': 'skip', 'lat': 'lat', 'lon': 'lon'},
                     destinations_filename='DEST/nets_ws/chi_nets'+str(i)+'.csv',
                     decay_function='logit')
    accesst.calculate(upper_threshold=1800, category_weight_dict=dict, normalize=False)
    accesst.write_results('access/access_chi'+str(i)+'.csv')
@ifarah ifarah self-assigned this May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant