Skip to main content

zapit-Python-Bridge

Interface for controlling a running Zapit MATLAB instance from Python. The scanner and sample calibration are performed in MATLAB. The rest of the operations can be performed via Python.

Installing

pip install zapit-Python-Bridge

Example

Then in iPython:

import zapit_python_bridge.bridge as zpb
from importlib import reload

# Create an instance of the bridge object
hZP = zpb.bridge()

# Interact
hZP.send_samples()
hZP.stop_opto_stim


hZP.send_samples(conditionNum=2,laserOn=0)
hZP.stop_opto_stim()

If you need to reload the module for development purposes, you must first delete the running class instance or it will hang when it next tries to connect:

In [1]: hZP.release_matlab()
Disconnecting from MATLAB

In [2]: reload(zpb)
Out[2]: <module 'zapit_python_bridge.bridge' from 'D:zapit-python-bridge\\zapit_python_bridge\\bridge.py'>

In [3]: hZP = zpb.bridge()
Attempting MATLAB connection...
Connected!

Minimal example for running an exeperiment

See examples directory

python minimal_experiment_example.py

Connecting to the zapit session: minimal example

In MATLAB:

 >> matlab.engine.shareEngine('zapit')

In iPython:

import matlab.engine
eng = matlab.engine.connect_matlab('zapit')

Make sure you have set up and calibrated everything in Zapit. Now in Python you can do:

hZP = eng.workspace['hZP']
hZPview = eng.workspace['hZPview']
eng.eval('hZP.stimConfig.plotChanSamples(2)',nargout=0)

# OR
SC = eng.subsref(hZP, {'type':'.','subs':'stimConfig'})
eng.plotChanSamples(SC, 1, nargout=0)


eng.sendSamples(hZP,  nargout=0)
eng.stopOptoStim(hZP,  nargout=0)

Metadata

Release files for zapit-Python-Bridge 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zapit-Python-Bridge 0.1.3
File Size Uploaded Provenance Actions
zapit-Python-Bridge-0.1.3.tar.gz 7.7 kB Without provenance Details for zapit-Python-Bridge-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zapit-Python-Bridge 0.1.3
File Interpreter ABI Platform Actions
zapit_Python_Bridge-0.1.3-py3-none-any.whl Python 3 none any Details for zapit_Python_Bridge-0.1.3-py3-none-any.whl

Total release size: 12.8 kB

Release files / zapit-Python-Bridge-0.1.3.tar.gz

Download URL zapit-Python-Bridge-0.1.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5b750b41dde0ad875968ce8a11ada503d8bacf810cf55b8e533761ece2c8253f
BLAKE2b-256 checksum
How to use checksums
fada2a9a0dbede0e760c78a563d95ba9526b508403f1b5586511c928310fbdda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / zapit_Python_Bridge-0.1.3-py3-none-any.whl

Download URL zapit_Python_Bridge-0.1.3-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bac30c913d4662e3181a238625d3750a46862d2c108a50c486ae8ea8f53e2ed1
BLAKE2b-256 checksum
How to use checksums
4e2e0ddeb132587dd9ea79f1465c8329b3ac139ba4f9e2eaa3fd9cfd0980db85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for zapit-Python-Bridge 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page