rtgym.agent.sensory.movement_modulated package
Submodules
rtgym.agent.sensory.movement_modulated.direction_cell module
- class DirectionCell(arena, **kwargs)[source]
Bases:
MMBaseDirection cells with Gaussian tuning to movement direction.
These cells respond to the direction of agent movement with Gaussian tuning curves. Each cell has a preferred direction and fires maximally when the agent moves in that direction.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of direction cells. magnitude (float): Maximum magnitude of cell responses. normalize (bool): Whether to normalize cell responses. sorted (bool): Whether to sort cells by preferred directions. Defaults to True. n_bins (int): Number of direction bins for discretization. Defaults to 360. sigma (float): Standard deviation of the Gaussian tuning kernel. Defaults to 2. msigma (float): Standard deviation of magnitude modulation.
- get_response(agent_state: AgentState | Trajectory)[source]
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- vis(N, **kwargs)[source]
Visualize the movement modulated cells.
- Parameters:
traj (Trajectory) – Trajectory data for visualization.
N (int) – Number of cells to visualize.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
Matplotlib figure and axis objects.
- Return type:
tuple
rtgym.agent.sensory.movement_modulated.direction_rad module
- class DirectionRad(arena, **kwargs)[source]
Bases:
DisplacementAbsDirection cells with raw radian output.
Generates sensory responses based on the direction of agent movement, providing raw directional information in radians. Inherits from DisplacementAbs and converts displacement to directional angles.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of direction cells. magnitude (float): Maximum magnitude of cell responses. normalize (bool): Whether to normalize cell responses. sigma_s (float): Temporal smoothing sigma in seconds. Defaults to 0.0. ssigma_s (float): Spatial smoothing sigma in seconds. Defaults to 0.0.
- get_responses(traj: Trajectory)[source]
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
rtgym.agent.sensory.movement_modulated.displacement_abs module
- class DisplacementAbs(arena, **kwargs)[source]
Bases:
MMBaseAbsolute displacement signal sensory cells.
Generates sensory responses based on the absolute displacement of the agent. Displacement values may include negative values and represent spatial movement in both x and y directions.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of displacement cells (must be even). sigma_s (float): Temporal smoothing sigma in seconds. ssigma_s (float): Spatial smoothing sigma in seconds.
- get_response(agent_data: Trajectory)[source]
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
rtgym.agent.sensory.movement_modulated.head_direction_cell module
- class HeadDirectionCell(arena, **kwargs)[source]
Bases:
DisplacementAbsHead direction cells that respond to agent’s heading direction.
These cells fire when the agent is facing a specific direction, with each cell having a preferred direction. The responses are modeled using Gaussian tuning curves around the preferred directions.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of head direction cells. magnitude (float): Maximum magnitude of cell responses. Defaults to 1. normalize (bool): Whether to normalize cell responses. sorted (bool): Whether to sort cells by preferred directions. Defaults to True. n_bins (int): Number of direction bins for discretization. Defaults to 360. sigma (float): Standard deviation of the Gaussian tuning kernel. Defaults to 2.
- get_response(agent_state: AgentState)[source]
Get the movement modulated responses for the given trajectory.
- Parameters:
agent_state – Agent state.
- Returns:
Movement modulated responses of shape (n_batches, n_steps, n_cells).
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- vis(N, **kwargs)[source]
Visualize the movement modulated cells.
- Parameters:
traj (Trajectory) – Trajectory data for visualization.
N (int) – Number of cells to visualize.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
Matplotlib figure and axis objects.
- Return type:
tuple
rtgym.agent.sensory.movement_modulated.mm_base module
- class MMBase(arena, n_cells, t_res, sensory_key, seed=None, **kwargs)[source]
Bases:
objectBase class for movement modulated sensory cells.
Provides common functionality for sensory modalities that respond to movement parameters such as speed, direction, and acceleration. These cells are temporally modulated based on agent movement.
- Parameters:
arena (Arena) – Arena environment object.
n_cells (int) – Number of cells in this sensory modality.
t_res (float) – Temporal resolution in milliseconds.
sensory_key (str) – Unique identifier for this sensory type.
seed (int, optional) – Random seed for reproducible cell generation.
**kwargs – Additional keyword arguments including: magnitude (float): Base magnitude for cell responses. msigma (float): Standard deviation for magnitude variation.
- Raises:
AssertionError – If instantiated directly (abstract class) or n_cells <= 0.
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- print_specs()[source]
Print specifications of this sensory modality.
Prints the specifications returned by get_specs() in a formatted manner.
- vis(traj, N, *args, **kwargs)[source]
Visualize the movement modulated cells.
- Parameters:
traj (Trajectory) – Trajectory data for visualization.
N (int) – Number of cells to visualize.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
Matplotlib figure and axis objects.
- Return type:
tuple
rtgym.agent.sensory.movement_modulated.speed_cell module
- class SpeedCell(arena, **kwargs)[source]
Bases:
DisplacementAbsSpeed cells that encode movement speed.
Generates sensory responses based on the absolute speed (velocity magnitude) of agent movement. Each cell outputs a 1D value representing the agent’s speed, regardless of direction. Inherits from DisplacementAbs and converts displacement to speed.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of speed cells. sigma_s (float): Temporal smoothing sigma in seconds. ssigma_s (float): Spatial smoothing sigma in seconds. normalize (bool): Whether to normalize cell responses.
- get_response(agent_data: AgentState | Trajectory | Any)[source]
Get speed responses for given agent data.
Converts displacement to speed and duplicates across all cells. Each cell outputs the same speed value but can be modified by smoothing.
- Parameters:
agent_data (AgentState or Trajectory) – Agent data containing displacement.
- Returns:
Speed responses.
- Return type:
np.ndarray
- Raises:
ValueError – If agent_data type is not supported.
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing speed cell specifications.
- Return type:
dict
- vis(N=5, max_vel=1.0, n_bins=10, cmap='jet', *args, **kwargs)[source]
Visualize speed response curves.
Plots speed vs response for the first N cells.
- Parameters:
N (int) – Number of cells to visualize.
max_vel (float) – Maximum speed for visualization range.
n_bins (int) – Number of speed bins to plot.
cmap (str) – Colormap for visualization.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
Module contents
- class DirectionCell(arena, **kwargs)[source]
Bases:
MMBaseDirection cells with Gaussian tuning to movement direction.
These cells respond to the direction of agent movement with Gaussian tuning curves. Each cell has a preferred direction and fires maximally when the agent moves in that direction.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of direction cells. magnitude (float): Maximum magnitude of cell responses. normalize (bool): Whether to normalize cell responses. sorted (bool): Whether to sort cells by preferred directions. Defaults to True. n_bins (int): Number of direction bins for discretization. Defaults to 360. sigma (float): Standard deviation of the Gaussian tuning kernel. Defaults to 2. msigma (float): Standard deviation of magnitude modulation.
- get_response(agent_state: AgentState | Trajectory)[source]
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- vis(N, **kwargs)[source]
Visualize the movement modulated cells.
- Parameters:
traj (Trajectory) – Trajectory data for visualization.
N (int) – Number of cells to visualize.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
Matplotlib figure and axis objects.
- Return type:
tuple
- class DirectionRad(arena, **kwargs)[source]
Bases:
DisplacementAbsDirection cells with raw radian output.
Generates sensory responses based on the direction of agent movement, providing raw directional information in radians. Inherits from DisplacementAbs and converts displacement to directional angles.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of direction cells. magnitude (float): Maximum magnitude of cell responses. normalize (bool): Whether to normalize cell responses. sigma_s (float): Temporal smoothing sigma in seconds. Defaults to 0.0. ssigma_s (float): Spatial smoothing sigma in seconds. Defaults to 0.0.
- get_responses(traj: Trajectory)[source]
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- class DisplacementAbs(arena, **kwargs)[source]
Bases:
MMBaseAbsolute displacement signal sensory cells.
Generates sensory responses based on the absolute displacement of the agent. Displacement values may include negative values and represent spatial movement in both x and y directions.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of displacement cells (must be even). sigma_s (float): Temporal smoothing sigma in seconds. ssigma_s (float): Spatial smoothing sigma in seconds.
- get_response(agent_data: Trajectory)[source]
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- class HeadDirectionCell(arena, **kwargs)[source]
Bases:
DisplacementAbsHead direction cells that respond to agent’s heading direction.
These cells fire when the agent is facing a specific direction, with each cell having a preferred direction. The responses are modeled using Gaussian tuning curves around the preferred directions.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of head direction cells. magnitude (float): Maximum magnitude of cell responses. Defaults to 1. normalize (bool): Whether to normalize cell responses. sorted (bool): Whether to sort cells by preferred directions. Defaults to True. n_bins (int): Number of direction bins for discretization. Defaults to 360. sigma (float): Standard deviation of the Gaussian tuning kernel. Defaults to 2.
- get_response(agent_state: AgentState)[source]
Get the movement modulated responses for the given trajectory.
- Parameters:
agent_state – Agent state.
- Returns:
Movement modulated responses of shape (n_batches, n_steps, n_cells).
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing sensory specifications.
- Return type:
dict
- vis(N, **kwargs)[source]
Visualize the movement modulated cells.
- Parameters:
traj (Trajectory) – Trajectory data for visualization.
N (int) – Number of cells to visualize.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
Matplotlib figure and axis objects.
- Return type:
tuple
- class SpeedCell(arena, **kwargs)[source]
Bases:
DisplacementAbsSpeed cells that encode movement speed.
Generates sensory responses based on the absolute speed (velocity magnitude) of agent movement. Each cell outputs a 1D value representing the agent’s speed, regardless of direction. Inherits from DisplacementAbs and converts displacement to speed.
- Parameters:
arena (Arena) – Arena environment object.
**kwargs – Additional keyword arguments including: n_cells (int): Number of speed cells. sigma_s (float): Temporal smoothing sigma in seconds. ssigma_s (float): Spatial smoothing sigma in seconds. normalize (bool): Whether to normalize cell responses.
- get_response(agent_data: AgentState | Trajectory | Any)[source]
Get speed responses for given agent data.
Converts displacement to speed and duplicates across all cells. Each cell outputs the same speed value but can be modified by smoothing.
- Parameters:
agent_data (AgentState or Trajectory) – Agent data containing displacement.
- Returns:
Speed responses.
- Return type:
np.ndarray
- Raises:
ValueError – If agent_data type is not supported.
- get_specs()[source]
Get specifications of this sensory modality.
- Returns:
Dictionary containing speed cell specifications.
- Return type:
dict
- vis(N=5, max_vel=1.0, n_bins=10, cmap='jet', *args, **kwargs)[source]
Visualize speed response curves.
Plots speed vs response for the first N cells.
- Parameters:
N (int) – Number of cells to visualize.
max_vel (float) – Maximum speed for visualization range.
n_bins (int) – Number of speed bins to plot.
cmap (str) – Colormap for visualization.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.