|
1 | 1 | ----------
|
2 | 2 | # Rigbox
|
3 | 3 |
|
4 |
| -Rigbox is a (mostly) object-oriented MATLAB software package for designing and controlling behavioural experiments. Principally, the steering wheel setup we developed to probe mouse behaviour. It requires two computers, one for stimulus presentation ('the stimulus server') and another for controlling and monitoring the experiment ('mc'). |
| 4 | +Rigbox is a (mostly) object-oriented MATLAB software package for designing and controlling behavioural experiments (principally, the [steering wheel setup](https://www.ucl.ac.uk/cortexlab/tools/wheel) which [we](https://www.ucl.ac.uk/cortexlab) developed to probe mouse behaviour. Rigbox requires two machines, one for stimulus presentation ('the stimulus server') and another for controlling and monitoring the experiment ('mc'). |
5 | 5 |
|
6 | 6 | ## Getting Started
|
7 | 7 |
|
8 |
| -The following is a brief description of how to install Rigbox on your experimental rig. However detailed, step-by-step information can be found [here](https://www.ucl.ac.uk/cortexlab/tools/wheel). |
| 8 | +The following is a brief description of how to install Rigbox on your experimental rig. Additional detailed, step-by-step information can be found [here](https://www.ucl.ac.uk/cortexlab/tools/wheel). |
9 | 9 |
|
10 | 10 | ## Prerequisites
|
11 |
| -Rigbox has a number of essential and optional software dependencies, listed below: |
12 |
| -* Windows 7 or later |
13 |
| -* [MATLAB](https://uk.mathworks.com/downloads/web_downloads/?s_iid=hp_ff_t_downloads) 2016a or later |
14 |
| - * [Psychophsics Toolbox](https://github.com/Psychtoolbox-3/Psychtoolbox-3/releases) v3 or later |
15 |
| - * [NI-DAQmx support package](https://uk.mathworks.com/hardware-support/nidaqmx.html) |
16 |
| - * [GUI Layout Toolbox](https://uk.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox) v2 or later |
17 |
| - * Data Acquisition Toolbox |
18 |
| - * Signal Processing Toolbox |
19 |
| - * Instrument Control Toolbox |
| 11 | + |
| 12 | +Rigbox has the following software dependencies: |
| 13 | +* Windows Operating System (7 or later) |
| 14 | +* MATLAB (2016a or later) |
| 15 | +* The following MathWorks MATLAB toolboxes: |
| 16 | + * Data Acquisition Toolbox |
| 17 | + * Signal Processing Toolbox |
| 18 | + * Instrument Control Toolbox |
| 19 | + * Statistics and Machine Learning Toolbox |
| 20 | +* The following community MATLAB toolboxes: |
| 21 | + * [GUI Layout Toolbox](https://uk.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox) (v2 or later) |
| 22 | + * [Psychophsics Toolbox](http://psychtoolbox.org/download.html) (v3 or later) |
| 23 | + * [NI-DAQmx support package](https://uk.mathworks.com/hardware-support/nidaqmx.html) |
| 24 | + |
| 25 | +(* *Note*: You can download all required MathWorks MATLAB toolboxes directly within MATLAB via the "Add-Ons" button in the top Toolstrip with the "Home" tab selected.) |
| 26 | + |
| 27 | + |
| 28 | +Afterwards, you can use the MATLAB "ver" command to bring up the list of installed MathWorks toolboxes. |
20 | 29 |
|
21 | 30 | Additionally, Rigbox works with a number of extra submodules (included):
|
22 |
| -* [Signals](https://github.com/dendritic/signals) (for running bespoke experiment designs) |
23 |
| - * Statistics and Machine Learning Toolbox |
24 |
| - * [Microsoft Visual C++ Redistributable for Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145) |
25 |
| -* [Alyx-matlab](https://github.com/cortex-lab/alyx-matlab) (for registering data to, and retrieving from, an Alyx database |
26 |
| -* [NPY-matlab](https://github.com/kwikteam/npy-matlab) (for saving data in binary NPY format) |
27 |
| - |
28 |
| -## Installing |
29 |
| -1. To install Rigbox, clone the repository in git. It is *not* recommended to clone directly into the MATLAB folder |
30 |
| -```git clone https://github.com/cortex-lab/Rigbox.git``` |
31 |
| -2. Pull the latest Rigbox-lite branch. This branch is currently the 'cleanest' one, however in the future it will likely be merged with the master branch. |
| 31 | +* [signals](https://github.com/cortex-lab/signals) (for running bespoke experiment designs) |
| 32 | +* [alyx-matlab](https://github.com/cortex-lab/alyx-matlab) (for registering data to, and retrieving from, an Alyx database) |
| 33 | +* [npy-matlab](https://github.com/kwikteam/npy-matlab) (for saving data in binary NPY format) |
| 34 | +* [wheelAnalysis](https://github.com/cortex-lab/wheelAnalysis) (for analyzing data from the steering wheel task) |
| 35 | + |
| 36 | +## Installation via git |
| 37 | + |
| 38 | +0. It is highly recommended to install Rigbox via git. If not already downloaded and installed, install [git](https://git-scm.com/download/win) (and the included minGW software environment and Git Bash MinTTY terminal emulator). After installing, launch the Git Bash terminal. |
| 39 | +1. To install Rigbox, use the following commands in the Git Bash terminal to clone the repository from github to your local machine. (* *Note*: It is *not* recommended to clone directly into the MATLAB folder) |
| 40 | +``` |
| 41 | +cd ~ |
| 42 | +git clone https://github.com/cortex-lab/Rigbox.git |
| 43 | +``` |
| 44 | +2. Pull the latest Rigbox-lite branch. This branch is currently the cleanest one, though in the future it will likely be merged with the master branch. |
32 | 45 | ```
|
33 | 46 | cd Rigbox/
|
34 | 47 | git checkout rigbox-lite
|
35 | 48 | ```
|
36 |
| -3. Run the following to clone the submodules: |
37 |
| -```git submodule update --init``` |
38 |
| -3. In MATLAB run 'addRigboxPaths.m' and restart the program. |
39 |
| -4. Set the correct paths by following the instructions in Rigbox\+dat\paths.m on both computers. |
40 |
| -5. On the stimulus server, load the hardware.mat file in Rigbox\Repositories\code\config\exampleRig and edit according to your specific hardware setup (link to detailed instructions above, under 'Getting started'). |
| 49 | +3. Clone the submodules: |
| 50 | +``` |
| 51 | +git submodule update --init |
| 52 | +``` |
| 53 | +4. Open MATLAB, make sure Rigbox and all subdirectories are in your path, run: |
| 54 | +> addRigboxPaths |
| 55 | +
|
| 56 | +and restart MATLAB. |
| 57 | + |
| 58 | +5. Set the correct paths by following the instructions in the 'Rigbox\+dat\paths.m' file on both machines. |
| 59 | +6. On the stimulus server, load 'Rigbox\Repositories\code\config\exampleRig\hardware.mat' and edit according to your specific hardware setup (link to detailed instructions above, under 'Getting started'). |
41 | 60 |
|
42 |
| -To keep up to date, run the following: |
| 61 | +To keep the submodules up to date, run the following in the Git Bash terminal (within the Rigbox directory): |
43 | 62 | ```
|
44 | 63 | git pull
|
45 | 64 | git submodule update --remote
|
46 | 65 | ```
|
47 |
| - |
48 |
| -## Running an experiment |
| 66 | +## Running an experiment in MATLAB |
49 | 67 |
|
50 | 68 | On the stimulus server, run:
|
51 | 69 | > srv.expServer
|
52 | 70 |
|
53 | 71 | On the mc computer, run:
|
54 | 72 | > mc
|
55 | 73 |
|
56 |
| -This opens a GUI that will allow you to choose a subject, edit some of the experimental parameters and press 'Start' to begin the basic steering wheel task on the stimulus server. |
| 74 | +This opens a GUI that will allow you to choose a subject, edit some of the experimental parameters and press 'Start' to begin the basic steering wheel task on the stimulus server. |
| 75 | + |
| 76 | +## Code organization |
57 | 77 |
|
58 |
| -# Code organization |
59 | 78 | Below is a list of the principle directories and their general purpose.
|
60 |
| -## +dat |
61 |
| -The data package contains all the code pertaining to the organization and logging of data. It contains functions that generate and parse unique experiment reference ids, that return the file paths where subject data and rig configuration information is stored. Other functions include those that manage experimental log entries and parameter profiles. This package is akin to a lab notebook. |
62 | 79 |
|
63 |
| -## +eui |
64 |
| -This package contains the code pertaining to the Rigbox user interface. It contains code for constructing the mc GUI (MControl.m), and for plotting live experiment data or generating tables for viewing experiment parameters and subject logs. This package is exclusively used by the mc computer. |
| 80 | +### +dat |
| 81 | + |
| 82 | +The "data" package contains code pertaining to the organization and logging of data. It contains functions that generate and parse unique experiment reference ids, and return file paths where subject data and rig configuration information is stored. Other functions include those that manage experimental log entries and parameter profiles. A nice metaphor for this package is a lab notebook. |
65 | 83 |
|
66 |
| -## +exp |
67 |
| -The experiment package is for the initialization and running of behavioural experiments. These files define a framework for event- and state-based experiments. Actions such as visual stimulus presentation or reward delivery can be controlled by experiment phases, and experiment phases are managed by an event-handling system (e.g. ResponseEventInfo). |
| 84 | +### +eui |
68 | 85 |
|
69 |
| -The package also triggers auxiliary services (e.g. starting remote acquisition software), and loads parameters for presentation each trail. The principle two base classes that control these experiments are Experiment and its Signals counterpart, SignalsExp. |
| 86 | +The "user interface" package contains code pertaining to the Rigbox user interface. It contains code for constructing the mc GUI (MControl.m), and for plotting live experiment data or generating tables for viewing experiment parameters and subject logs. |
70 | 87 |
|
71 |
| -This package is almost exclusively used by the stimulus server |
| 88 | +This package is exclusively used by the mc computer. |
72 | 89 |
|
73 |
| -## +hw |
74 |
| -The hardware package is for configuring, and interfacing with, hardware such as screens, DAQ devices, weighing scales and lick detectors. Withing this is the +ptb package which contains classes for interacting with PsychToolbox. |
| 90 | +### +exp |
75 | 91 |
|
76 |
| -The devices file loads and initializes all the hardware for a specific experimental rig. There are also classes for unifying system and hardware clocks. |
| 92 | +The "experiments" package is for the initialization and running of behavioural experiments. It contains code that define a framework for event- and state-based experiments. Actions such as visual stimulus presentation or reward delivery can be controlled by experiment phases, and experiment phases are managed by an event-handling system (e.g. ResponseEventInfo). |
77 | 93 |
|
78 |
| -## +psy |
79 |
| -This package contains simple functions for processing and plotting psychometric data |
| 94 | +The package also triggers auxiliary services (e.g. starting remote acquisition software), and loads parameters for presentation for each trail. The principle two base classes that control these experiments are 'Experiment' and its "signals package" counterpart, 'SignalsExp'. |
80 | 95 |
|
81 |
| -## +srv |
82 |
| -This package contains the expServer function as well as classes that manage communications between rig computers. |
| 96 | +This package is almost exclusively used by the stimulus server. |
83 | 97 |
|
84 |
| -The Service base class allows the stimulus server to start and stop auxiliary acquisition systems at the beginning and end of experiments |
| 98 | +### +hw |
85 | 99 |
|
86 |
| -The StimulusControl class is used by the mc computer to manage the stimulus server |
| 100 | +The "hardware" package is for configuring, and interfacing with, hardware (such as screens, DAQ devices, weighing scales and lick detectors). Within this is the "+ptb" package which contains classes for interacting with PsychToolbox. |
87 | 101 |
|
88 |
| -NB: Lower-level communication protocol code is found in the +io package |
| 102 | +'devices.m' loads and initializes all the hardware for a specific experimental rig. There are also classes for unifying system and hardware clocks. |
89 | 103 |
|
90 |
| -## cb-tools\burgbox |
91 |
| -Burgbox contains many simply helper functions that are used by the main packages. Within this directory are further packages: |
| 104 | +### +psy |
| 105 | + |
| 106 | +The "psychometrics" package contains simple functions for processing and plotting psychometric data. |
| 107 | + |
| 108 | +### +srv |
| 109 | + |
| 110 | +The "stim server" package contains the expServer function as well as classes that manage communications between rig computers. |
| 111 | + |
| 112 | +The 'Service' base class allows the stimulus server to start and stop auxiliary acquisition systems at the beginning and end of experiments. |
| 113 | + |
| 114 | +The 'StimulusControl' class is used by the mc computer to manage the stimulus server. |
| 115 | + |
| 116 | +* *Note*: Lower-level communication protocol code is found in the "cortexlab/+io" package. |
| 117 | + |
| 118 | +### cb-tools/burgbox |
| 119 | + |
| 120 | +Burgbox contains many simple helper functions that are used by the main packages. Within this directory are additional packages: |
92 | 121 |
|
93 | 122 | * +bui --- Classes for managing graphics objects such as axes
|
94 | 123 | * +aud --- Functions for interacting with PsychoPortAudio
|
95 | 124 | * +file --- Functions for simplifying directory and file management, for instance returning the modified dates for specified folders or filtering an array of directories by those that exist
|
96 | 125 | * +fun --- Convenience functions for working with function handles in MATLAB, e.g. functions similar cellfun that are agnostic of input type, or ones that cache function outputs
|
97 |
| -* +img --- Classes that deal with image and frame data (DEPRICATED) |
| 126 | +* +img --- Classes that deal with image and frame data (DEPRECATED) |
98 | 127 | * +io --- Lower-level communications classes for managing UDP and TCP/IP Web sockets
|
99 |
| -* +plt --- A few small plotting functions (DEPRICATED) |
| 128 | +* +plt --- A few small plotting functions (DEPRECATED) |
100 | 129 | * +vis --- Functions for returning various windowed visual stimuli (i.g. gabor gratings)
|
101 |
| -* +ws --- An early Web socket package using SuperWebSocket (DEPRICATED) |
| 130 | +* +ws --- An early Web socket package using SuperWebSocket (DEPRECATED) |
| 131 | + |
| 132 | +### cortexlab |
102 | 133 |
|
103 |
| -## cortexlab |
104 |
| -The cortexlab directory is intended for functions and classes that are rig or lab specific, for instance code that allows compatibility with other stimulus presentation packages used by cortexlab (i.e. MPEP) |
| 134 | +The cortexlab directory is intended for functions and classes that are rig or cortexlab specific, for instance code that allows compatibility with other stimulus presentation packages used by cortexlab (e.g. MPEP) |
105 | 135 |
|
106 |
| -## alyx-matlab/@Alyx |
107 |
| -This class allows interation with an instance of the Alyx database. More information about Alyx can be found [here](http://alyx.readthedocs.io/en/latest/). Information about using the alyx-matlab class can be found in [alyx-matlab/Examples.m](https://github.com/cortex-lab/alyx-matlab/blob/alyx-as-class/Examples.m). |
| 136 | +### submodules |
| 137 | + |
| 138 | +Additional information on the [alyx-matlab](https://github.com/cortex-lab/alyx-matlab), [npy-matlab](https://github.com/kwikteam/npy-matlab), [signals](https://github.com/cortex-lab/signals) and [wheelAnalysis](https://github.com/cortex-lab/wheelAnalysis) submodules can be found in their respective github repositories. |
108 | 139 |
|
109 | 140 | ## Authors
|
110 |
| -The majority of the Rigbox code was written by [Chris Burgess](https://github.com/dendritic/) in 2013. It is now maintained and developed by a number of people at [CortexLab](https://www.ucl.ac.uk/cortexlab). |
| 141 | + |
| 142 | +The majority of the Rigbox code was written by [Chris Burgess](https://github.com/dendritic/) in 2013. It is now maintained and developed by a number of people at [CortexLab](https://www.ucl.ac.uk/cortexlab). |
0 commit comments