Connecting Python to Zapit

Installation and basic use of the Zapit Python bridge

Zapit's Python Bridge uses the MATLAB Engine to call Zapit from Python. The MATLAB GUI is used for calibrating the scanners and the sample. After this point all subsequent operations for which you might have used the MATLAB API can be done in Python. Zapit must remain running in MATLAB throughout.

Setting up

  1. Close Zapit if open.

  2. Edit your zapitSystemSettings.yml file, setting general.openPythonBridgeOnStart to 1.

  3. Restart Zapit. You should see the message "Opened Python Bridge" at the command line.

Now install the Python Bridge:

pip install zapit-Python-Bridge

Test the bridge

Open a stim config file in Zapit and open an ipython session. Test the connection by querying the number of stimulus conditions in the loaded stimulus config file.

import zapit_python_bridge.bridge as zpb
hZP = zpb.bridge()
hZP.num_stim_cond()

Last updated