-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample1.texw
25 lines (19 loc) · 1.51 KB
/
example1.texw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
This example shows how to obtain the number of visits in which a mouse
performed the first nosepoke to the left side or the right side of the corner.
In the first line, the library is imported. We use \code{pm} as an abbreviated name of the library.
In the second line, the example data are loaded from a single IntelliCage file.
In the third line,
a list of all visits of a mouse named `Jerry' is obtained.\footnote{The mice are referred to by names defined in the design of IntelliCage experiment, not by the RFID tag numbers.} Note that a \code{list} of names is passed as an argument.
Next, the first nosepoke is selected from every visit \code{v} (if any nosepoke was made during that visit). Note that the condition \code{if v.Nosepokes} is met if the list \code{v.Nosepokes} is not empty.
The side the mouse poked is obtained as \code{nosepoke.Door} in the fifth line of the code. This returns either \code{\textquotesingle{}left\textquotesingle} or \code{\textquotesingle{}right\textquotesingle}, thus disregarding the information about the corner in which the nosepoke was performed.
Finally, in the last line, the number of visits with the first nosepoke to the left and the right side is calculated and displayed.
\begin{samepage}
<<term=True, results='verbatim'>>=
import pymice as pm
data = pm.Loader('demo.zip')
visits = data.getVisits(mice=['Jerry'])
firstNps = [v.Nosepokes[0] for v in visits if v.Nosepokes]
sides = [nosepoke.Door for nosepoke in firstNps]
print sides.count('left'), sides.count('right')
@
\end{samepage}