Skip to content

Installation Instructions

Kenta M. Hagihara edited this page May 15, 2024 · 59 revisions

Clone repository onto your computer

  • Open GitHub Desktop, click clone from URL
  • URL: https://github.com/AllenNeuralDynamics/dynamic-foraging-task.git
  • installation directory should be C:\Users\svc_aind_behavior\Documents\GitHub\

Install Bonsai on your computer

  • In a file window, open C:\Users\svc_aind_behavior\Documents\GitHub\dynamic-foraging-task\bonsai
  • Click on setup.cmd

Update the firmware of the Harp Behavior Board

  • following the instructions here.

Setting up the Harp Soundcard and uploading the GoCue soundwaveform

  • follow the instruction here

Update the firmware of the Harp Sound Board

  • following the instructions here.
  • firmware is stored in \allen\aind\scratch\Xinxin\SoundcardFirmware.

Create a conda environment, with python version 3.11

  • install conda instructions here
  • Add conda to the path variable
    • instructions from here
    • Open Advanced System Settings
    • Click on "Environment Variables", then "Edit Path", then add the following paths:
      • C:\Users\svc_aind_behavior\AppData\Local\miniconda3
      • C:\Users\svc_aind_behavior\AppData\Local\miniconda3\Scripts
      • C:\Users\svc_aind_behavior\AppData\Local\miniconda3\Library\bin
      • C:\Users\svc_aind_behavior\AppData\Local\miniconda3\condabin
    • If you see an entry for AppData\Local\Microsoft\WindowsApps move this path entry to the bottom
  • Open miniconda3 prompt, and type conda init. Close, and reopen the prompt
  • Create an environment: conda create -n Foraging python=3.11

Use pip to install

  • Open miniconda3 prompt
  • Activate the environment: conda activate Foraging
  • change to the directory: C:\Users\svc_aind_behavior\Documents\GitHub\dynamic-foraging-task
  • run pip install -e .
  • This should install all the required python packages.
  • If you encounter errors in dependency or finding repositories, see below for trouble shooting.

Copy the Settings for each box

  • Copy dynamic-foraging-task/src/setting_templates/Settings_box<box num>.csv to Users\svc_aind_behavior\Documents\ForagingSettings
    • Copy <box num> 1-4 depending on the computer (A,B,C,D maps to 1,2,3,4)
    • Configure the Behavior/Soundcard COM ports for each computer (instruction to find COM ports)
      • Unplug the USB cables for the Behavior and Soundcard boards for one of the two behavior boxes connected to each computer.
      • In a file browser, navigate to C:\Users\svc_aind_behavior\Documents\GitHub\dynamic-foraging-task\bonsai
      • Click on Bonsai, then New Project
      • In the Toolbox window type Device (Harp)
      • Select the Node, then in the side tab in the main editor, iterate through the COM Ports and look in the console window, which will tell you which board is connected to which COM port. Note, it's not recommended to change COM ports in a Device-node-window that pops up when you double click the Device node as it causes glitchy behavior. Dedicated node such as Device (Harp.Behavior) could be more stable.
      • Plug in the other behavior box's boards and repeat the steps.
    • The BonsaiOsc ports are determined by the box number, and should not be modified.
    • AINDLickDetector: use 1 if using the AIND Lickity Split detector, 0 otherwise
      • If using the AIND lick detector, then you need to set the following fields:
      • LeftLickDetector: COM port for the left lick detector
      • RightLickDetector: COM port for the right lick detector
    • HighSpeedCamera: use 0 if not using high speed cameras, 1 otherwise
      • The following settings are only relevant if HighSpeedCamera is enabled:
      • HasSideCameraLeft: use 0 if not using a high speed left camera, 1 otherwise
      • HasSideCameraRight: use 0 if not using high speed right camera, 1 otherwise
      • HasBodyCamera: use 0 if not using high speed body camera, 1 otherwise
      • HasBottomCamera: use 0 if not using high speed bottom camera, 1 otherwise
      • SideCameraLeft: serial number for high speed left side camera (instruction to find serial number)
      • SideCameraRight: serial number for high speed right side camera
      • BodyCamera: serial number for high speed body camera
      • BottomCamera: serial number for high speed bottom camera
      • codec The codec for high speed camera encoding

Set up the desktop shortcuts

  • Copy dynamic-foraging-task\src\desktop_shortcuts\Box<box num>.bat to the Desktop
  • Copy <box num> A-D depending on the computer
  • Repeat for Box<box num> with console.bat

Configure ForagingSettings.json

  • Make a folder Users\svc_aind_behavior\Documents\ForagingSettings
  • Copy the template from dynamic-foraging-task\src\setting_templates\ForagingSettings.json to Users\svc_aind_behavior\Documents\ForagingSettings\ForagingSettings.json
    • You should not have to modify these settings:
      • "bonsai_path":"C:\Users\svc_aind_behavior\Documents\Github\dynamic-foraging-task\bonsai\Bonsai.exe",
      • "bonsaiworkflow_path":"C:\Users\svc_aind_behavior\Documents\Github\dynamic-foraging-task\src\workflows\foraging.bonsai"
      • "default_saveFolder": "C:\Documents\"
      • "temporary_video_folder":"C:\Users\svc_aind_behavior\Documents\temporaryvideo\",
      • "show_log_info_in_console":false (only used for debugging)
    • This field is mandatory and must be configured for each computer:
      • "current_box": For example "447-1". For computers in 446/447, use "447-<tower_number>", for example: , "447-1"
    • These settings need to be configured for each computer:
      • "Teensy_COM": For example "COM10",
        • This is only for fiber-photometry
        • Follow instructions on the wiki to install Arduino IDE (1.8x) and TeensyDuino
        • Once both are installed open ArduinoIDE, go to Tools>Port, select COMport cooresponding to Teensy4.1, and this value to the ForagingSettings.json
      • "FIP_workflow_path":
        • This is only for fiber-photometry
        • A string path to the ThorFIP.bonsai workflow in the FIP_DAQ_control repo
      • "newscale_serial_num_box1": For example 46103
      • "newscale_serial_num_box2": For example 46104
      • "newscale_serial_num_box3": For example 46105
      • "newscale_serial_num_box4": For example 46106
        • Determine the serial numbers of the Newscale Stages
          • Unplug the stages for one of the two boxes
          • Open Miniconda Prompt
          • type conda activate Foraging
          • navigate to dynamic-foraging-task/src/foraging)gui
          • python
          • from MyFunctions import NewScaleSerialY
          • serial_num = NewScaleSerialY.get_instances()[0]
        • Edit ForagingSettings.json to add a line "newscale_serial_num_box1":<serial number for rig 1>
          • (A,B,C,D maps to 1,2,3,4)

Create the log file folder

  • Create a log file folder at Users\Documents\foraging_gui_logs

Allow scripts to run in PowerShell

Open Powershell as an Administrator, then type the following command Set-ExecutionPolicy RemoteSigned

Trouble shooting

"Instance property BufferSize is not defined for type Bonsai.DAQmx.TriggeredAnalogOutput"

Make sure the NIDaq software is installed

conda installation of the repository fails

  • Open Advanced System Settings
  • Click on "Environment Variables"
  • Under System Variables, delete any entries for PIP_INDEX_URL and PIP_TRUSTED_HOST

Errors about git

Ensure git is up to date

  • git --version in the command prompt
  • if its less than 2.30, install a new version of git
  • make sure only one version of git is installed where git
  • if needed uninstall cmndr
Clone this wiki locally