api.task_logic

_images/AindVrForagingTaskLogic.svg
pydantic model aind_behavior_vr_foraging.task_logic.AindVrForagingTaskLogic[source]

Bases: AindBehaviorTaskLogicModel

Config:
  • extra: str = forbid

  • validate_assignment: bool = True

  • validate_defaults: bool = True

  • strict: bool = True

  • str_strip_whitespace: bool = True

Fields:
Validators:
field name: str = 'AindVrForaging'[source]

Name of the task logic

field task_parameters: AindVrForagingTaskParameters [Required][source]

Parameters of the task logic

field version: Literal[__version__] = '0.4.0'[source]
Validated by:
  • coerce_version

pydantic model aind_behavior_vr_foraging.task_logic.AindVrForagingTaskParameters[source]

Bases: TaskParameters

Config:
  • extra: str = allow

  • validate_assignment: bool = True

  • validate_defaults: bool = True

  • strict: bool = True

  • str_strip_whitespace: bool = True

Fields:
field environment_statistics: EnvironmentStatistics [Required][source]

Statistics of the environment

field operation_control: OperationControl [Required][source]

Control of the operation

field task_mode_settings: TaskModeSettings = ForagingSettings(task_mode=<TaskMode.FORAGING: 'FORAGING'>)[source]

Settings of the task stage

field updaters: Dict[str, NumericalUpdater] [Optional][source]

List of numerical updaters

pydantic model aind_behavior_vr_foraging.task_logic.AudioControl[source]

Bases: BaseModel

Fields:
field duration: float = 0.2[source]

Duration

Constraints:
  • ge = 0

field frequency: float = 1000[source]

Frequency

Constraints:
  • ge = 100

pydantic model aind_behavior_vr_foraging.task_logic.ConstantFunction[source]

Bases: BaseModel

Fields:
field function_type: Literal['ConstantFunction'] = 'ConstantFunction'[source]
field value: float = 1[source]

Value of the function

pydantic model aind_behavior_vr_foraging.task_logic.DebugSettings[source]

Bases: TaskModeSettingsBase

This class is not currently implemented

Fields:
field task_mode: Literal[TaskMode.DEBUG] = TaskMode.DEBUG[source]
field virtual_sites: List[VirtualSite] [Required][source]
field visual_corridors: List[VisualCorridor] [Required][source]
class aind_behavior_vr_foraging.task_logic.DepletionRule(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

ON_CHOICE = 'OnChoice'[source]
ON_DISTANCE = 'OnDistance'[source]
ON_REWARD = 'OnReward'[source]
ON_TIME = 'OnTime'[source]
pydantic model aind_behavior_vr_foraging.task_logic.EnvironmentStatistics[source]

Bases: BaseModel

Fields:
field first_state_occupancy: List[NonNegativeFloat] | None = None[source]

Determines the first state the animal will be in. If null, it will be randomly drawn.

field patches: List[PatchStatistics] [Optional][source]

List of patches

Constraints:
  • min_length = 1

field transition_matrix: List[List[NonNegativeFloat]] = [[1]][source]

Determines the transition probabilities between patches

pydantic model aind_behavior_vr_foraging.task_logic.ForagingSettings[source]

Bases: TaskModeSettingsBase

Fields:
field task_mode: Literal[TaskMode.FORAGING] = TaskMode.FORAGING[source]
pydantic model aind_behavior_vr_foraging.task_logic.HabituationSettings[source]

Bases: TaskModeSettingsBase

Fields:
field distance_to_reward: distributions.Distribution [Required][source]

Distance (cm) to the reward

field render_specification: RenderSpecification = RenderSpecification(contrast=None)[source]

The optional render specification of the virtual site

field task_mode: Literal[TaskMode.HABITUATION] = TaskMode.HABITUATION[source]
pydantic model aind_behavior_vr_foraging.task_logic.LinearFunction[source]

Bases: BaseModel

Fields:
field a: float = 1[source]

Coefficient a of the function: value = a * x + b

field b: float = 0[source]

Coefficient b of the function: value = a * x + b

field function_type: Literal['LinearFunction'] = 'LinearFunction'[source]
field maximum: float = 9999[source]

Maximum value of the function

field mininum: float = 0[source]

Minimum value of the function

pydantic model aind_behavior_vr_foraging.task_logic.MovableSpoutControl[source]

Bases: BaseModel

Fields:
field enabled: bool = False[source]

Whether the movable spout is enabled

field retracting_distance: float = 0[source]

The distance, relative to the default position, the spout will be retracted by

Constraints:
  • ge = 0

field time_to_collect_after_reward: float = 1[source]

Time (s) to collect after reward

Constraints:
  • ge = 0

pydantic model aind_behavior_vr_foraging.task_logic.NumericalUpdater[source]

Bases: BaseModel

Fields:
field operation: NumericalUpdaterOperation = NumericalUpdaterOperation.NONE[source]

Operation to perform on the parameter

field parameters: NumericalUpdaterParameters = NumericalUpdaterParameters(initial_value=0.0, increment=0.0, decrement=0.0, minimum=0.0, maximum=0.0)[source]

Parameters of the updater

class aind_behavior_vr_foraging.task_logic.NumericalUpdaterOperation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

GAIN = 'Gain'[source]
NONE = 'None'[source]
OFFSET = 'Offset'[source]
OFFSETPERCENTAGE = 'OffsetPercentage'[source]
SET = 'Set'[source]
pydantic model aind_behavior_vr_foraging.task_logic.NumericalUpdaterParameters[source]

Bases: BaseModel

Fields:
field decrement: float = 0.0[source]

Value to decrement the parameter by

field increment: float = 0.0[source]

Value to increment the parameter by

field initial_value: float = 0.0[source]

Initial value of the parameter

field maximum: float = 0.0[source]

Minimum value of the parameter

field minimum: float = 0.0[source]

Minimum value of the parameter

pydantic model aind_behavior_vr_foraging.task_logic.OdorControl[source]

Bases: BaseModel

Fields:
field target_odor_flow: float = 100[source]

Target odor flow (ml/s) in the odor mixture

Constraints:
  • ge = 0

  • le = 100

field target_total_flow: float = 1000[source]

Target total flow (ml/s) of the odor mixture

Constraints:
  • ge = 100

  • le = 1000

field use_channel_3_as_carrier: bool = True[source]

Whether to use channel 3 as carrier

field valve_max_open_time: float = 10[source]

Maximum time (s) the valve can be open continuously

Constraints:
  • ge = 0

pydantic model aind_behavior_vr_foraging.task_logic.OdorSpecification[source]

Bases: BaseModel

Fields:
field concentration: float = 1[source]

Concentration of the odor

Constraints:
  • ge = 0

  • le = 1

field index: int [Required][source]

Index of the odor to be used

Constraints:
  • ge = 0

  • le = 3

pydantic model aind_behavior_vr_foraging.task_logic.OperantLogic[source]

Bases: BaseModel

Fields:
field grace_distance_threshold: float = 10[source]

Virtual distance (cm) the animal must be within to not abort the current choice

Constraints:
  • ge = 0

field is_operant: bool = True[source]

Will the trial implement operant logic

field stop_duration: float = 0[source]

Duration (s) the animal must stop for to lock its choice

Constraints:
  • ge = 0

field time_to_collect_reward: float = 100000[source]

Time(s) the animal has to collect the reward

Constraints:
  • ge = 0

pydantic model aind_behavior_vr_foraging.task_logic.OperationControl[source]

Bases: BaseModel

Fields:
field audio_control: AudioControl = AudioControl(duration=0.2, frequency=1000)[source]

Control of the audio

field movable_spout_control: MovableSpoutControl = MovableSpoutControl(enabled=False, time_to_collect_after_reward=1, retracting_distance=0)[source]

Control of the movable spout

field odor_control: OdorControl = OdorControl(valve_max_open_time=10, target_total_flow=1000, use_channel_3_as_carrier=True, target_odor_flow=100)[source]

Control of the odor

field position_control: PositionControl = PositionControl(gain=Vector3(x=1.0, y=1.0, z=1.0), initial_position=Vector3(x=0.0, y=2.56, z=0.0), frequency_filter_cutoff=0.5, velocity_threshold=1)[source]

Control of the position

pydantic model aind_behavior_vr_foraging.task_logic.PatchRewardFunction[source]

Bases: BaseModel

Fields:
field amount: RewardFunction = ConstantFunction(function_type='ConstantFunction', value=1.0)[source]

Determines the amount of reward to be delivered. The value is in microliters

field available: RewardFunction = LinearFunction(function_type='LinearFunction', mininum=0.0, maximum=9999, a=-1.0, b=5.0)[source]

Determines the total amount of reward available left in the patch. The value is in microliters

field depletion_rule: DepletionRule = DepletionRule.ON_CHOICE[source]

Depletion

field probability: RewardFunction = ConstantFunction(function_type='ConstantFunction', value=1.0)[source]

Determines the probability that a reward will be delivered

pydantic model aind_behavior_vr_foraging.task_logic.PatchStatistics[source]

Bases: BaseModel

Fields:
field label: str = ''[source]

Label of the patch

field odor_specification: OdorSpecification | None = None[source]

The optional odor specification of the patch

field reward_specification: RewardSpecification | None = None[source]

The optional reward specification of the patch

field state_index: int = 0[source]

Index of the state

Constraints:
  • ge = 0

field virtual_site_generation: VirtualSiteGeneration = VirtualSiteGeneration(inter_site=VirtualSiteGenerator(render_specification=RenderSpecification(contrast=None), label=<VirtualSiteLabels.INTERSITE: 'InterSite'>, length_distribution=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)), treadmill_specification=None), inter_patch=VirtualSiteGenerator(render_specification=RenderSpecification(contrast=None), label=<VirtualSiteLabels.INTERPATCH: 'InterPatch'>, length_distribution=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)), treadmill_specification=None), post_patch=None, reward_site=VirtualSiteGenerator(render_specification=RenderSpecification(contrast=None), label=<VirtualSiteLabels.REWARDSITE: 'RewardSite'>, length_distribution=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)), treadmill_specification=None))[source]

Virtual site generation specification

pydantic model aind_behavior_vr_foraging.task_logic.PositionControl[source]

Bases: BaseModel

Fields:
field frequency_filter_cutoff: float = 0.5[source]

Cutoff frequency (Hz) of the low-pass filter used to filter the velocity signal.

Constraints:
  • ge = 0

  • le = 100

field gain: Vector3 = Vector3(x=1.0, y=1.0, z=1.0)[source]

Gain of the position control.

field initial_position: Vector3 = Vector3(x=0.0, y=2.56, z=0.0)[source]

Gain of the position control.

field velocity_threshold: float = 1[source]

Threshold (cm/s) of the velocity signal used to detect when the animal is moving.

Constraints:
  • ge = 0

pydantic model aind_behavior_vr_foraging.task_logic.PowerFunction[source]

Bases: BaseModel

Fields:
field a: float = 1[source]

Coefficient a of the function: value = a * pow(b, c * x) + d

field b: float = 2.718281828459045[source]

Coefficient b of the function: value = a * pow(b, c * x) + d

field c: float = -1[source]

Coefficient c of the function: value = a * pow(b, c * x) + d

field d: float = 0[source]

Coefficient d of the function: value = a * pow(b, c * x) + d

field function_type: Literal['PowerFunction'] = 'PowerFunction'[source]
field maximum: float = 1[source]

Maximum value of the function

field mininum: float = 0[source]

Minimum value of the function

pydantic model aind_behavior_vr_foraging.task_logic.RenderSpecification[source]

Bases: BaseModel

Fields:
field contrast: float | None = None[source]

Contrast of the texture

Constraints:
  • ge = 0

  • le = 1

pydantic model aind_behavior_vr_foraging.task_logic.RewardFunction[source]

Bases: RootModel

Fields:
field root: Annotated[Union[ConstantFunction, LinearFunction, PowerFunction], Field(discriminator='function_type')] [Required][source]
pydantic model aind_behavior_vr_foraging.task_logic.RewardSpecification[source]

Bases: BaseModel

Fields:
field delay: distributions.Distribution = Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=0.0), truncation_parameters=None, scaling_parameters=None)[source]

The optional distribution where the delay to reward will be drawn from

field operant_logic: OperantLogic | None = None[source]

The optional operant logic of the reward

field reward_function: PatchRewardFunction = PatchRewardFunction(amount=RewardFunction(root=ConstantFunction(function_type='ConstantFunction', value=1.0)), probability=RewardFunction(root=ConstantFunction(function_type='ConstantFunction', value=1.0)), available=RewardFunction(root=LinearFunction(function_type='LinearFunction', mininum=0.0, maximum=9999, a=-1.0, b=5.0)), depletion_rule=<DepletionRule.ON_CHOICE: 'OnChoice'>)[source]

Reward function of the patch.

pydantic model aind_behavior_vr_foraging.task_logic.Size[source]

Bases: BaseModel

Fields:
field height: float = 0[source]

Height of the texture

field width: float = 0[source]

Width of the texture

class aind_behavior_vr_foraging.task_logic.TaskMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

DEBUG = 'DEBUG'[source]
FORAGING = 'FORAGING'[source]
HABITUATION = 'HABITUATION'[source]
pydantic model aind_behavior_vr_foraging.task_logic.TaskModeSettings[source]

Bases: RootModel

Fields:
field root: Annotated[Union[HabituationSettings, ForagingSettings, DebugSettings], Field(discriminator='task_mode')] [Required][source]
pydantic model aind_behavior_vr_foraging.task_logic.TaskModeSettingsBase[source]

Bases: BaseModel

Fields:
field task_mode: TaskMode = TaskMode.FORAGING[source]

Stage of the task

pydantic model aind_behavior_vr_foraging.task_logic.Texture[source]

Bases: BaseModel

Fields:
field name: str = 'default'[source]

Name of the texture

field size: Size = Size(width=40.0, height=40.0)[source]

Size of the texture

pydantic model aind_behavior_vr_foraging.task_logic.TreadmillSpecification[source]

