Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -119,6 +119,9 @@ CLIENT.authenticate_with_token(token=speckleToken)
|
|
119 |
streamDistanceMatrices = speckle_utils.getSpeckleStream(streamId,branch_name_dm,CLIENT, commit_id_dm)
|
120 |
matrices = fetchDistanceMatrices (streamDistanceMatrices)
|
121 |
df_dm = matrices[distanceMatrixActivityNodes]
|
|
|
|
|
|
|
122 |
dm_dictionary = df_dm.to_dict('index')
|
123 |
|
124 |
"""
|
@@ -189,7 +192,7 @@ def test(input_json):
|
|
189 |
|
190 |
return result_dicts
|
191 |
|
192 |
-
result_dicts = split_dict_by_subkey(
|
193 |
|
194 |
# Accessing each dictionary
|
195 |
art_dict = result_dicts["DRT"]
|
@@ -204,7 +207,7 @@ def test(input_json):
|
|
204 |
|
205 |
|
206 |
# create a mask based on the matrix size and ids, crop activity nodes to the mask
|
207 |
-
mask_connected =
|
208 |
|
209 |
valid_indexes = [idx for idx in mask_connected if idx in df_landuses.index]
|
210 |
# Identify and report missing indexes
|
@@ -262,7 +265,7 @@ def test(input_json):
|
|
262 |
|
263 |
|
264 |
|
265 |
-
LivabilitySubdomainsWeights = landusesToSubdomains(
|
266 |
|
267 |
|
268 |
|
@@ -284,7 +287,7 @@ def test(input_json):
|
|
284 |
return df_LivabilitySubdomainsWorkplaces
|
285 |
|
286 |
|
287 |
-
WorkplacesNumber = FindWorkplaces(
|
288 |
|
289 |
# prepare an input weights dataframe for the parameter LivabilitySubdomainsInputs
|
290 |
LivabilitySubdomainsInputs =pd.concat([LivabilitySubdomainsWeights, WorkplacesNumber], axis=1)
|
@@ -320,7 +323,7 @@ def test(input_json):
|
|
320 |
|
321 |
|
322 |
|
323 |
-
subdomainsAccessibility = computeAccessibility(
|
324 |
artAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'ART',alpha,threshold)
|
325 |
gmtAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'GMT+HSR',alpha,threshold)
|
326 |
|
@@ -375,7 +378,7 @@ def test(input_json):
|
|
375 |
|
376 |
|
377 |
|
378 |
-
livability = accessibilityToLivability(
|
379 |
|
380 |
|
381 |
livability_dictionary = livability.to_dict('index')
|
|
|
119 |
streamDistanceMatrices = speckle_utils.getSpeckleStream(streamId,branch_name_dm,CLIENT, commit_id_dm)
|
120 |
matrices = fetchDistanceMatrices (streamDistanceMatrices)
|
121 |
df_dm = matrices[distanceMatrixActivityNodes]
|
122 |
+
df_dm_transport = matrices[distanceMatrixTransportStops]
|
123 |
+
|
124 |
+
|
125 |
dm_dictionary = df_dm.to_dict('index')
|
126 |
|
127 |
"""
|
|
|
192 |
|
193 |
return result_dicts
|
194 |
|
195 |
+
result_dicts = split_dict_by_subkey(df_dm_transport, tranportModes)
|
196 |
|
197 |
# Accessing each dictionary
|
198 |
art_dict = result_dicts["DRT"]
|
|
|
207 |
|
208 |
|
209 |
# create a mask based on the matrix size and ids, crop activity nodes to the mask
|
210 |
+
mask_connected = df_dm.index.tolist()
|
211 |
|
212 |
valid_indexes = [idx for idx in mask_connected if idx in df_landuses.index]
|
213 |
# Identify and report missing indexes
|
|
|
265 |
|
266 |
|
267 |
|
268 |
+
LivabilitySubdomainsWeights = landusesToSubdomains(df_dm,df_landuses_filtered,landuseMapperDict,subdomainsUnique)
|
269 |
|
270 |
|
271 |
|
|
|
287 |
return df_LivabilitySubdomainsWorkplaces
|
288 |
|
289 |
|
290 |
+
WorkplacesNumber = FindWorkplaces(df_dm,attributeMapperDict,LivabilitySubdomainsWeights,subdomainsUnique)
|
291 |
|
292 |
# prepare an input weights dataframe for the parameter LivabilitySubdomainsInputs
|
293 |
LivabilitySubdomainsInputs =pd.concat([LivabilitySubdomainsWeights, WorkplacesNumber], axis=1)
|
|
|
323 |
|
324 |
|
325 |
|
326 |
+
subdomainsAccessibility = computeAccessibility(df_dm,LivabilitySubdomainsInputs,alpha,threshold)
|
327 |
artAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'ART',alpha,threshold)
|
328 |
gmtAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'GMT+HSR',alpha,threshold)
|
329 |
|
|
|
378 |
|
379 |
|
380 |
|
381 |
+
livability = accessibilityToLivability(df_dm,AccessibilityInputs,attributeMapperDict,domainsUnique)
|
382 |
|
383 |
|
384 |
livability_dictionary = livability.to_dict('index')
|