swarmsort.simulator module
Object motion simulator for SwarmSort testing and visualization.
This module provides tools for creating realistic object trajectories, motion patterns, and detection sequences for testing tracking algorithms.
- class swarmsort.simulator.MotionType(value)[source]
Bases:
EnumTypes of motion patterns.
- BROWNIAN = 'brownian'
- CIRCULAR = 'circular'
- FIGURE_EIGHT = 'figure_eight'
- LINEAR = 'linear'
- RANDOM_WALK = 'random_walk'
- SINUSOIDAL = 'sinusoidal'
- SPIRAL = 'spiral'
- STOP_AND_GO = 'stop_and_go'
- class swarmsort.simulator.ObjectMotionSimulator(config=None)[source]
Bases:
objectSimulates realistic object motion patterns.
- create_circular_motion_object(object_id, center, radius, angular_velocity, start_angle=0.0, **kwargs)[source]
Create an object with circular motion.
- Return type:
- create_figure_eight_object(object_id, center, width, height, period, **kwargs)[source]
Create an object following a figure-eight pattern.
- Return type:
- create_linear_motion_object(object_id, start_pos, velocity, **kwargs)[source]
Create an object with linear motion.
- Return type:
- create_random_walk_object(object_id, start_pos, step_size=0.3, boundary_behavior='bounce', **kwargs)[source]
Create an object with random walk motion.
- Return type:
- generate_detection(obj)[source]
Generate a detection from an object, including noise and missing detections.
- objects: List[SimulatedObject]
- class swarmsort.simulator.SimulatedObject(object_id, initial_position, motion_type, motion_params=<factory>, size=(20.0, 20.0), base_confidence=0.9, confidence_noise=0.1, class_id=0, spawn_frame=0, death_frame=-1, is_active=True)[source]
Bases:
objectRepresents a simulated object with motion properties.
- motion_type: MotionType
- class swarmsort.simulator.SimulationConfig(world_width=800.0, world_height=600.0, detection_probability=0.95, false_positive_rate=0.02, missed_detection_rate=0.05, position_noise_std=2.0, bbox_noise_std=1.0, use_embeddings=False, embedding_dim=128, embedding_noise_std=0.1, occlusion_probability=0.01, occlusion_duration_range=(5, 20), random_seed=None)[source]
Bases:
objectConfiguration for the simulation environment.
- swarmsort.simulator.create_demo_scenario(scenario_name='crossing_paths')[source]
Create predefined demo scenarios.
- Return type:
- swarmsort.simulator.create_scalability_scenario(num_objects, use_embeddings=False, world_size=None, motion_type='mixed', random_seed=None)[source]
Create a scenario with controlled number of objects for scalability testing.
- Parameters:
num_objects (
int) – Number of objects to simulateuse_embeddings (
bool) – Whether to generate embeddings for detectionsworld_size (
Optional[Tuple[float,float]]) – Size of simulation world (width, height). Auto-scales with object count if Nonemotion_type (
str) – Type of motion - “mixed”, “linear”, “circular”, or “random_walk”random_seed (
Optional[int]) – Random seed for reproducibility
- Return type:
- Returns:
Configured ObjectMotionSimulator