Reset bias water corrections counter - #158
Merged
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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_autowaterstate. - Reset
water_correctionswhen 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: |
alexpiet
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resets anti bias water intervention when the bias is of opposite side. Resolves #176