tabs
one_agent_tab
Streamlit tab for visualizing a single agent in 2D or 3D.
one_agent_2D
2D agent visualization tab.
- streamlit_app.tabs.one_agent_2D.init_session_state()[source]
Initialize session state variables for different agent types (pedestrian or bike).
- Returns:
An object containing the initialized measures for the selected agent type.
- Return type:
Notes
For pedestrians, default measures include the attributes sex, bideltoid breadth, chest depth, height, and weight.
For bikes, default measures include the attributes wheel width, total length, handlebar length, top tube length, and weight.
- streamlit_app.tabs.one_agent_2D.sliders_for_agent_measures(agent_measures)[source]
Create sliders in the sidebar to adjust agent measures.
- Parameters:
agent_measures (AgentMeasures) -- The current AgentMeasures object that holds the measures for the selected agent type.
- Return type:
None
- - `st.session_state.current_agent`
- Type:
The updated Agent object with modified measures.
Notes
For pedestrians:
Sliders are created for bideltoid_breadth and chest_depth.
Other measures (e.g., height, weight, and sex) are set to default values.
For bikes:
Sliders are created for wheel_width, total_length, handlebar_length, and top_tube_length.
Other measures (e.g., weight) are set to default values.
- Return type:
- Parameters:
agent_measures (AgentMeasures)
- streamlit_app.tabs.one_agent_2D.sliders_for_position()[source]
Create sliders in the sidebar for position and rotation adjustments.
- streamlit_app.tabs.one_agent_2D.run_tab_agent2D()[source]
Provide an interactive interface for visualizing 2D representations of agents (e.g. pedestrians or bikes).
- streamlit_app.tabs.one_agent_2D.Sidebar
Agent type selection.
Sliders for anthropometric parameters.
- Main Page
Visualization of the 2D agent shape.
Displays an image illustrating the definitions of the current agent's measurements.
- Return type:
one_pedestrian_3D
3D pedestrian visualization tab.
- streamlit_app.tabs.one_pedestrian_3D.initialize_session_state()[source]
Initialize the session state variables.
- Return type:
- streamlit_app.tabs.one_pedestrian_3D.sliders_for_agent_parameters()[source]
Create sliders in the sidebar for adjusting pedestrian parameters.
- streamlit_app.tabs.one_pedestrian_3D.Sidebar
Radio button for selecting sex (male or female).
- Sliders for anthropometric parameters:
Bideltoid breadth (cm).
Chest depth (cm).
Height (cm).
- Returns:
An object containing the updated measures for the pedestrian agent.
- Return type:
- streamlit_app.tabs.one_pedestrian_3D.sliders_for_agent_position()[source]
Create sliders in the sidebar for adjusting an agent's position and rotation.
- streamlit_app.tabs.one_pedestrian_3D.download_data(current_pedestrian)[source]
Display two download buttons in the sidebar to export 3D shape data of the current agent as pickle files.
The first button allows the user to download the current pedestrian's 3D shape polygons. The second button enables downloading the reference 3D body model with standard parameters and high precision.
- streamlit_app.tabs.one_pedestrian_3D.orthogonal_projection_option(current_pedestrian)[source]
Display the orthogonal projection of the pedestrian agent in 3D.
- Parameters:
current_pedestrian (Agent) -- The agent object representing the current pedestrian.
- Return type:
Notes
The function creates a progress bar and status text to indicate the progress of the computation.
The orthogonal projection is computed and displayed using the plot.display_body3D_orthogonal_projection function.
The resulting figure is saved to a BytesIO object in PDF format.
A download button is provided to allow users to download the orthogonal projection as a PDF file.
- streamlit_app.tabs.one_pedestrian_3D.slices_option(current_pedestrian)[source]
Display the slices of the pedestrian agent in 3D.
- Parameters:
current_pedestrian (Agent) -- The agent object representing the current pedestrian.
- Return type:
Notes
The function creates a progress bar and status text to indicate the progress of the computation.
The slices are computed and displayed using the plot.display_body3D_polygons function.
The resulting figure is saved to a BytesIO object in PDF format.
A download button is provided to allow users to download the slices as a PDF file.
- streamlit_app.tabs.one_pedestrian_3D.mesh_option(current_pedestrian)[source]
Display the mesh of the pedestrian agent in 3D.
- Parameters:
current_pedestrian (Agent) -- The agent object representing the current pedestrian.
- Return type:
Notes
The function creates a progress bar and status text to indicate the progress of the computation.
The mesh is computed and displayed using the plot.display_body3D_mesh function.
The resulting figure is saved to a BytesIO object in PDF format.
A download button is provided to allow users to download the mesh as a PDF file.
- streamlit_app.tabs.one_pedestrian_3D.run_tab_pedestrian3D()[source]
Provide an interactive interface for visualizing and interacting with a 3D representation of a pedestrian agent.
Users can adjust anthropometric parameters, manipulate position and rotation, and choose from different visualization modes. Download options for figures and data are also provided.
- Return type:
- Main Page:
- Visualization of the selected 3D representation mode:
Orthogonal projection (matplotlib figure).
3D body as slices (Plotly figure).
3D body with a mesh (Plotly figure).
Progress bars and status messages during computations.
anthropometry_tab
Visualise the anthropometric ANSURII dataset.
- streamlit_app.tabs.anthropometry_tab.run_tab_anthropometry()[source]
Provide an interactive interface for visualizing and analyzing anthropometric data from the ANSUR II database.
- Main Page
Visualization of the selected attribute's distribution using Plotly.
Statistical summaries (mean and standard deviation) for males and females displayed on the right side of the screen.
Link to the ANSUR II database website.
- Return type:
crowd_creation_tab
Pedestrian visualization tab.
- streamlit_app.tabs.crowd_creation_tab.initialize_session_state()[source]
Initialize Streamlit session state variables.
- Return type:
- streamlit_app.tabs.crowd_creation_tab.parameter_changed()[source]
Update the Streamlit session state to indicate that a simulation should be run.
- Return type:
- streamlit_app.tabs.crowd_creation_tab.create_boundaries(boundary_x, boundary_y)[source]
Create a polygon representing the room boundaries.
- streamlit_app.tabs.crowd_creation_tab.update_crowd(boundaries, num_agents)[source]
Create and return a new Crowd object.
- streamlit_app.tabs.crowd_creation_tab.display_interpenetration_warning()[source]
Display a warning if interpenetration is too high.
- Return type:
- streamlit_app.tabs.crowd_creation_tab.display_table(data)[source]
Display a markdown table in a Streamlit column.
- streamlit_app.tabs.crowd_creation_tab.display_crowd_statistics(crowd_statistics_measures)[source]
Display crowd statistics in a Streamlit app, organized into four side-by-side tables.
- streamlit_app.tabs.crowd_creation_tab.plot_and_download_crowd2D(current_crowd)[source]
Plot the crowd and provide download options.
- streamlit_app.tabs.crowd_creation_tab.agent_statistics_state(new_boundaries, num_agents)[source]
Create custom statistics and update the session state.
- streamlit_app.tabs.crowd_creation_tab.boundaries_state()[source]
Create room boundaries and update the session state.
- Returns:
The new boundaries of the room.
- Return type:
- streamlit_app.tabs.crowd_creation_tab.general_settings()[source]
Configure and return general settings for the simulation.
- Returns:
The updated boundaries of the simulation area.
- Return type:
- streamlit_app.tabs.crowd_creation_tab.run_crowd_init()[source]
Provide an interactive interface for simulating and visualizing a crowd of agents.
Users can configure general settings, select databases, and control agent packing behavior. The tab includes options for crowd visualization and downloading results.
- Main Page
Crowd visualization using Plotly charts.
Interpenetration warnings if applicable.
Notes
- Sidebar:
- General settings:
Toggle for packing agents.
Input fields for boundaries, number of agents, wall interaction strength, and repulsion length.
- Database selection:
Options: ANSURII database, Custom statistics.
Additional settings for custom statistics.
- Download options:
Export results as files.
If agent packing is enabled, agents are packed using force-based interactions. Otherwise, the crowd is unpacked.
Interpenetration between agents is calculated and displayed as a warning if necessary.
- Return type:
- streamlit_app.tabs.crowd_creation_tab.plot_2D_3D_and_download_section(current_crowd)[source]
Display options to plot the current crowd in 2D or 3D and provide download functionality.
Depending on the agent types in the crowd, this function presents the user with options to visualize the crowd either in 2D or 3D. If all agents are of type pedestrian, both 2D and 3D visualization options are available. Otherwise, only 2D visualization is offered. The function also enables downloading the plotted results.
- streamlit_app.tabs.crowd_creation_tab.run_crowd_from_config()[source]
Run the crowd simulation from uploaded XML configuration files.
This function provides a Streamlit sidebar interface for uploading three required XML files: Agents.xml, Geometry.xml, and AgentDynamics.xml. It validates the uploads, parses the XML files into dictionaries, creates a crowd object using the configuration, displays a 2D plot of the crowd, and allows the user to download the plot as a PDF.
- Return type:
Notes
All three configuration files must be uploaded to proceed.
Displays errors or info messages in the Streamlit sidebar if files are missing or invalid.
- streamlit_app.tabs.crowd_creation_tab.plot_and_download_crowd_from_config(current_crowd)[source]
Plot and download the plot of the crowd from configuration files.
- streamlit_app.tabs.crowd_creation_tab.plot_and_download_crowd3D(current_crowd)[source]
Plot the crowd in 3D and provide download options.
- streamlit_app.tabs.crowd_creation_tab.run_tab_crowd()[source]
Display and manage the crowd setup tab in the Streamlit app.
This function allows the user to either initialize a new crowd and save configuration files, or to create a crowd using existing configuration files by uploading them. The function handles file validation, parsing, crowd creation, visualization, and plot download.
- Return type: