api.task_logic

_images/AindIsoForceTaskLogic.svg
class aind_behavior_iso_force.task_logic.Action(value)[source]

Bases: IntFlag

Defines the action types

LEFT = 1[source]
NONE = 0[source]
PULL = 8[source]
PUSH = 4[source]
PUSH_PULL = 12[source]
RIGHT = 2[source]
RIGHT_LEFT = 3[source]
pydantic model aind_behavior_iso_force.task_logic.AindIsoForceTaskLogic[source]

Bases: AindBehaviorTaskLogicModel

Config:
  • extra: str = forbid

  • validate_assignment: bool = True

  • validate_default: bool = True

  • strict: bool = True

  • str_strip_whitespace: bool = True

Fields:
Validators:
field name: Literal['AindIsoForce'] = 'AindIsoForce'[source]

Name of the task logic

field task_parameters: AindIsoForceTaskParameters [Required][source]

Parameters of the task logic

field version: Literal['0.0.0-rc0'] = '0.0.0-rc0'[source]
Validated by:
  • coerce_version

pydantic model aind_behavior_iso_force.task_logic.AindIsoForceTaskParameters[source]

Bases: TaskParameters

Config:
  • extra: str = allow

  • validate_assignment: bool = True

  • validate_default: bool = True

  • strict: bool = True

  • str_strip_whitespace: bool = True

Fields:
Validators:

field environment: Environment [Required][source]

Environment settings

field operation_control: OperationControl = OperationControl(force=ForceOperationControl(left=LoadCellInput(channel=0, is_inverted=False), right=LoadCellInput(channel=0, is_inverted=True), push=LoadCellInput(channel=1, is_inverted=False), pull=LoadCellInput(channel=1, is_inverted=True)))[source]

Operation control

pydantic model aind_behavior_iso_force.task_logic.Block[source]

Bases: BaseModel

Fields:
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_iso_force.task_logic.BlockGenerator[source]

Bases: BaseModel

Fields:
field block_size: 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 mode: Literal[BlockStatisticsMode.BLOCK_GENERATOR] = BlockStatisticsMode.BLOCK_GENERATOR[source]
field trial_template: Trial [Required][source]

Statistics of the trials in the block

class aind_behavior_iso_force.task_logic.BlockStatisticsMode(value)[source]

Bases: str, Enum

Defines the mode of the environment

BLOCK = 'Block'[source]
BLOCK_GENERATOR = 'BlockGenerator'[source]
pydantic model aind_behavior_iso_force.task_logic.CrossingOutcome[source]

Bases: BaseModel

Fields:
field action: Action [Required][source]

Action that was taken

field duration: float [Required][source]

Duration of the crossing

field end: Timestamped[ThresholdedJoystickForce] [Required][source]

End of the crossing

field is_reward_action: bool [Required][source]

Whether the crossing is a reward action

field is_valid_duration: bool [Required][source]

Whether the crossing duration is valid

field start: Timestamped[ThresholdedJoystickForce] [Required][source]

Start of the crossing

pydantic model aind_behavior_iso_force.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_iso_force.task_logic.ForceOperationControl[source]

Bases: BaseModel

Fields:
field left: LoadCellInput = LoadCellInput(channel=0, is_inverted=False)[source]

Left load cell input

field pull: LoadCellInput = LoadCellInput(channel=1, is_inverted=True)[source]

Pull load cell input

field push: LoadCellInput = LoadCellInput(channel=1, is_inverted=False)[source]

Push load cell input

field right: LoadCellInput = LoadCellInput(channel=0, is_inverted=True)[source]

Right load cell input

pydantic model aind_behavior_iso_force.task_logic.ForceThreshold[source]

Bases: BaseModel

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

Left force threshold

field pull: float | None = None[source]

Pull force threshold

field push: float | None = None[source]

Push force threshold

field right: float | None = None[source]

Right force threshold

from_action(action: Action) float | None[source]

Returns the force threshold for the given action.

Parameters:

action (Action) – The action to get the force threshold for.

Returns:

The force threshold for the action, or None if no threshold is set.

Return type:

Optional[float]

pydantic model aind_behavior_iso_force.task_logic.JoystickForce[source]

Bases: BaseModel

Fields:
field left: float [Required][source]

Force applied to the left axis

field pull: float [Required][source]

Force applied to the pull axis

field push: float [Required][source]

Force applied to the push axis

field push_pull: float [Required][source]

Signed force applied to the push and pull axes combined

field right: float [Required][source]

Force applied to the right axis

field right_left: float [Required][source]