Bases: BaseModel

Fields:
field friction: distributions.Distribution | None = None[source]

Friction of the treadmill (0-1). The drawn value must be between 0 and 1

pydantic model aind_behavior_vr_foraging.task_logic.Vector2[source]

Bases: BaseModel

Fields:
field x: float = 0[source]

X coordinate of the point

field y: float = 0[source]

Y coordinate of the point

pydantic model aind_behavior_vr_foraging.task_logic.Vector3[source]

Bases: BaseModel

Fields:
field x: float = 0[source]

X coordinate of the point

field y: float = 0[source]

Y coordinate of the point

field z: float = 0[source]

Z coordinate of the point

pydantic model aind_behavior_vr_foraging.task_logic.VirtualSite[source]

Bases: BaseModel

Fields:
field id: int = 0[source]

Id of the virtual site

Constraints:
  • ge = 0

field label: VirtualSiteLabels = VirtualSiteLabels.UNSPECIFIED[source]

Label of the virtual site

field length: float = 20[source]

Length of the virtual site (cm)

field odor_specification: OdorSpecification | None = None[source]

The optional odor specification of the virtual site

field render_specification: RenderSpecification = RenderSpecification(contrast=None)[source]

The optional render specification of the virtual site

field reward_specification: RewardSpecification | None = None[source]

The optional reward specification of the virtual site

field start_position: float = 0[source]

Start position of the virtual site (cm)

Constraints:
  • ge = 0

field treadmill_specification: TreadmillSpecification | None = None[source]

Treadmill specification

pydantic model aind_behavior_vr_foraging.task_logic.VirtualSiteGeneration[source]

Bases: BaseModel

Fields:
field inter_patch: VirtualSiteGenerator = VirtualSiteGenerator(render_specification=RenderSpecification(contrast=None), label=<VirtualSiteLabels.INTERPATCH: 'InterPatch'>, length_distribution=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)), treadmill_specification=None)[source]

Generator of the inter-patch virtual sites

field inter_site: VirtualSiteGenerator = VirtualSiteGenerator(render_specification=RenderSpecification(contrast=None), label=<VirtualSiteLabels.INTERSITE: 'InterSite'>, length_distribution=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)), treadmill_specification=None)[source]

Generator of the inter-site virtual sites

field post_patch: VirtualSiteGenerator | None = None[source]

Generator of the post-patch virtual sites

field reward_site: VirtualSiteGenerator = VirtualSiteGenerator(render_specification=RenderSpecification(contrast=None), label=<VirtualSiteLabels.REWARDSITE: 'RewardSite'>, length_distribution=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)), treadmill_specification=None)[source]

Generator of the reward-site virtual sites

pydantic model aind_behavior_vr_foraging.task_logic.VirtualSiteGenerator[source]

Bases: BaseModel

Fields:
field label: VirtualSiteLabels = VirtualSiteLabels.UNSPECIFIED[source]

Label of the virtual site

field length_distribution: distributions.Distribution = Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=20.0), truncation_parameters=None, scaling_parameters=None)[source]

Distribution of the length of the virtual site

field render_specification: RenderSpecification = RenderSpecification(contrast=None)[source]

Contrast of the environment

field treadmill_specification: TreadmillSpecification | None = None[source]

Treadmill specification

class aind_behavior_vr_foraging.task_logic.VirtualSiteLabels(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

INTERPATCH = 'InterPatch'[source]
INTERSITE = 'InterSite'[source]
POSTPATCH = 'PostPatch'[source]
REWARDSITE = 'RewardSite'[source]
UNSPECIFIED = 'Unspecified'[source]
pydantic model aind_behavior_vr_foraging.task_logic.VisualCorridor[source]

Bases: BaseModel

Fields:
field id: int = 0[source]

Id of the visual corridor object

Constraints:
  • ge = 0

field length: float = 120[source]

Length of the corridor site (cm)

Constraints:
  • ge = 0

field size: Size = Size(width=40.0, height=40.0)[source]

Size of the corridor (cm)

field start_position: float = 0[source]

Start position of the corridor (cm)

Constraints:
  • ge = 0

field textures: WallTextures [Required][source]

The textures of the corridor

pydantic model aind_behavior_vr_foraging.task_logic.WallTextures[source]

Bases: BaseModel

Fields:
field ceiling: Texture [Required][source]

The texture of the ceiling

field floor: Texture [Required][source]

The texture of the floor

field left: Texture [Required][source]

The texture of the left

field right: Texture [Required][source]

The texture of the right

aind_behavior_vr_foraging.task_logic.scalar_value(value: float) Scalar[source]

Helper function to create a scalar value distribution for a given value.

Parameters:

value (float) – The value of the scalar distribution.

Returns:

The scalar distribution type.

Return type:

distributions.Scalar