Run a session#

Open the 2 GUIs#

VR4mice#

In a terminal window, activate your conda environment where you installed the vr4mice package source code like this:

conda activate env_name

Then, to start a session, you can run:

vr4mice

Finally, the GUI that controls the experiment logic should appear! Alternatively, you can add these commands to a .bat script so that all you need to do it click on an icon on your Desktop.

DeepLabCut-live#

In a second terminal window, activate your conda environment where you installed the dlclivegui package source code just like you did above for the vr4mice environment. Then, to start the GUI, you can run:

dlclivegui

This should open up the DLCLive GUI on your screen!

Note: close the program using the GUI’s β€œStop”/”Close” buttons, and NOT via β€œcrtl-C”/”crtl-Z”

Set up a session in the VR4mice GUI (aka Teensy Experiment)#

Steps 1 to 4
  1. Select the desired configuration, the appropriate Rig and hit β€œConnect”. (the name of the selected Rig should appear next to Current Rig)

  2. Select the Subject’s ID or name, the Attempt number and define the Save Directory.

  3. Select the wanted Task Directory.

  4. Define the Task and edit its parameters as needed.

Open the DeepLabCut-live GUI#

Steps 5 to 9
  1. Initialize the camera by clicking the β€œInit Cam” button. (a window should pop up with an a live video stream from the camera)

  2. Select the Processor file and hit β€œSet Proc” to load it.

  3. Choose the DeepLabCut model that you are going to use from the dropdown list. (DO NOT hit Init DLC for now)

  4. Select the Subject’s name (or ID) and make sure it matches the one on the vr4mice GUI.

  5. Hit β€œSet Up Session”. (the Ready box below should turn blue)

Step 10

Tip

Now, before initializing DLC, it would be a great time to take the selected mouse and put it gently (with tube handling) in the arena. Avoid forcing the mouse onto the platform, slowly approach with the tube and let the mouse naturally come out and into the arena.

  1. Hit β€œInit DLC” and wait until the GPUs are loaded (look at the terminal window). DLCLive is now waiting for a socket with vr4mice GUI to be established.

Launch OBS screen recording#

Open OBS and start recording the screen (the screen where you are displaying the game on the rig). If you don’t have OBS yet, check out this link to download it.

Warning

Make sure to set the recording FPS (frame rate per second) to 120.

On the VR4mice window#

Steps 11 and 12
  1. Click on β€œReady” to initialize the task and complete the socket.

  2. Click on β€œStart”. (if you need to manually stop the task, hit β€œStop”. Otherwise, the task will stop automatically)

    After the task started correctly, the bottom part of the panel should contain some information about the running session.

On the DeepLabCut-live window#

Step 13
  1. Hit β€œOn” to start recording video and DLC data.

Saving data#

The following steps have to be performed once the experimenter wants to end the session and save the recorded data (they are the same steps even if the session was started by mistake or with the wrong configuration parameters and has to be stopped, the only difference will be in whether the data should be saved or not). Here the order is important, make sure to start with the DeepLabCut-live GUI followed by the VR4mice GUI and OBS.

On the DeepLabCut-live window:#

Step 14
  1. Hit the Record β€œOff” button followed by β€œSave Video”.

    4 different data types will be saved in the directory specified in the DLCLive-GUI:

    • .avi = the raw video

    • _TS.npy = the time steps for each of the recorded frames

    • .h5 = the recorded DLC key-points

    • PROC = the processed dlc key-points which get sent to the unity game

On the VR4mice window:#

Step 15
  1. To save the data, hit β€œStop” followed by β€œSave Task Data”.

    Data will be saved to: <your save directory>/<subject>_YYYY-MM-DD_<attempt>.pkl (pickle file)

Stop OBS screen recording#

  1. Last but not least, go back to OBS and stop the screen recording you started earlier. This will automatically save the video to a default path. Normally it should be in the current user’s Videos folder. Make sure, after each session, to go to the aforementioned folder and rename the recorded video by inserting the name of the subject (i.e. mouse’s name) at the beginning and the attempt number at the end. The naming convention used is Name_Date_Attempt.* (e.g. Nightingale_2024-07-28_1.*). The Date should already be present since it’s automatically added by the OBS software.

    Note: the date will have US format.

To run another session, repeat the above steps. Data from the previous session is still loaded (and can be saved again with a different file name by changing the subject or attempt) until a new task is initialized (i.e. until you click β€œReady”). Usually you’ll need to run another mouse, thus meaning that Subject Name should be changed accordingly as well as the Attempt, which should be set back to 1 if not already. The task may also need to be changed since different mice may be at different training stages depending on the continuation criteria present in the protocol. After the new session parameters have been set, go back to step 9 here and repeat the steps from there.