Signed force applied to the right and left axes combined

pydantic model aind_behavior_iso_force.task_logic.LoadCellInput[source]

Bases: BaseModel

Fields:
field channel: Annotated[int, FieldInfo(annotation=NoneType, required=True, description='Load cell channel number available', metadata=[Ge(ge=0), Le(le=7)])] [Required][source]

Load cell channel number

Constraints:
  • ge = 0

  • le = 7

field is_inverted: bool = False[source]

Whether the load cell is inverted

pydantic model aind_behavior_iso_force.task_logic.OperantReward[source]

Bases: Reward

Fields:
field reward_type: Literal['Operant'] = 'Operant'[source]
field time_to_collect: Distribution = Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=0.5), truncation_parameters=None, scaling_parameters=None)[source]

Time to collect the reward

pydantic model aind_behavior_iso_force.task_logic.OperationControl[source]

Bases: BaseModel

Fields:
field force: ForceOperationControl = ForceOperationControl(left=LoadCellInput(channel=0, is_inverted=False), right=LoadCellInput(channel=0, is_inverted=True), push=LoadCellInput(channel=1, is_inverted=False), pull=LoadCellInput(channel=1, is_inverted=True))[source]

Operation control for force sensor

pydantic model aind_behavior_iso_force.task_logic.QuiescencePeriod[source]

Bases: BaseModel

Defines a quiescence settings

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

Duration force has to stay below threshold to start the trial.

field force_threshold: ForceThreshold = ForceThreshold(left=None, right=None, push=None, pull=None)[source]

Threshold for the force sensors to be considered quiescent.

pydantic model aind_behavior_iso_force.task_logic.ResponsePeriod[source]

Bases: BaseModel

Defines a response period

Fields:
Validators:
  • _validate_rewarded_action_vs_threshold » all fields

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

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

Validated by:
  • _validate_rewarded_action_vs_threshold

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

Duration the force must stay above threshold.

Validated by:
  • _validate_rewarded_action_vs_threshold

field force_threshold: ForceThreshold = ForceThreshold(left=None, right=None, push=None, pull=None)[source]

Threshold for the force sensors to be considered active. If None, the crossings will be ignored.

Validated by:
  • _validate_rewarded_action_vs_threshold

field rewarded_action: Action = <Action.NONE: 0>[source]
Validated by:
  • _validate_rewarded_action_vs_threshold

pydantic model aind_behavior_iso_force.task_logic.Reward[source]

Bases: BaseModel

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

Amount of reward to dispense

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

Delay before dispensing the reward

field reward_type: Literal['Pavlovian'] = 'Pavlovian'[source]
pydantic model aind_behavior_iso_force.task_logic.ThresholdedJoystickForce[source]

Bases: BaseModel

Fields:
field joystick_force: JoystickForce [Required][source]

Joystick force values that triggered the event

field left: bool [Required][source]

Whether the left force is above the threshold

field pull: bool [Required][source]

Whether the pull force is above the threshold

field push: bool [Required][source]

Whether the push force is above the threshold

field right: bool [Required][source]

Whether the right force is above the threshold

pydantic model aind_behavior_iso_force.task_logic.Timestamped[source]

Bases: BaseModel, Generic[T]

Fields:
field seconds: float [Required][source]
field value: T [Required][source]
pydantic model aind_behavior_iso_force.task_logic.Trial[source]

Bases: BaseModel

Defines a trial

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

Time between trials

field quiescence_period: QuiescencePeriod | None = None[source]

Quiescence settings

field response_period: ResponsePeriod = ResponsePeriod(duration=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=0.5), truncation_parameters=None, scaling_parameters=None), force_threshold=ForceThreshold(left=None, right=None, push=None, pull=None), rewarded_action=<Action.NONE: 0>, force_duration=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=0.05), truncation_parameters=None, scaling_parameters=None))[source]

Response settings

field reward_period: RewardPeriod = Reward(reward_type='Pavlovian', amount=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=1.0), truncation_parameters=None, scaling_parameters=None), delay=Scalar(family=<DistributionFamily.SCALAR: 'Scalar'>, distribution_parameters=ScalarDistributionParameter(family=<DistributionFamily.SCALAR: 'Scalar'>, value=0.0), truncation_parameters=None, scaling_parameters=None))[source]

Reward settings

aind_behavior_iso_force.task_logic.normal_distribution_value(mean: float, std: float) NormalDistribution[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_iso_force.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_iso_force.task_logic.uniform_distribution_value(min: float, max: float) UniformDistribution[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