AllenNeuralDynamics / dynamic-foraging-task

Bonsai/Harp workflow for Dynamic Foraging with Python GUI for visualization and control
MIT License
5 stars 4 forks source link

Update the manual water #545

Closed XX-Yin closed 1 week ago

XX-Yin commented 1 week ago

Pull Request instructions:

Describe changes:

  1. Added option ‘align to go cue’, if ‘yes’ is selected, manual water will be given after go cue. The volume of manual water is increased with clicks. Ephys GUI: image Behavior GUI: image

  2. Added visualization of manual water. image

  3. Bonsai was updated to send timestamps related to auto water, manual water and earned water to the GUI.

The added bonsai field is circled. image image image

What issues or discussions does this update address?

https://github.com/AllenNeuralDynamics/aind-behavior-blog/issues/420#issuecomment-2177235590 https://github.com/AllenNeuralDynamics/dynamic-foraging-task/issues/new

Describe the expected change in behavior from the perspective of the experimenter

No

Describe any manual update steps for task computers

No

Was this update tested in 446/447?

XX-Yin commented 1 week ago

@alexpiet @hanhou This is ready for review.

hanhou commented 1 week ago

This is great! I have two questions:

  1. Can you set the align_to_go_cue to True by default?
  2. Does rewardDelay work for AutoWater and ManualWater? It seems not from the bonsai diagram.
XX-Yin commented 1 week ago

This is great! I have two questions:

  1. Can you set the align_to_go_cue to True by default?
  2. Does rewardDelay work for AutoWater and ManualWater? It seems not from the bonsai diagram.
  1. Yes, I can set the align_to_go_cue to True by default.
  2. No, the RewardDelay is only for EarnedReward (the animal responds to the baited side), not for AutoWater and ManualWater. AutoWater and ManualWater will be given immediately after the GoCue. AutoWater and ManualWater are mainly designed to increase the motivation, and we should turn it off as early as possible to avoid the animal developing additional strategies. I think it should be ok to give them after the go cue.
hanhou commented 1 week ago

No, the RewardDelay is only for EarnedReward (the animal responds to the baited side), not for AutoWater and ManualWater.

If @ZhixiaoSu doesn't think this will confuse the mice that are on RewardDelay, let's leave it as it is then.

hanhou commented 1 week ago

Another question: will the user know what the current give_xx_volume_reserved is in the GUI?

XX-Yin commented 1 week ago

Another question: will the user know what the current give_xx_volume_reserved is in the GUI?

The user can visualize if there is manual water next trial when the GUI is updated. The volume is not explicitly visualized (depending how many times the user has clicked), but it will be added to the total water.

hanhou commented 1 week ago

The volume is not explicitly visualized

This is what I was wondering. I think it would be great if the user can get an immediate visual feedback when they click the manual water button. For example, show give_xx_volume_reserved in the GUI whenever it is updated.

XX-Yin commented 1 week ago

The volume is not explicitly visualized

This is what I was wondering. I think it would be great if the user can get an immediate visual feedback when they click the manual water button. For example, show give_xx_volume_reserved in the GUI whenever it is updated.

That makes sense. I can update it.

hanhou commented 1 week ago

A final question: will EarnedWater, ManualWater and AutoWater ever occur in the same trial? If so, do the mice get the sum of them? If not, what is the priority among the three?

XX-Yin commented 1 week ago

A final question: will EarnedWater, ManualWater and AutoWater ever occur in the same trial? If so, do the mice get the sum of them? If not, what is the priority among the three?

Great question.

  1. EarnedWater and ManualWater can occur in the same trial. The order is ManualWater and then the EarnedWater.
  2. EarnedWater and AutoWater can occur in the same trial. The order is AutoWater and then the EarnedWater.
  3. AutoWater and EarnedWater don't occur in the same trial. If this is an AutoWater trial, then no EarnedWater will be available.
hanhou commented 1 week ago

A final question: will EarnedWater, ManualWater and AutoWater ever occur in the same trial? If so, do the mice get the sum of them? If not, what is the priority among the three?

Great question.

  1. EarnedWater and ManualWater can occur in the same trial. The order is ManualWater and then the EarnedWater.
  2. ManualWater and AutoWater can occur in the same trial. The order is AutoWater and then the ManualWater.
  3. AutoWater and EarnedWater don't occur in the same trial. If this is an AutoWater trial, then no EarnedWater will be available.

Your points 2 and 3 contradict each other. I guess EarnedWater should be ManualWater in point 2? Can you point me to the code that controls the interactions?

XX-Yin commented 1 week ago

A final question: will EarnedWater, ManualWater and AutoWater ever occur in the same trial? If so, do the mice get the sum of them? If not, what is the priority among the three?

Great question.

  1. EarnedWater and ManualWater can occur in the same trial. The order is ManualWater and then the EarnedWater.
  2. EarnedWater and AutoWater can occur in the same trial. The order is AutoWater and then the EarnedWater.
  3. AutoWater and EarnedWater don't occur in the same trial. If this is an AutoWater trial, then no EarnedWater will be available.

Your points 2 and 3 contradict each other. I guess EarnedWater should be ManualWater in point 2? Can you point me to the code that controls the interactions?

You are right. Sorry. I updated it.

To give AutoWater To give reserved ManulWater The timing of earned water is determined in bonsai. Make the earned water unavailable when it's an AutoWater trial (see here).

XX-Yin commented 1 week ago

The volume is not explicitly visualized

This is what I was wondering. I think it would be great if the user can get an immediate visual feedback when they click the manual water button. For example, show give_xx_volume_reserved in the GUI whenever it is updated.

@hanhou I updated the code to show manual water.

XX-Yin commented 1 week ago

No, the RewardDelay is only for EarnedReward (the animal responds to the baited side), not for AutoWater and ManualWater.

If @ZhixiaoSu doesn't think this will confuse the mice that are on RewardDelay, let's leave it as it is then.

Hi Sue @ZhixiaoSu, the manual water (align to the go cue) and auto water will be given after the go cue without delay. Is it a concern for your mice trained with a delayed reward after response? I think it may be ok as the main purpose of manual water and auto water is to increase the motivation and they will be closed as soon as possible.

ZhixiaoSu commented 1 week ago

No, the RewardDelay is only for EarnedReward (the animal responds to the baited side), not for AutoWater and ManualWater.

If @ZhixiaoSu doesn't think this will confuse the mice that are on RewardDelay, let's leave it as it is then.

Hi Sue @ZhixiaoSu, the manual water (align to the go cue) and auto water will be given after the go cue without delay. Is it a concern for your mice trained with a delayed reward after response? I think it may be ok as the main purpose of manual water and auto water is to increase the motivation and they will be closed as soon as possible.

I agree! I think it's a good idea to have the water come out earlier to help them build the association.