Spaces:
Sleeping
Sleeping
Jan
commited on
Commit
·
af955cc
1
Parent(s):
1be7d20
add documentation for line_score functionality
Browse files
app/data_processing/data_provider.py
CHANGED
@@ -84,6 +84,25 @@ class Data_provider():
|
|
84 |
return self.transformer_to_4326.transform(*station_coord)
|
85 |
|
86 |
def line_score(self, stations_coordinates: List[Tuple[Float]], w_density=1, w_income=1, w_age=1, radius=400, EPSG_4326=True):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
coords_formatted = []
|
88 |
coords_scores = []
|
89 |
for coord in stations_coordinates:
|
|
|
84 |
return self.transformer_to_4326.transform(*station_coord)
|
85 |
|
86 |
def line_score(self, stations_coordinates: List[Tuple[Float]], w_density=1, w_income=1, w_age=1, radius=400, EPSG_4326=True):
|
87 |
+
"""
|
88 |
+
Calculate the total score for a transit line based on station locations and individual station scores.
|
89 |
+
|
90 |
+
Parameters:
|
91 |
+
stations_coordinates (List[Tuple[float]]): A list of station coordinates as (x, y) tuples.
|
92 |
+
w_density (float): Weight for population density in scoring (default is 1).
|
93 |
+
w_income (float): Weight for income level in scoring (default is 1).
|
94 |
+
w_age (float): Weight for age distribution in scoring (default is 1).
|
95 |
+
radius (float): Radius of influence for each station (default is 400 meters).
|
96 |
+
EPSG_4326 (bool): If True, the coordinates are in EPSG:4326 and will be converted to EPSG:3057 (default is True).
|
97 |
+
|
98 |
+
Returns:
|
99 |
+
dict: A dictionary containing:
|
100 |
+
- "individual_scores": Scores for each station before applying penalties.
|
101 |
+
- "adjusted_scores": Scores for each station after applying penalties for proximity.
|
102 |
+
- "overlap_factors": (Optional, if calc_score_line returns it) Degree of overlap between stations.
|
103 |
+
- "total_individual_score": The aggregated score of all stations before penalties.
|
104 |
+
- "final_score": The total line score after penalties.
|
105 |
+
"""
|
106 |
coords_formatted = []
|
107 |
coords_scores = []
|
108 |
for coord in stations_coordinates:
|