Skip to content

Reset bias water corrections counter - #158

Merged
micahwoodard merged 4 commits into
mainfrom
fix-176-water-corrections-reset
Aug 26, 2026
Merged

Reset bias water corrections counter#158
micahwoodard merged 4 commits into
mainfrom
fix-176-water-corrections-reset

Conversation

@micahwoodard

Copy link
Copy Markdown
Collaborator

Resets anti bias water intervention when the bias is of opposite side. Resolves #176

@micahwoodard
micahwoodard requested review from alexpiet and bruno-f-cruz and a lite review from Copilot and removed request for Copilot August 25, 2026 16:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the bias intervention logic to reset the “water corrections” counter when the bias direction flips, ensuring antibias autowater can resume immediately after a direction change (per #176).

Changes:

  • Track the direction of the previous autowater correction via a new is_previous_right_autowater state.
  • Reset water_corrections when the correction direction changes, so water-based correction restarts after bias flips.
  • Extend tests to cover the new direction-change reset behavior and align existing tests with the new state.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/aind_behavior_dynamic_foraging/task_logic/interventions/bias_intervention.py Adds prior-direction tracking and resets water_corrections when direction changes.
tests/test_interventions/test_bias_intervention.py Updates existing tests and adds new coverage for direction-change reset scenarios.
tests/trial_generators/test_block_based_trial_generator.py Adjusts generator test setup to include the new prior-direction state.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

lickspout_offset_delta = 0
ab_delta = self.parameters.lickspout_offset_delta
if abs(bias) >= self.parameters.threshold.upper:
if self.water_corrections > 0 and (bias < 0) != self.is_previous_right_autowater:
@micahwoodard
micahwoodard merged commit 27f450d into main Aug 26, 2026
4 checks passed
@micahwoodard
micahwoodard deleted the fix-176-water-corrections-reset branch August 26, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants