api.task_logic

_images/AindForceForagingTaskLogic.svg
pydantic model aind_behavior_force_foraging.task_logic.ActionUpdater[source]

Bases: BaseModel

Fields:
field target_parameter: UpdateTargetParameter = UpdateTargetParameter.PROBABILITY[source]

Target parameter

field updated_by: UpdateTargetParameterBy = UpdateTargetParameterBy.TIME[source]

Independent variable

field updater: NumericalUpdater [Required][source]

Updater

pydantic model aind_behavior_force_foraging.task_logic.AindForceForagingTaskLogic[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 = 'AindForceForaging'[source]

Name of the task logic

field task_parameters: AindForceForagingTaskParameters [Required][source]

Parameters of the task logic

field version: Literal[__version__] = '0.1.0-preview01'[source]
Validated by:
  • coerce_version

pydantic model aind_behavior_force_foraging.task_logic.AindForceForagingTaskParameters[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: Environment [Required][source]

Environment settings

field operation_control: OperationControl = OperationControl(force=ForceOperationControl(press_mode=<PressMode.DOUBLE: 'Double'>, left_index=0, right_index=1, force_lookup_table=None), spout=SpoutOperationControl(default_retracted_position=0, default_extended_position=0, enabled=True))[source]

Operation control

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

List of numerical updaters

pydantic model aind_behavior_force_foraging.task_logic.AudioFeedback[source]

Bases: _ContinuousFeedbackBase

Fields:
Validators:

field continuous_feedback_mode: Literal[ContinuousFeedbackMode.AUDIO] = ContinuousFeedbackMode.AUDIO[source]
Validated by:
  • _validate_lut

pydantic model aind_behavior_force_foraging.task_logic.Block[source]

Bases: BaseModel

Fields:
field is_baited: bool = False[source]

Whether the trials are baited

field mode: Literal[BlockStatisticsMode.BLOCK] = BlockStatisticsMode.BLOCK[source]
field repeat_count: int | None = 0[source]

Number of times to repeat the block. If null, the block will be repeated indefinitely

field shuffle: bool = False[source]

Whether to shuffle the trials in the block

field trials: List[Trial] = [][source]

List of trials in the block

pydantic model aind_behavior_force_foraging.task_logic.BlockGenerator[source]

Bases: BaseModel

Fields:
field block_size: distributions.Distribution = UniformDistribution(family=<DistributionFamily.UNIFORM: 'Uniform'>, distribution_parameters=UniformDistributionParameters(family=<DistributionFamily.UNIFORM: 'Uniform'>, min=50.0, max=60.0), truncation_parameters=None, scaling_parameters=None)[source]

Size of the block

field is_baited: bool = False[source]

Whether the trials are baited

field mode: Literal[BlockStatisticsMode.BLOCK_GENERATOR] = BlockStatisticsMode.BLOCK_GENERATOR[source]
field trial_statistics: Trial [Required][source]

Statistics of the trials in the block

pydantic model aind_behavior_force_foraging.task_logic.BlockStatistics[source]

Bases: RootModel

Fields:
field root: Annotated[Union[Block, BlockGenerator, BrownianRandomWalk], Field(discriminator='mode')] [Required][source]
class aind_behavior_force_foraging.task_logic.BlockStatisticsMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Defines the mode of the environment

BLOCK = 'Block'[source]
BLOCK_GENERATOR = 'BlockGenerator'[source]
BROWNIAN = 'BrownianRandomWalk'[source]
pydantic model aind_behavior_force_foraging.task_logic.BrownianRandomWalk[source]

Bases: BaseModel

Fields:
field block_size: distributions.Distribution = UniformDistribution(family=<DistributionFamily.UNIFORM: 'Uniform'>, distribution_parameters=UniformDistributionParameters(family=<DistributionFamily.UNIFORM: 'Uniform'>, min=50.0, max=60.0), truncation_parameters=None, scaling_parameters=None)[source]

Size of the block

field is_baited: bool = False[source]

Whether the trials are baited

field mode: Literal[BlockStatisticsMode.BROWNIAN] = BlockStatisticsMode.BROWNIAN[source]
field trial_statistics: Trial [Required][source]

Statistics of the trials in the block

pydantic model aind_behavior_force_foraging.task_logic.ContinuousFeedback[source]

Bases: RootModel

Fields:
field root: Annotated[Union[ManipulatorFeedback, AudioFeedback], Field(discriminator='continuous_feedback_mode')] [Required][source]
class aind_behavior_force_foraging.task_logic.ContinuousFeedbackMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Defines the feedback mode

AUDIO = 'Audio'[source]
MANIPULATOR = 'Manipulator'[source]
NONE = 'None'[source]
VISUAL = 'Visual'[source]
pydantic model aind_behavior_force_foraging.task_logic.Environment[source]

Bases: BaseModel

Fields:
field block_statistics: List[BlockStatistics] [Required][source]

Statistics of the environment

field repeat_count: int | None = 0[source]

Number of times to repeat the environment. If null, the environment will be repeated indefinitely

field shuffle: bool = False[source]

Whether to shuffle the blocks

pydantic model aind_behavior_force_foraging.task_logic.ForceLookUpTable[source]

Bases: BaseModel

Fields:
Validators:
  • _validate_bounds » all fields

field left_max: float [Required][source]

The upper value of Left force used to linearly scale the input coordinate to.

Validated by:
  • _validate_bounds

field left_min: float [Required][source]

The lower value of Left force used to linearly scale the input coordinate to.

Validated by:
  • _validate_bounds

field offset: float = 0[source]

Offset to add to the look up table value

Validated by:
  • _validate_bounds

field path: str [Required][source]

Reference to the look up table image. Should be a 1 channel image. Value = LUT[Left, Right]

Validated by:
  • _validate_bounds

field right_max: float [Required][source]

The upper value of Right force used to linearly scale the input coordinate to.

Validated by:
  • _validate_bounds

field right_min: float [Required][source]

The lower value of Right force used to linearly scale the input coordinate to.

Validated by:
  • _validate_bounds

field scale: float = 1[source]

Scale to multiply the look up table value

Validated by:
  • _validate_bounds

pydantic model aind_behavior_force_foraging.task_logic.ForceOperationControl[source]

Bases: BaseModel

Fields:
Validators:
  • _validate_press_mode_versus_lut » all fields

field force_lookup_table: ForceLookUpTable | None = None[source]

Look up table for force projection

Validated by:
  • _validate_press_mode_versus_lut

field left_index: int = 0[source]

Index of the left sensor

Validated by:
  • _validate_press_mode_versus_lut

field press_mode: PressMode = PressMode.DOUBLE[source]

Defines the press mode. Default is to use both sensors individually

Validated by:
  • _validate_press_mode_versus_lut

field right_index: int = 1[source]

Index of the right sensor

Validated by:
  • _validate_press_mode_versus_lut

pydantic model aind_behavior_force_foraging.task_logic.HarvestAction[source]

Bases: BaseModel

Defines an abstract class for an harvest action

Fields:
Validators:
  • _validate_thresholds » all fields

  • _validate_trial_type » all fields

field action: HarvestActionLabel = HarvestActionLabel.NONE[source]

Label of the action

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field action_updaters: List[ActionUpdater] = [][source]

List of action updaters. All updaters are called at the start of a new trial.

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field amount: float = 1[source]

Amount of reward to be delivered

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field continuous_feedback: ContinuousFeedback | None = None[source]

Continuous feedback settings

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field delay: float = 0[source]

Delay between successful harvest and reward delivery

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field force_duration: float = 0.5[source]

Duration that the force much stay above threshold

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field is_operant: bool = True[source]

Whether the reward delivery is contingent on licking.

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field lower_force_threshold: float = 5000[source]

Lower bound of the force target region.

Constraints:
  • ge = -32768

  • le = 32768

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field probability: float = 1[source]

Probability of reward

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field time_to_collect: float | None = None[source]

Time to collect the reward after it is available. If null, the reward will be available indefinitely.

Constraints:
  • ge = 0

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field trial_type: TrialType = TrialType.NONE[source]

Type of the trial

Validated by:
  • _validate_thresholds

  • _validate_trial_type

field upper_force_threshold: float = 32768[source]

Upper bound of the force target region or the target cached force required.

Constraints:
  • ge = -32768

  • le = 32768

Validated by:
  • _validate_thresholds

  • _validate_trial_type

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

Bases: str, Enum

Defines the harvest actions

LEFT = 'Left'[source]
NONE = 'None'[source]
RIGHT = 'Right'[source]
pydantic model aind_behavior_force_foraging.task_logic.InitiationPeriod[source]

Bases: BaseModel

Defines an initiation period

Fields:
field abort_on_force: bool = False[source]

Whether to abort the trial if a choice is made during the initiation period.

field abort_on_force_threshold: float = 0[source]

Time out for the quiescence period

Constraints:
  • ge = -32768

  • le = 32768

field duration: float = 0[source]

Duration of the initiation period

Constraints:
  • ge = 0

field has_cue: bool = True[source]

Whether to use a cue to signal the start of the period.

pydantic model aind_behavior_force_foraging.task_logic.ManipulatorFeedback[source]

Bases: _ContinuousFeedbackBase

Fields:
Validators:

field continuous_feedback_mode: Literal[ContinuousFeedbackMode.MANIPULATOR] = ContinuousFeedbackMode.MANIPULATOR[source]
Validated by:
  • _validate_lut

pydantic model aind_behavior_force_foraging.task_logic.NumericalUpdater[source]

Bases: BaseModel

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

Operation to perform on the parameter

field parameters: NumericalUpdaterParameters = NumericalUpdaterParameters(value=Distribution(root=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=0.0), truncation_parameters=None, scaling_parameters=None)), minimum=0, maximum=0)[source]

