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

Scope binary parsing problem #356

Open
brooksfoxen opened this issue Jul 5, 2016 · 3 comments
Open

Scope binary parsing problem #356

brooksfoxen opened this issue Jul 5, 2016 · 3 comments

Comments

@brooksfoxen
Copy link
Contributor

brooksfoxen commented Jul 5, 2016

I finally tracked my scope issue down to bad parsing of the binary waveform data. There is a function 'query_binary_values" built in to the VISA driver that queries data and parses it correctly.

I've added this function call to the gpib_server.py file and I have successfully tested this fix with the scope accessing this function directly through the gpib_bus:
'''
cxn = labrad.connect()
scope = cxn.collateral_gpib_bus
scope.address(scope.list_devices()[-1])
scope.query_binary_values(':WAVeform:SOURce CHANnel4;DATA?', "h", True)
'''

However, when I went to implement this query in the agilent_infiniium_scope server, it doesn't seem to know about the new query_binary_values function. Is there some other class definition or something I need to update to add this query_binary_values function to the agilent_infiniium_scope server?

@maffoo

@brooksfoxen
Copy link
Contributor Author

I think I found what I need to change in pylabrad @thchwhite helped me out. I'm going to do that and I'll submit pull requests when I get it working.

@brooksfoxen
Copy link
Contributor Author

@maffoo
Copy link
Contributor

maffoo commented Jul 6, 2016

We tracked this down to the fact that the gpib server tries to strip trailing termination characters like \r and \n (https://github.com/martinisgroup/servers/blob/master/gpib_server.py#L183). This does not work if trying to read binary data, since trailing bytes that just happen to correspond to these termination characters can be dropped. I think the solution to this is to add a separate read_raw setting to be used for reading raw bytes, versus the read setting that reads string responses. This mirrors the underlying pyvisa interface as well (https://github.com/hgrecco/pyvisa/blob/master/pyvisa/resources/messagebased.py#L288).

Note also labrad/pylabrad#268 which describes a way to hopefully make it easier to fix problems in the gpib system by keeping the bus and device manager servers close to the gpib device server code.

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