rtgym.agent package

Subpackages

Submodules

rtgym.agent.agent module

class Agent(gym)[source]

Bases: object

The class object of the Agent. An agent represents the subject that navigates or traverses the arena, either randomly or under control. This implementation manages two central aspects: how the agent generates trajectories through the environment, and how different sensory systems or spatial navigation cell types might respond along those trajectories.

The Agent can be thought of as a virtual animal whose movement and sensory inputs can be precisely controlled and observed. In this setting, theoretical models of spatially tuned cells—such as place cells, grid cells, or head direction cells—can be applied to predict how each of them would respond given the positions visited along a trajectory.

The Agent acts as a unifying interface that combines behavioral rules with sensory transformations, enabling reproducible experiments where navigation and perception are directly linked.

The Agent is coupled to a gym environment that defines the arena, spatial and temporal resolution, and the overall rules of the task. Through this interface, the Agent can be spawned at specific or random locations, controlled step by step, or allowed to move autonomously, while its sensory responses can be queried from individual states or full trajectories.

Parameters:
  • gym (RatatouGym) – The parent gym environment.

  • behavior_profile (dict) – Current behavior configuration.

  • sensory_profile (dict) – Current sensory configuration.

  • sensory (Sensory) – Sensory system manager.

  • behavior (Behavior) – Behavior system manager.

add_sensory(sensory_profile)[source]

Add sensory modalities to existing configuration.

Parameters:

sensory_profile (dict) – Additional sensory configuration parameters.

property arena

Get arena from gym.

Returns:

The arena environment.

Return type:

Arena

property autonomous

Get autonomous behavior system.

Returns:

Autonomous behavior manager.

Return type:

AutonomousBehavior

property controllable

Get controllable behavior system.

Returns:

Controllable behavior manager.

Return type:

ControllableBehavior

get_response(agent_data: AgentState | Trajectory, return_format='array', keys=None, str_filter=None, type_filter=None)[source]
random_spawn(batch_size: int)[source]

Spawn the controller at a random position in the arena.

random_traverse(duration: float, batch_size: int, init_pos=None, init_state=None, pause_prob=0)[source]
property sensories

Get all sensory modalities.

Returns:

Dictionary of sensory modalities keyed by name.

Return type:

dict

set_behavior(behavior_profile)[source]

Set behavior configuration.

Parameters:

behavior_profile (dict) – Behavior configuration parameters.

set_sensory(sensory_profile)[source]

Set sensory configuration.

Parameters:

sensory_profile (dict) – Sensory configuration parameters.

set_sensory_manually(sens_type, sens)[source]
property spatial_resolution

Get spatial resolution from gym.

Returns:

Spatial resolution in units per pixel.

Return type:

float

spawn(init_pos=None, init_state=None)[source]

Spawn the controllable agent at the given position and state.

Resets the controllable behavior and initializes the agent at a specific location and state for manual control.

Parameters:
  • init_pos (np.ndarray, optional) – Initial position of the agent.

  • init_state (AgentState or RawAgentState, optional) – Initial state of the agent. If both init_pos and init_state are provided, init_state will be used.

property state

Get current agent state.

Returns:

Current raw agent state.

Return type:

RawAgentState

step(displacement)[source]
property temporal_resolution

Get temporal resolution from gym.

Returns:

Temporal resolution in milliseconds.

Return type:

float

Module contents