Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Http protocol for adding shots to lyse #94

Open
ldes89150 opened this issue Jul 21, 2021 · 1 comment
Open

[Question] Http protocol for adding shots to lyse #94

ldes89150 opened this issue Jul 21, 2021 · 1 comment

Comments

@ldes89150
Copy link

Hi,

In our lab, we use control systems forked from Sandia National Lab https://github.com/QITI/IonControl and ARTIQ.

I am thinking of adding the capability of sending shots to lyse from our control systems.

Can you point me to some documents about the http protocol for communicating lyse?

Thanks!

@chrisjbillington
Copy link
Member

chrisjbillington commented Jul 21, 2021

Hi @ldes89150,

The protocol isn't HTTP - lyse is listening on a zeromq REP socket. It expects a client REQ socket to connect to it and send a dictionary that has been serialised using python's pickle module, in the format:

{"filepath": <path of a shot file>}

Where the dictionary's value is a filepath to a shot file on disk.

If you want to submit shots to it from another control system, you'll need to have some code store the shot's data into a HDF5 file in the same format the rest of the labscript suite uses to store data - this varies depending on what kind of data, but we can talk more about that if you're not familiar.

So long as your code is in Python and you have the labscript suite installed, the easiest way to send a shot to lyse (provided you've already got a shot file) would be the following Python code using wrapper functions.

from labscript_utils.labconfig import LabConfig
from labscript_utils.ls_zprocess import zmq_get
from labscript_utils.shared_drive import path_to_agnostic

port = LabConfig().get('ports', 'lyse')
hostname = 'localhost' # computer running lyse
shot_file = "path/to/some/shot_file.h5"

zmq_get(port, hostname, {"filename": path_to_agnostic(shot_file)})

The path_to_agnostic is so that you can pass a filepath that is on a shared drive, between computers that might have different drive letters for the shared drive (if you have configured labscript to use a shared drive in this way).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants