Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -100,7 +100,7 @@ def test(input_json):
|
|
100 |
|
101 |
|
102 |
|
103 |
-
|
104 |
# List containing the substrings to check against
|
105 |
tranportModes = ["DRT", "GMT", "HSR"]
|
106 |
|
@@ -112,13 +112,14 @@ def test(input_json):
|
|
112 |
for mode in tranportModes:
|
113 |
if mode in key: # Check if the substring is in the dictionary key
|
114 |
result_dict[substring][key] = value
|
115 |
-
|
116 |
-
|
117 |
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
122 |
|
123 |
# create a mask based on the matrix size and ids, crop activity nodes to the mask
|
124 |
mask_connected = df_matrix.index.tolist()
|
@@ -211,9 +212,10 @@ def test(input_json):
|
|
211 |
def computeAccessibility (DistanceMatrix, destinationWeights=None,alpha = 0.0038, threshold = 600):
|
212 |
|
213 |
decay_factors = np.exp(-alpha * DistanceMatrix) * (DistanceMatrix <= threshold)
|
214 |
-
|
215 |
# for weighted accessibility (e. g. areas)
|
216 |
if not destinationWeights.empty:
|
|
|
217 |
for col in destinationWeights.columns:
|
218 |
subdomainsAccessibility[col] = (decay_factors * destinationWeights[col].values).sum(axis=1)
|
219 |
# for unweighted accessibility (e. g. points of interest)
|
|
|
100 |
|
101 |
|
102 |
|
103 |
+
|
104 |
# List containing the substrings to check against
|
105 |
tranportModes = ["DRT", "GMT", "HSR"]
|
106 |
|
|
|
112 |
for mode in tranportModes:
|
113 |
if mode in key: # Check if the substring is in the dictionary key
|
114 |
result_dict[substring][key] = value
|
|
|
|
|
115 |
|
116 |
|
117 |
+
art = result_dict["DRT"]
|
118 |
+
|
119 |
+
|
120 |
+
df_art_matrix = pd.DataFrame(art).T
|
121 |
+
df_art_matrix = df_art_matrix.round(0).astype(int)
|
122 |
+
|
123 |
|
124 |
# create a mask based on the matrix size and ids, crop activity nodes to the mask
|
125 |
mask_connected = df_matrix.index.tolist()
|
|
|
212 |
def computeAccessibility (DistanceMatrix, destinationWeights=None,alpha = 0.0038, threshold = 600):
|
213 |
|
214 |
decay_factors = np.exp(-alpha * DistanceMatrix) * (DistanceMatrix <= threshold)
|
215 |
+
|
216 |
# for weighted accessibility (e. g. areas)
|
217 |
if not destinationWeights.empty:
|
218 |
+
subdomainsAccessibility = pd.DataFrame(index=DistanceMatrix.index, columns=destinationWeights.columns)
|
219 |
for col in destinationWeights.columns:
|
220 |
subdomainsAccessibility[col] = (decay_factors * destinationWeights[col].values).sum(axis=1)
|
221 |
# for unweighted accessibility (e. g. points of interest)
|