Zapit Optostim
  • Zapit Optostim: Introduction
    • Feature List
    • FAQ
  • Installation and Setup
    • Hardware setup
    • Software setup
    • Configuring Zapit
      • General settings
      • NI DAQ settings
      • Experiment settings
      • Scanner & Camera settings
      • Laser Power Calibration
      • Blanking settings
    • Staying up to date
  • Using the GUI
    • Introduction: Using the GUI
    • Scanner Calibration
    • Sample Calibration
    • StimConfig Editor
    • Generating stimulus patterns at the CLI
    • Advanced Usage
  • Running Experiments
    • Introduction: Running Experiments
    • MATLAB
      • Basic API Usage in MATLAB
      • Running an Experiment in MATLAB
    • Python
      • Connecting Python to Zapit
      • Basic Zapit API Use in Python
    • Remote Control and Other Programming Languages
  • Developer Notes
    • Project Structure
    • Conventions
    • Hints and Tips
Powered by GitBook
On this page
  1. Running Experiments
  2. Python

Connecting Python to Zapit

Installation and basic use of the Zapit Python bridge

PreviousPythonNextBasic Zapit API Use in Python

Last updated 1 year ago

Zapit's uses the 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()

Python Bridge
MATLAB Engine