Configuration files (Python)
Crowd and agents setup
Bideltoid breadth computation
Unit tests for the compute_bideltoid_breadth_from_multipolygon function.
- Test cases cover:
Simple MultiPolygon with a known maximum horizontal breadth.
Centroid shift of the polygon (should not affect the breadth).
MultiPolygon containing two separated polygons.
Non-MultiPolygon input (should raise ValueError).
Degenerate case: all points vertically aligned (breadth zero).
Irregular polygon where the maximum horizontal breadth is not between endpoints.
- test_compute_bideltoid_breadth_from_multipolygon.test_simple_horizontal_rectangle()[source]
Test a single rectangle MultiPolygon where the breadth is the rectangle's width.
- Return type:
- test_compute_bideltoid_breadth_from_multipolygon.test_breadth_includes_centroid_shift()[source]
Test that centroid shift (with respect to the Polygon of the first test) does not affect the result.
- Return type:
- test_compute_bideltoid_breadth_from_multipolygon.test_two_rectangles_same_y()[source]
Test two rectangles side by side, breadth should be distance between farthest points at same y.
- Return type:
- test_compute_bideltoid_breadth_from_multipolygon.test_single_point_vertical_line()[source]
All points have the same x, so breadth should be zero.
- Return type:
Chest depth computation
Unit tests for the compute_chest_depth_from_multipolygon function.
- Tests cover:
Simple MultiPolygon with known vertical depth
MultiPolygon with two separated polygons
Degenerate case: all points on a horizontal line (depth zero)
Non-MultiPolygon input (error)
Centroid shift invariance
Irregular shape with known max vertical distance at similar x
- test_compute_chest_depth_from_multipolygon.test_simple_vertical_rectangle()[source]
Test a single rectangle MultiPolygon where the chest depth is the rectangle's height.
- Return type:
- test_compute_chest_depth_from_multipolygon.test_two_rectangles_same_x()[source]
Test two rectangles stacked vertically, depth should be distance between farthest points at same x.
- Return type:
- test_compute_chest_depth_from_multipolygon.test_single_point_horizontal_line()[source]
All points have the same y, so depth should be zero.
- Return type:
- test_compute_chest_depth_from_multipolygon.test_non_multipolygon_input()[source]
Should raise ValueError for non-MultiPolygon input.
- Return type:
Moment of inertia computation
Unit tests for the compute_moment_of_inertia function.
- Tests cover:
Correct computation for simple polygons (square)
Handling of MultiPolygon geometries
Zero and negative weight values
Invalid geometry type validation
Area scaling consistency
Mass distribution in composite geometries
- test_compute_moment_of_inertia.test_square_polygon()[source]
Test moment of inertia for a unit square at origin.
- Return type:
- test_compute_moment_of_inertia.test_multipolygon_sum()[source]
Test that MultiPolygon sums the moments of the components.
- Return type:
- test_compute_moment_of_inertia.test_zero_weight()[source]
Test that zero weight returns zero moment.
- Return type:
- test_compute_moment_of_inertia.test_negative_weight()[source]
Test that negative weight returns negative moment.
- Return type:
Rotation
Unit tests for the rotate_vectors function.
- Tests cover:
Rotation accuracy for standard angles (0°, 90°, 180°, 270°)
Non-integer and negative angle values
Empty dictionary handling
Multiple vector transformations in single operation
Input immutability verification
Error handling for invalid vector formats
- test_rotate_vectors.vectors_close(vec1, vec2, tol=1e-08)[source]
Help function to compare two 2D vectors for approximate equality.
- test_rotate_vectors.test_rotate_0_degrees()[source]
Test rotation by 0 degrees (should return original vectors).
- Return type:
- test_rotate_vectors.test_rotate_270_degrees()[source]
Test rotation by 270 degrees (or -90 degrees).
- Return type:
- test_rotate_vectors.test_rotate_negative_angle()[source]
Test rotation by a negative angle.
- Return type:
- test_rotate_vectors.test_rotate_non_integer_angle()[source]
Test rotation by a non-integer angle.
- Return type:
- test_rotate_vectors.test_rotate_empty_dict()[source]
Test rotating an empty dictionary.
- Return type:
- test_rotate_vectors.test_input_not_modified()[source]
Test that input dictionary is not modified in place.
- Return type:
- test_rotate_vectors.test_invalid_vector_format()[source]
Test that invalid vector format (not a tuple of two floats) raises an error.
- Return type:
Unit tests for the wrap_angle function.
- Tests cover:
Canonical angles (0, 180, -180, 360, -360, 720, -720)
Angles just outside the bounds
Negative and positive values
Large and small angles
Floating point precision
- test_wrap_angle.test_angles_just_outside_bounds()[source]
Test angles just outside the -180 and 180 bounds.
- Return type:
- test_wrap_angle.test_large_angles()[source]
Test very large positive and negative angles.
- Return type:
- test_wrap_angle.test_floating_point_precision()[source]
Test floating point precision edge case.
- Return type:
Unit tests for Agent rotation.
- Tests cover:
Initial orientation state validation
2D shape positioning accuracy during rotation
2D 3D centroid position invariance under rotation
- test_rotation.agent()[source]
Fixture to create an Agent instance for testing.
- Returns:
An instance of Agent with predefined type and measures.
- Return type:
- test_rotation.test_initial_orientation(agent)[source]
Test that the initial orientation of the agent is 90 degrees.
- test_rotation.test_shapes2d_center_y(agent)[source]
Test that the y-coordinates of each 2D shape center are close to 0.0.
- test_rotation.test_rotation_and_shapes2d_center_x(agent)[source]
Test that after rotating the agent by -90°, the orientation is -90 and the x-coordinates of each 2D shape center are close to -90.
Translation
Unit tests for Agent translation mechanics across dimensional spaces.
- Tests cover:
Agent's initial position is set correctly
Agent's position is correctly updated after translation of the 2D shapes in x and y directions
Agent's 3D body centroid is correctly updated after translation in x and y directions
Agent's 3D body centroid and lowest height are correctly updated after translation in z direction
- test_translation.agent()[source]
Fixture to create an Agent instance for testing.
- Returns:
An instance of Agent with predefined type and measures.
- Return type:
- test_translation.test_initial_position(agent)[source]
Test that the agent's initial position is set correctly.
- test_translation.test_translate_position(agent)[source]
Test that the agent's position is correctly updated after translation of the 2D shapes.
Single agent
Unit tests for the measuring methods of Agent 2D and 3D shapes.
- Tests cover:
Correctness of 2D measurements (chest depth, bideltoid breadth) under rotation and translation
Correctness of 3D measurements (height, chest depth, bideltoid breadth) under rotation and translation
Validation of the smallest 3D height value after transformations
Consistency of measurements after multiple geometric operations
- test_measuring_agent.agent()[source]
Fixture to create an Agent instance for testing.
- Returns:
An instance of Agent with predefined type and measures.
- Return type:
- test_measuring_agent.test_shapes2d_chest_depth(agent)[source]
Test that the 2D chest depth is correct.
- test_measuring_agent.test_shapes2d_bideltoid_breadth(agent)[source]
Test that the 2D bideltoid breadth is correct.
- test_measuring_agent.test_shapes3d_height(agent)[source]
Test that the 3D height is correct (in centimeters).
Crowd with custom statistics
Unit tests for the Crowd class configuration and statistical validation.
- Tests cover:
Agent population initialization count
Anthropometric statistic validation (means, proportions)
- test_crowd_with_custom_statistics.crowd()[source]
Fixture to create a Crowd instance with predefined measures and agents.
- Returns:
An instance of Crowd with agents created and packed.
- Return type:
Backup
Utilitary functions
Unit tests for the from_string_to_tuple function.
- Tests cover:
Valid string inputs (with and without parentheses, extra spaces, negative numbers, scientific notation)
Handling of leading/trailing whitespace
Invalid inputs (non-string, wrong number of elements, non-numeric values, empty string)
Error message validation for incorrect formats
- test_from_string_to_tuple.test_valid_input_no_parentheses()[source]
Test valid input without parentheses.
- Return type:
- test_from_string_to_tuple.test_valid_input_with_parentheses()[source]
Test valid input with parentheses.
- Return type:
- test_from_string_to_tuple.test_valid_input_with_spaces()[source]
Test valid input with extra spaces.
- Return type:
- test_from_string_to_tuple.test_valid_input_negative_numbers()[source]
Test valid input with negative numbers.
- Return type:
- test_from_string_to_tuple.test_valid_input_scientific_notation()[source]
Test valid input with scientific notation.
- Return type:
- test_from_string_to_tuple.test_invalid_input_not_a_string()[source]
Test that non-string input raises ValueError.
- Return type:
- test_from_string_to_tuple.test_invalid_input_wrong_number_of_elements()[source]
Test that input with wrong number of elements raises ValueError.
- Return type:
- test_from_string_to_tuple.test_invalid_input_non_numeric()[source]
Test that non-numeric elements raise ValueError.
- Return type:
Materials parameters
Test the loading and saving of material parameters in XML format.
- test_backup_materials.materials_dict()[source]
Fixture to provide material parameters for testing.
- Returns:
A dictionary containing material parameters, including intrinsic properties and binary contact properties between different materials.
- Return type:
MaterialsDataType
- test_backup_materials.test_materials_dict_to_xml_and_back(materials_dict_fixture, tmp_path, request)[source]
Test the loading and saving of material parameters in XML format.
This test converts a dictionary to XML, saves it to a temporary file, reads it back, and ensures that the parsed dictionary matches the original.
- Parameters:
materials_dict_fixture (MaterialsDataType) -- A fixture containing material parameters for testing.
tmp_path (Path) -- A temporary directory provided by pytest for file operations.
request (SubRequest) -- The pytest request object used to access fixtures.
- Return type:
Boundaries parameters
Test the loading and saving of boundaries parameters in XML format.
- test_backup_boundaries.boundaries_dict_two_walls()[source]
Provide a fixture containing boundary data for a geometry with two walls.
- Returns:
A dictionary representing the geometry data, including dimensions and wall properties such as material ID and corner coordinates.
- Return type:
GeometryDataType
- test_backup_boundaries.boundaries_dict_one_wall()[source]
Provide a fixture containing boundary data for a geometry with one wall.
- Returns:
A dictionary representing the geometry data, including dimensions and wall properties such as material ID and corner coordinates.
- Return type:
GeometryDataType
- test_backup_boundaries.test_geometry_dict_to_xml_and_back(boundaries_dict, tmp_path, request)[source]
Test the loading and saving of boundaries parameters in XML format.
- Parameters:
boundaries_dict (GeometryDataType) -- A dictionary representing the geometry data, including dimensions and wall properties such as material ID and corner coordinates.
tmp_path (Path) -- Temporary directory for XML file storage.
request (SubRequest) -- The pytest request object used to access fixtures.
- Return type:
Static parameters
Test the loading and saving of static parameters for pedestrians in XML format.
- test_backup_static.crowd_static_dict()[source]
Fixture to provide static parameters for pedestrians.
- Returns:
A dictionary containing static parameters for two pedestrians.
- Return type:
StaticCrowdDataType
- test_backup_static.test_static_parameters_pedestrians_dict_to_xml_and_back(crowd_static_dict_fixture, tmp_path, request)[source]
Test the loading and saving of static parameters for pedestrians in XML format.
This test converts a dictionary to XML format, saves it to a temporary file, reads it back from the file, and ensures that the parsed dictionary matches the original.
- Parameters:
crowd_static_dict_fixture (StaticCrowdDataType) -- A fixture providing static parameters for pedestrians.
tmp_path (Path) -- A pytest fixture providing a temporary directory for file operations.
request (SubRequest) -- The pytest request object used to access fixtures.
- Return type:
Dynamic parameters
Test the loading and saving of dynamic parameters in XML format.
- test_backup_dynamic.dynamical_parameters_crowd()[source]
Fixture to provide dynamic parameters for the crowd.
- Returns:
A dictionary containing dynamic parameters for two agents.
- Return type:
DynamicCrowdDataType
- test_backup_dynamic.test_dynamic_parameters_dict_to_xml_and_back(dynamical_parameters_crowd_dict, tmp_path, request)[source]
Test the loading and saving of dynamic parameters in XML format.
This test converts a dictionary to XML, saves it to a temporary file, reads it back, and ensures that the parsed dictionary matches the original.
- Parameters:
dynamical_parameters_crowd_dict (DynamicCrowdDataType) -- A dictionary containing dynamic parameters for two agents.
tmp_path (Path) -- Temporary directory for XML file storage.
request (SubRequest) -- The pytest request object used to access fixtures.
- Return type:
All backup files in a zip files
Test the integrity of the crowd data saved in a zip file.
- test_backup_zip.crowd_fixture()[source]
Initialize and set up the Crowd object.
This fixture creates a Crowd instance, initializes agents, and packs them with forces.
- Returns:
An initialized Crowd object.
- Return type:
- test_backup_zip.output_zip_path_fixture(crowd_fixture)[source]
Save crowd data to a zip file and return the path.
- Parameters:
crowd_fixture (Crowd) -- The Crowd object containing simulation data.
- Returns:
The path to the saved zip file.
- Return type:
Path
- test_backup_zip.original_data_dicts_fixture(crowd_fixture)[source]
Retrieve original data dictionaries from the Crowd object.
This fixture collects static, materials, dynamic, and geometry parameters from the Crowd object.
- Parameters:
crowd_fixture (Crowd) -- The Crowd object containing simulation data.
- Returns:
A dictionary containing original simulation data categorized by type. Keys include "static", "materials", "dynamic", "geometry" and "interactions".
- Return type:
dict[str, StaticCrowdDataType | MaterialsDataType | DynamicCrowdDataType | GeometryDataType | InteractionsDataType]
- test_backup_zip.loaded_xml_data_fixture(output_zip_path_fixture)[source]
Extract XML content from the zip file.
This fixture reads XML files from the zip archive and categorizes them based on their content type.
- Parameters:
output_zip_path_fixture (Path) -- The path to the zip file containing XML data.
- Returns:
A dictionary containing XML content categorized by type. Keys include "static", "materials", "dynamic", and "geometry". Values are the raw XML content as bytes or None if not found.
- Return type:
- test_backup_zip.test_crowd_data_integrity(key, parse_function, original_data_dicts_fixture, loaded_xml_data_fixture)[source]
Test that the parsed XML data matches the original data dictionaries.
- Parameters:
key (str) -- The key representing a specific type of data (e.g., static, materials).
parse_function (Callable[[Optional[bytes]], dict[str, StaticCrowdDataType | MaterialsDataType |) -- DynamicCrowdDataType | GeometryDataType]] The function used to parse the XML data into a dictionary.
original_data_dicts_fixture (dict[str, StaticCrowdDataType | MaterialsDataType | DynamicCrowdDataType |) -- GeometryDataType ] The original data dictionaries categorized by type.
loaded_xml_data_fixture (dict[str, Optional[bytes]]) -- The XML data loaded from the zip file categorized by type.
- Return type:
Interaction parameters
Test the loading and saving of interactions parameters in XML format.
- test_backup_interactions.crowd(request)[source]
Fixture creating Crowd instances with parameterized agent counts and packing states.
- Parameters:
request (pytest.FixtureRequest) -- Contains tuple of (agent_count, should_pack) parameters.
- Returns:
Configured instance with agents and optional force packing.
- Return type: