Recording Nosepokes during timeout period

78 views
Skip to first unread message

Jaycee Choi

unread,
Jul 29, 2022, 1:11:30 PM7/29/22
to FEDforum
Hello everyone!

I have currently been working on trying to include a 90s timeout period, while still recording nosepokes during that period. The extent to which I got was the ability to add the 90s timeout period. However, somehow the nosepokes are being counted while the pellet is still in the bin, instead of during the actual timeout period.

I was wondering if anyone could help me out with me code, or if there were plans on adding a variable to measure nosepokes during a timeout! I used the millis() function instead of the timeout to try and get around the non-logging nosepokes.

Here is my code below: 
Screen Shot 2022-07-29 at 1.07.30 PM.png
Thanks for your help in advance!

Jaycee Choi

Lex Kravitz

unread,
Jul 29, 2022, 8:17:56 PM7/29/22
to FEDforum
Hi Jaycee!
It seems like you're on the right track!  One tip when using millis() is to turn off the sleep modes (call the function "fed3.disableSleep()" in your void setup() loop).  When the processor sleeps the millis() timer also stops, so you may get unexpected behavior from using the millis() timer. 

But yes I do plan to add logging for nosepokes during the timeout!  I should have time next week to do this and then update the library. 

Can you help me specify how this should work? 
Would you want to call the function fed3.Timeout(90); to start a 90s timeout, and have nosepokes during the timeout log as "LeftDuringTimeout" and "RightDuringTimeout" in the Event column of the datafile?  Please let me know if that sounds right to you. 

Best, -Lex

Jaycee Choi

unread,
Aug 1, 2022, 10:31:37 AM8/1/22
to FEDforum
Hi Lex,

I will try using the .disableSleep() function! I would also greatly appreciate if you got around to updating the library to include nosepoke logging during the timeout. The method that you outlined with LeftDuringTimeout and RightDuringTimeout sounds right to me. Thank you for your help!

Jaycee

Jaycee Choi

unread,
Aug 3, 2022, 10:23:16 AM8/3/22
to FEDforum
Hi Lex,

Just wanted to follow up with you and ask if you had a chance to add the logging for the nosepokes during the timeout! I have not been able to figure out the code myself still even with the disable.Sleep() function. Thank you again for your help!

Message has been deleted

Lex Kravitz

unread,
Aug 5, 2022, 10:28:14 AM8/5/22
to FEDforum
Hi Jaycee!
I've rewritten the Timeout() function to log pokes.  FED3 will now log pokes during the Timeout as "LeftinTimeout" and "RightinTimeout" in the Event column. The new Timeout function does not use millis() so you can leave the FED3 sleep functions enabled and take advantage of longer battery life. 

2.jpg

To use the new Timeout() function, update your FED3 library to v1.1.4.0 via the library manager:
1.jpg

Please let me know if this works for you. As you'll be the first tester besides me, please also let me know if you discover any issues or bugs with it!   Best, -Lex

Samuel Walker

unread,
Nov 8, 2022, 12:37:41 PM11/8/22
to FEDforum
Hi Lex,

Thanks for this update to the Timeout() function - super useful!
A couple of questions about this:
-I want to use pokes to initiate timeouts (so when a mouse pokes, it gets a CS and a timeout in order to force a delay between pokes). If the FED is now counting pokes within the timeout, is there a way to stop these from initiating a new timeout? For example, if I want a poke to start a 5s timeout, but the mouse pokes again after 1s, I don't want that poke to restart the 5s timer.
-If I call LeftCount in arduino, does that count include pokes both within and outside a timeout period (i.e. does it include LeftinTimeout)?

Thanks a lot!
Sam

Lex

unread,
Nov 8, 2022, 9:23:52 PM11/8/22
to Samuel Walker, FEDforum
Hey Sam,
To answer your questions:
1) Pokes during the Timeout function will not re-start the Timeout.  
2) The fed3.LeftCount variable will include *all* Left pokes (and display all Left pokes on the screen).  This inlcudes those that occurred during the timeout, with a pellet in the well, and during dispense.  However, in the logfile the different types of pokes have different names: "Left", "LeftWithPellet", "LeftInTimeout", "LeftDuringDispense".  So if you are interested in counting up Left pokes outside of those other events you can filter the file for those.  

Hope this helps! -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/33ac2fc5-d689-486a-814f-eb0d26a8c23en%40googlegroups.com.

Samuel Walker

unread,
Nov 9, 2022, 12:18:18 PM11/9/22
to FEDforum
Hi Lex,

Great, thank you!

Sam
Reply all
Reply to author
Forward
0 new messages