Changes in FR1 reversal or Prob Reversal Tasks

52 views
Skip to first unread message

Kay Juen

unread,
Aug 18, 2023, 2:45:01 AM8/18/23
to FEDforum
Hi,
I read in the comment of the "FR1 reversal task" that the code can be changed to have the number of pellets rather than the number of pokes as switch for the poke holes.
IMHO, the parameter "pellet" (indicative for correct pokes) could be the better parameter to switch the rule than the absolute number of pokes.
Honestly, I have no idea how to change the code properly. Could you give me a hint what I have to change at what position?

Best regards and thanks in advance,

Kay

Lex

unread,
Aug 18, 2023, 2:01:42 PM8/18/23
to Kay Juen, FEDforum
Hi Kay,
Glad you're looking into the different example programs!  The FR1 reversal example uses two variables to control the task: trialsToSwitch and counter (lines 23 and 24):
image.png

The task determines which poke is active by the following logic: if counter is less than or equal to trialsToSwitch (line 36) the Left poke becomes active; if counter is greater than trialsToSwitch (line 37) the Right poke becomes active; and if counter is a multiple of trialsToSwitch (line 35) counter resets to 1 so the process can repeat.  This bit of code could be clearer but  I wrote it in the middle of 2020 when we were stuck indoors with a baby and my brain was probably a bit scrambled :)
image.png

The code then accounts for the 4 cases that can happen, based on what the animal does and which poke is active: 
1) A left poke while the left poke is active
2) A left poke while the right poke is active
3) A right poke while the left poke is active
4) A right poke while the right poke is active

If you look at the code for each of these cases you'll see that in all four cases the code increments the counter variable by one (the counter++ call in lines 50, 57, 64, and 72). So to make the task reverse only after a certain number of pellets (and not pokes), we want to add one to counter only if the mouse gets a pellet.  In practice, this means we'll comment out the counter++ call when the mouse doesn't get a pellet (comment out lines 57 and 64) in the original task code. I'm attaching a modified version that has these two lines commented out.  You can reflash this (you can also edit trialsToSwitch to be whatever you want) and FED3 will reverse after a set number of pellets and not pokes.
image.png
image.png

Hope this helps, have fun!
-Lex 




--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fedforum/3afde642-81c3-457b-839b-d802a46905f2n%40googlegroups.com.
ReversalTaskPellets.ino

Kay Juen

unread,
Aug 21, 2023, 2:20:04 AM8/21/23
to FEDforum
Hi,
thank you so much. I will test the new settings this week and will let you know if it is working!

Best
Kay
Reply all
Reply to author
Forward
0 new messages