Recording Interpellet Intervals greater than 1 second

74 views
Skip to first unread message

Eric Mitten

unread,
Jun 7, 2022, 4:31:35 PM6/7/22
to FEDforum
Hey Lex,

I'm having some animals, especially during early stages of the training, that are taking longer than a minute to retrieve the pellet. I see in the .cpp code that the max time an animal can take is one minute before it has to call the "run()" function again. Is there a reason this time is set to a minute? If modified, would this affect higher level code or is it simply not possible with the hardware as it is set up currently? The "retInterval" function seems to be acquired using "millis()", so couldn't we use the highest value allowed by "millis()" and get rid of the extra code that records pokes past this 60 second interval? This is some insanely high amount of time (~1200 hours). 

Thanks,
Eric Mitten

Lex Kravitz

unread,
Jun 8, 2022, 3:11:47 PM6/8/22
to FEDforum
Hi Eric,
After a pellet is dispensed FED3 will monitor it for 1 minute to report how long it takes for the mouse to remove it.  This is set in line 167 of the library, as you found:
2022-06-08_13-56-34.jpg

There is no hardware limitation to monitoring the pellet longer than 1 minute.  The reason for monitoring for only 1 minute is that we did not think it was meaningful to measure this delay on trials where the mouse leaves the pellet alone for 30 minutes and then takes it, and we want the FED3 to go back to sleeping the processor as much as it can to save the battery life (it needs to stay away while monitoring the pellet here).  FED3 does also write the "InterPelletInterval" in seconds in column O, which is the time between pellets, which can be useful for analyzing longer intervals. 

If you want to lengthen the "retrieval interval" reported in column N you can increase the number 60000 in line 167, and also in lines 1059 and 1062 (these latter lines control how the FED3 logs this measurement to the SD card). 
2022-06-08_14-02-05.jpg

Modifying this should not affect anything else, so hack away!  If you find this useful we could add a small function to the library so you can change this delay time from the Arduino IDE without modifying the library.  Why don't you hack it first and if it's useful let me know and if so I can add that!   -Lex

Eric Mitten

unread,
Jun 8, 2022, 4:32:30 PM6/8/22
to FEDforum
Changing this value doesn't seem to mess anything up! I was able to record a retrieval time of greater than 10 minutes without any disruptions so I think this is all good. The main reason I was worried about this was because the lines of code called after this one minute wait period were affecting the measurement of time that I have set in the code in relation to an initial startup event (BNC input) and I didn't want that to keep happening. This seems to have fixed the problem and might be a nice addition if people are interested in assessing changes in the time it takes for the animals to receive the pellet!

Thanks,
Eric

Lex Kravitz

unread,
Jun 9, 2022, 10:08:56 AM6/9/22
to FEDforum
Thanks for the update! 

Nik Hayes

unread,
Jun 23, 2022, 3:33:33 PM6/23/22
to FEDforum
I'm just looking into this stuff now... it seems that in the first time column I never get seconds recorded for the times --- it always moves in steps of one minute (i.e. 12:14:00, 12:14:00, 12:15:00). I will also probably have the issue of mice taking longer to retrieve pellets because I'm doing some anorexia studies. The exact time is not that important and 12:14:00 is fine for example. Could I just set time 0 to 12:14:00, then for timings I'll just track the interpelletintervals? I.e. time 0 will be 12:14:00, mouse taking pellet 1 one would be (0 seconds + interpelletinterval seconds in row 2).

On Wednesday, June 8, 2022 at 2:11:47 PM UTC-5 lex.k...@gmail.com wrote:

Lex Kravitz

unread,
Jun 23, 2022, 3:52:19 PM6/23/22
to FEDforum
Hi Nik, are you re-saving the FED3 .csv files in Excel?  Excel will drop the seconds place when it resaves a .csv (it's trying to be helpful?).  The seconds place should be there when you pull the files from FED3, so if you open/save them in Excel make sure to re-save a copy as .xlsx or specifically include the HH:MM:SS format in the first column to force Excel to retain the seconds place in a .csv file.  More info on this here.

Nikolas Hayes

unread,
Jun 27, 2022, 1:40:09 PM6/27/22
to Lex Kravitz, FEDforum
Ok cool, thank you for the tip. So I tried two things -- 1) have python import the csv and convert to xlsx (which didn't rescue the seconds)   2) Automatically open all CSVs in notepad instead of excel which didn't work either... Turns out some of my csv files have seconds and some do not for whatever reason... I will have to look into this more.

Best,
Nik

--
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/07f5da35-47a7-4256-b832-117032445bben%40googlegroups.com.

Lex

unread,
Jun 27, 2022, 2:57:30 PM6/27/22
to Nikolas Hayes, FEDforum
Hi Nik, I suspect that the files without seconds have been opened and resaved as .csv files in Excel at some point.  Once Excel strips the seconds out of a .csv file they cannot be recovered unfortunately. More info on this behavior here




Reply all
Reply to author
Forward
0 new messages