diff --git a/src/analysis.py b/src/analysis.py index 108fc82..6ab3f4e 100644 --- a/src/analysis.py +++ b/src/analysis.py @@ -98,7 +98,7 @@ def run() -> None: ) traj, walkable_area = read_sqlite_file(SELECTED_OUTPUT_FILE) - json_data = load_json_data("files/bottleneck.json") + json_data = load_json_data("files/inifile.json") if selected == "Heatmap": handle_heatmap(walkable_area) @@ -309,29 +309,17 @@ def handle_distance_to_entrance(traj, measurement_line, motivation_file) -> None df_time_distance["time_seconds"] = ( df_time_distance["time"] / 1.0 # traj.frame_rate ) - # c1.info("Motivation") - # c2.info("Time distance") - # c3.info("Merged") - # c1.dataframe(speed) - # c2.dataframe(df_time_distance) speed = speed.merge(df_time_distance, on=[ID_COL, FRAME_COL]) - # c3.dataframe(speed) first_frame_speed = speed.loc[ speed[FRAME_COL] == speed[FRAME_COL].min(), ["speed", "time_seconds", "distance"], ] norm = Normalize(speed.min().speed, speed.max().speed) - # st.info( - # f"Min: {speed.min().speed}, Max: {speed.max().speed}, first frame: {speed[FRAME_COL].min()}" - # ) - cmap = cm.jet # type: ignore # --------------- trajectory_ids = df_time_distance["id"].unique() fig, ax = plt.subplots() for traj_id in trajectory_ids: - # if traj_id != 44: - # continue traj_data = df_time_distance[df_time_distance[ID_COL] == traj_id] speed_id = speed[speed[ID_COL] == traj_id].speed.to_numpy() # Extract points and speeds for the current trajectory diff --git a/src/logger_config.py b/src/logger_config.py index ff38354..b768940 100644 --- a/src/logger_config.py +++ b/src/logger_config.py @@ -1,6 +1,4 @@ -""" -Setup logger -""" +"""Setup logger.""" import logging @@ -42,27 +40,27 @@ def setup_logging() -> None: # Custom log functions def log_debug(msg: str) -> None: - """debug messages""" + """Debug messages.""" logging.debug(msg) def log_info(msg: str) -> None: - """info messages""" + """Info messages.""" logging.info(msg) def log_warning(msg: str) -> None: - """warning messages""" + """Warning messages.""" logging.warning(msg) def log_error(msg: str) -> None: - """errror messages""" + """Error messages.""" logging.error(msg) def init_logger() -> None: - """init logger""" + """Init logger.""" setup_logging() # jps.set_debug_callback(log_debug) jps.set_info_callback(log_info) diff --git a/src/motivation_model.py b/src/motivation_model.py index 054ea74..aaa4e35 100644 --- a/src/motivation_model.py +++ b/src/motivation_model.py @@ -436,7 +436,6 @@ def calculate_motivation_state( self, motivation_i: float, agent_id: int ) -> Tuple[float, float]: """Return v0, T tuples depending on Motivation. (v0,T)=(1.2,1).""" - v_0 = self.normal_v_0 * self.motivation_strategy.get_value(agent_id=agent_id) time_gap = self.normal_time_gap diff --git a/src/ui.py b/src/ui.py index cb7f415..2b5212a 100644 --- a/src/ui.py +++ b/src/ui.py @@ -295,7 +295,7 @@ def ui_value_parameters(data: Dict[str, Any]) -> None: def ui_competition_parameters(data: Dict[str, Any]) -> None: - """Set competition function""" + """Set competition function.""" with st.sidebar.expander("Competition Parameters", expanded=True): c1, c2 = st.columns(2) data["motivation_parameters"]["competition_max"] = c1.number_input( diff --git a/src/utilities.py b/src/utilities.py index e42d695..c44575e 100644 --- a/src/utilities.py +++ b/src/utilities.py @@ -6,19 +6,12 @@ from pathlib import Path from typing import Any, Dict, List, Tuple, TypeAlias, Union from types import SimpleNamespace - +import logging import jupedsim as jps -import numpy as np -import numpy.typing as npt -import pedpy -import plotly.graph_objects as go import streamlit as st -from plotly.graph_objs import Figure -from scipy import stats from shapely import GeometryCollection, Polygon from shapely.ops import unary_union -from .logger_config import log_error, log_info from math import sqrt Point: TypeAlias = Tuple[float, float] @@ -26,8 +19,9 @@ def parse(data: Union[List, Dict, Any]) -> Union[List, SimpleNamespace, Any]: """ - Recursively converts a nested structure of lists and dictionaries into - a structure of lists and SimpleNamespace objects. Other data types are left unchanged. + Recursively converts a nested structure of lists and dictionaries. + + into a structure of lists and SimpleNamespace objects. Other data types are left unchanged. Parameters: - data (Union[List, Dict, Any]): The input data to parse. This can be a list, @@ -61,7 +55,7 @@ def delete_txt_files() -> None: try: os.remove(file) except Exception as e: - log_error(f"Error deleting {file}: {e}") + logging.error(f"Error deleting {file}: {e}") def build_geometry( @@ -102,9 +96,9 @@ def init_journey( # log_info(f"{ way_points= }") # log_info(f"{ exits= }") exit_ids = [] - wp_ids = [] + # wp_ids = [] journey = jps.JourneyDescription() - distance = 1 + # distance = 1 # for way_point in way_points: # # log_info(f"add way_point: {way_point}") # wp_id = simulation.add_waypoint_stage((way_point[0], way_point[1]), distance) @@ -112,7 +106,7 @@ def init_journey( # journey.add(wp_id) for e in exits: - log_info(f"add {e}") + # log_info(f"add {e}") exit_id = simulation.add_exit_stage(e) exit_ids.append(exit_id) journey.add(exit_id) diff --git a/time.txt b/time.txt deleted file mode 100644 index 3305e8a..0000000 --- a/time.txt +++ /dev/null @@ -1 +0,0 @@ -Updated on Fri Aug 23 00:44:56 UTC 2024