Skip to content

Latest commit

 

History

History
178 lines (133 loc) · 6.25 KB

GUIDE.md

File metadata and controls

178 lines (133 loc) · 6.25 KB

About

This guide is a modified version of PyBpod's Installation Guide specific to the Poirazi Lab's Mouse2AFC protocol. For more detail on what PyBpod is and how to use other features please see their wiki here.

Installation

1. Create environment

Do steps 1-3 from Installation for Developers

NOTE: If using Windows 11:

  • Before executing step 2 of the Installation for Developers, open the Windows 10 yml file and delete sqlite=3.19.3=vc14_1,jpeg=9b=vc14_2,qt=5.6.2=vc14_1,matplotlib=2.0.2=np113py36_0 and tk=8.5.18=vc14_0
  • After activating the environment in step 3 of the Installatin for Developers:
conda install jpeg=9b qt=5.6.2 matplotlib=2.0.2 tk --channel conda-forge --channel anaconda --channel defaults

2. Verify conda environment is activated

conda env list

yields

# conda environments:
#
base                    /...
pybpod-environment     */...

with the asterik * next to pybpod-environment

3. Verify the executable is inside the conda environment path

pip --version

yeilds

Linux:

pip 9.0.1 from /home/user/anaconda3/envs/pybpod-environment/lib/python3.6/site-packages/pip (python 3.6)

Windows:

pip 18.1 from C:\Users\user\miniconda3\envs\pybpod-environment\lib\site-packages\pip (python 3.6)

4. Upgrade pip

pip install --upgrade pip

5. Clone pybpod github respository

git clone --recurse-submodules -j8 https://github.com/ckarageorgkaneen/pybpod <REPONAME>

Change<REPONAME> to whatever you like. The repository will be cloned into a new folder called <REPONAME>

6. Install pybpod

cd <REPONAME>
python utils/install.py  # may take a few minutes

7. Clone mouse2afc github repository

Clone outside of <REPONAME>

git clone https://github.com/HenryJFlynn/mouse2afc.git mouse2afc

8. Install mouse2afc

cd mouse2afc
pip install -e .

Setting Up the Protocol in PyBpod

1. Start the pybpod GUI.

Linux:

cd <REPONAME>
python -c 'import pybpodgui_plugin.__main__ as Main; Main.start()'

Windows:

cd <REPONAME>
python -c "import pybpodgui_plugin.__main__ as Main; Main.start()"

image

2. Editing user settings

Click Options then Edit user settings. Paste the following settings:

SETTINGS_PRIORITY = 0

GENERIC_EDITOR_PLUGINS_LIST = ['pybpodgui_plugin', 'pybpod_gui_plugin_emulator']

PYBPOD_SESSION_PATH = 'PYBPOD_SESSION_PATH' 

TARGET_BPOD_FIRMWARE_VERSION = "22"
EMULATOR_BPOD_MACHINE_TYPE = 1

BPOD_BNC_PORTS_ENABLED = [True,True]
BPOD_WIRED_PORTS_ENABLED = [True, True, True, True]
BPOD_BEHAVIOR_PORTS_ENABLED = [True, True, True, False, False, False, False, False]

replace PYBPOD_SESSION_PATH with the path of the folder you want the session to be saved into. (e.g. Linux: /home/user/Documents/mouse2afc_sessions, Windows: "C:\\Users\\mouse2afc\\mouse2afc_sessions")

3. Save the changes

Click Save and close the program.

Running the protocol in PyBpod

1. Run Pybpod

Linux:

cd <REPONAME>
python -c 'import pybpodgui_plugin.__main__ as Main; Main.start()'

Windows:

cd <REPONAME>
python -c "import pybpodgui_plugin.__main__ as Main; Main.start()"

2. Open project folder

Click Open and select pybpod-project located in the mouse2afc repository folder downloaded previously. Should have something like this:

image

3. Select user

In the Projects window, under Users, double-click on Default-User to select it

4. Select Bpod board information

In the Projects window, go to Bpod boards, select Default-Box then in the Details window select the serial port your Bpod is connected to. For Linux the serial port will look like /dev/tty, for Windows COM

image

and click Console:

image

5. Assign subjects to setup

In the Projects window, under Subjects, click on Default-Subject. If not already selected, click on the dropdown widget next to Setup and select the setup you would like this mouse to use:

image

6. Assign experiment setup, board, and protocol

Similarly, under Default Experiment, click on Default-Setup and, if not already selected, select a Board and Procotol for the experiment:

image

7. Add subject to setup

In the Subjects tab, if not already selected, click Add Subject to select the subject(s) for the experiment:

image

8. Open emulator GUI

Click Test Protocol IO and the following GUI window should pop up:

image

9. Run the protocol using Pybpod

Click Save, click Run Protocol, select the appropriate parameters in the task parameter GUI, click Ok and the protocol should run. Check the boxes of your choice in the Poke row to emulate a mouse poking in (checked) and out (unchecked):

image

10. Stop the experiment

When done using, click Stop or Kill, and then Save.

Note about emulator mode in Pybpod:

If you wish to test a protocol without connecting to a Bpod:

  1. Instead of doing step five, check Emulator mode
  2. Under Protocols, open Mouse2AFC_ and edit line 6 to be bpod=Bpod(emulator_mode=True)

Note about examples

The examples are meant to be run outside of pybpod, inside of your IDE