Update Initialization: Links authored by Fabian Berg's avatar Fabian Berg
This chapter contains functions that are essential to the toolbox. The functions myHardwareSetup and myParadigmSetup need to be edited manually when building a new experiment. The functions initOTBR and stopExperiment should be called in each of your experiment scripts.
This chapter contains functions that are essential to the toolbox. The functions [myHardwareSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m) and [myParadigmSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myParadigmSetup.m) need to be edited manually when building a new experiment. The functions [initOTBR](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m) and [stopExperiment](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/stopExperiment.m) should be called in each of your experiment scripts.
[[_TOC_]]
## myHardwareSetup
function: myHardwareSetup
function: [myHardwareSetup]((https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m))
**Description**
Used to set all basic parameters of the hardware in your setup. Needs to be stored on each experimental computer in the directory where your experiment is stored. Edit this function when building a new setup. Possible parameters for every section (1-11) are given in the script. Save changes to this script in order to use the same basic parameters consistently in every experimental design. Change this function when moving your paradigm from one experimental device to another. You do not need to call this function manually, it will be called by initOTBR internally!
Used to set all basic parameters of the hardware in your setup. Needs to be stored on each experimental computer in the directory where your experiment is stored. Edit this function when building a new setup. Possible parameters for every section (1-11) are given in the script. Save changes to this script in order to use the same basic parameters consistently in every experimental design. Change this function when moving your paradigm from one experimental device to another. You do not need to call this function manually, it will be called by [initOTBR](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m) internally!
## myParadigmSetup
function: myParadigmSetup
function: [myParadigmSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myParadigmSetup.m)
**Description**
Used to set all basic parameters of the software in your setup. Needs to be stored on each experimental computer in the directory where your experiment is stored. Edit this function when building a new setup. Possible parameters for every section (1-6) are given in the script. Save changes to this script in order to use the same basic parameters consistently in every experimental design. Change this function only when building a new paradigm. You do not need to call this function manually, it will be called by initOTBR internally!
Used to set all basic parameters of the software in your setup. Needs to be stored on each experimental computer in the directory where your experiment is stored. Edit this function when building a new setup. Possible parameters for every section (1-6) are given in the script. Save changes to this script in order to use the same basic parameters consistently in every experimental design. Change this function only when building a new paradigm. You do not need to call this function manually, it will be called by [initOTBR](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m) internally!
## initOTBR
function: initOTBR
function: [initOTBR](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m)
**Description**
Always the first function that has to be called. Used to initialize global variables and functions, as well as to check for specific entries, pathways and installations that are essential to the toolbox. Automatically calls the functions myHardwareSetup and myParadigmSetup to setup the toolbox that handles your specific hardware.
Always the first function that has to be called. Used to initialize global variables and functions, as well as to check for specific entries, pathways and installations that are essential to the toolbox. Automatically calls the functions [myHardwareSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m) and [myParadigmSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myParadigmSetup.m) to setup the toolbox that handles your specific hardware.
## startExperiment
function: startExperiment
function: [startExperiment](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/startExperiment.m)
**Description**
This helper function turns off all devices, clears the screen and turns on the house light. Turning on the house light requires a proper edited myHardwareSetup.m file. It's useful to call startExperiment after initialization to start with controlled conditions. Not a necessary function but helpful in animal experiments.
This helper function turns off all devices, clears the screen and turns on the house light. Turning on the house light requires a proper edited [myHardwareSetup.m]((https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m)) file. It's useful to call [startExperiment](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/startExperiment.m) after initialization to start with controlled conditions. Not a necessary function but helpful in animal experiments.
**Examples**
~~~
~~~matlab
1. startExperiment;
% Turns off all devices, clears the screen and turns on house light.
~~~
See also: feeding, punishment
**See also**
[feeding](/Device-interface#feeding-animal), [punishment](/Device-interface#punishment-animal)
## stopExperiment
function: stopExperiment
function: [stopExperiment](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/stopExperiment.m)
**Description**
This function closes the stimulus presentation window and takes care of all stimulus devices that are used (feeder, etc.). Always call this function at the end of your experiment.
see also: initOTBR, initWindow
**See also**
[initOTBR](/Initialization#initotbr), [initWindow](/Stimuli-Display#initwindow)
\ No newline at end of file