Adds uncoupled trial generator#71
Conversation
|
resolves #53 |
| self.reward_history.append(outcome.is_rewarded) | ||
|
|
||
| if self.spec.is_baiting: | ||
| if outcome.is_right_choice: |
There was a problem hiding this comment.
Consider adding the "else" to have the complete pattern matching just in case. Even a else: pass with a comment describing why we are handling it that way would be great.
| self.is_right_baited = self.block.p_right_reward > random_numbers[1] or self.is_right_baited | ||
| logger.debug(f"Right baited: {self.is_right_baited}") | ||
| logger.debug("Right baited: %s" % self.is_right_baited) | ||
| else: |
There was a problem hiding this comment.
I think you ended up adding this clause in the wrong place. See https://github.com/AllenNeuralDynamics/Aind.Behavior.DynamicForaging/pull/71/changes#r3134922037 as the comment I made was not address.
| block_length: Distribution = Field( | ||
| default=UniformDistribution( | ||
| distribution_parameters=UniformDistributionParameters(min=20, max=60), | ||
| truncation_parameters=TruncationParameters(min=20, max=60), |
There was a problem hiding this comment.
No need for truncation here since the Uniform is already guaranteed to draw between min a max
There was a problem hiding this comment.
I defined them so I can calculate the block stagger with the truncation parameters and use with other distributions
There was a problem hiding this comment.
uhmm this feels like a super leaky abstraction. Because users may pass a non-truncated distribution and your logic will crash during runtime. If the min and the max are really necessary for you inner logic, then sure go ahead and move them again to the top level. I thought the logic was decoupled enough that you would not need access to these parameters only the drawn number.
There was a problem hiding this comment.
Yeah that block stagger calculation relies on the min and max which is why I originally constrained it to uniform. I'll revert back to that unless that's not what you're suggesting here?
Adds uncoupled trial generator based on https://github.com/AllenNeuralDynamics/dynamic-foraging-task/blob/develop/src/foraging_gui/reward_schedules/uncoupled_block.py. Updated base class to be used by both coupled and uncoupled and added coupled base class to be used by both warmup and coupled class.