Parameters of the updater

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

Bases: str, Enum

ADD = 'Offset'[source]
MULTIPLY = 'Gain'[source]
NONE = 'None'[source]
SET = 'Set'[source]
pydantic model aind_behavior_force_foraging.task_logic.NumericalUpdaterParameters[source]

Bases: BaseModel

Fields:
field maximum: float = 0[source]

Maximum value of the parameter

field minimum: float = 0[source]

Minimum value of the parameter

field value: 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 value of the update. This value will be multiplied by the optional input event value.

pydantic model aind_behavior_force_foraging.task_logic.OperationControl[source]

Bases: BaseModel

Fields:
field force: ForceOperationControl = ForceOperationControl(press_mode=<PressMode.DOUBLE: 'Double'>, left_index=0, right_index=1, force_lookup_table=None)[source]

Operation control for force sensor

field spout: SpoutOperationControl = SpoutOperationControl(default_retracted_position=0, default_extended_position=0, enabled=True)[source]

Operation control for spout

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

Bases: str, Enum

Defines the press mode

DOUBLE = 'Double'[source]
SINGLE_AVERAGE = 'SingleAverage'[source]
SINGLE_LEFT = 'SingleLeft'[source]
SINGLE_LOOKUP_TABLE = 'SingleLookupTable'[source]
SINGLE_MAX = 'SingleMax'[source]
SINGLE_MIN = 'SingleMin'[source]
SINGLE_RIGHT = 'SingleRight'[source]
pydantic model aind_behavior_force_foraging.task_logic.QuiescencePeriod[source]

Bases: BaseModel

Defines a quiescence settings

Fields:
field duration: float = 0[source]

Duration of the quiescence period

Constraints:
  • ge = 0

field force_threshold: float = 0[source]

Time out for the quiescence period

Constraints:
  • ge = -32768

  • le = 32768

field has_cue: bool = False[source]

Whether to use a cue to signal the start of the period.

pydantic model aind_behavior_force_foraging.task_logic.ResponsePeriod[source]

Bases: BaseModel

Defines a response period

Fields:
field duration: float = 0[source]

Duration of the response period. I.e. the time the animal has to make a choice.

Constraints:
  • ge = 0

field has_cue: bool = True[source]

Whether to use a cue to signal the start of the period.

field has_feedback: bool = False[source]

Whether to provide feedback to the animal after the response period.

pydantic model aind_behavior_force_foraging.task_logic.SpoutOperationControl[source]

Bases: BaseModel

Fields:
field default_extended_position: float = 0[source]

Default extended position (mm)

field default_retracted_position: float = 0[source]

Default retracted position (mm)

field enabled: bool = True[source]

Whether the spout control is enabled

pydantic model aind_behavior_force_foraging.task_logic.Trial[source]

Bases: BaseModel

Defines a trial

Fields:
Validators:
field initiation_period: InitiationPeriod = InitiationPeriod(duration=0, has_cue=True, abort_on_force=False, abort_on_force_threshold=0)[source]

Initiation settings

field inter_trial_interval: float = 0[source]

Time between trials

Constraints:
  • ge = 0

field left_harvest: HarvestAction | None = HarvestAction(action=<HarvestActionLabel.LEFT: 'Left'>, trial_type=<TrialType.NONE: 'None'>, probability=1, amount=1, delay=0, force_duration=0.5, upper_force_threshold=32768, lower_force_threshold=5000, is_operant=True, time_to_collect=None, action_updaters=[], continuous_feedback=None)[source]

Specification of the left action

Validated by:
  • _validate_left_harvest

field quiescence_period: QuiescencePeriod | None = None[source]

Quiescence settings

field response_period: ResponsePeriod = ResponsePeriod(duration=0, has_cue=True, has_feedback=False)[source]

Response settings

field right_harvest: HarvestAction | None = HarvestAction(action=<HarvestActionLabel.RIGHT: 'Right'>, trial_type=<TrialType.NONE: 'None'>, probability=1, amount=1, delay=0, force_duration=0.5, upper_force_threshold=32768, lower_force_threshold=5000, is_operant=True, time_to_collect=None, action_updaters=[], continuous_feedback=None)[source]

Specification of the right action

Validated by:
  • _validate_right_harvest

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

Bases: str, Enum

Defines the trial types

ACCUMULATION = 'Accumulation'[source]
NONE = 'None'[source]
ROI = 'RegionOfInterest'[source]
class aind_behavior_force_foraging.task_logic.UpdateTargetParameter(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Defines the target parameters

AMOUNT = 'Amount'[source]
DELAY = 'Delay'[source]
FORCE_DURATION = 'ForceDuration'[source]
LOWER_FORCE_THRESHOLD = 'LowerForceThreshold'[source]
PROBABILITY = 'Probability'[source]
UPPER_FORCE_THRESHOLD = 'UpperForceThreshold'[source]
class aind_behavior_force_foraging.task_logic.UpdateTargetParameterBy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Defines the independent variable used for the update

REWARD = 'Reward'[source]
TIME = 'Time'[source]
TRIAL = 'Trial'[source]
aind_behavior_force_foraging.task_logic.normal_distribution_value(mean: float, std: float) distributions.Normal[source]

Helper function to create a normal distribution for a given range.

Parameters:
  • mean (float) – The mean value of the normal distribution.

  • std (float) – The standard deviation of the normal distribution.

Returns:

The normal distribution type.

Return type:

distributions.Normal

aind_behavior_force_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

aind_behavior_force_foraging.task_logic.uniform_distribution_value(min: float, max: float) distributions.Uniform[source]

Helper function to create a uniform distribution for a given range.

Parameters:
  • min (float) – The minimum value of the uniform distribution.

  • max (float) – The maximum value of the uniform distribution.

Returns:

The uniform distribution type.

Return type:

distributions.Uniform