labscript-suite / labscript-devices

A modular and extensible plugin architecture to control experiment hardware using the 𝘭𝘒𝘣𝘴𝘀𝘳π˜ͺ𝘱𝘡 𝘴𝘢π˜ͺ𝘡𝘦.
http://labscriptsuite.org
Other
5 stars 58 forks source link

Pulseblaster flags being stored as unicode string instead of int? #26

Closed philipstarkey closed 6 years ago

philipstarkey commented 6 years ago

Original report (archived issue) by Shaun Johnstone (Bitbucket: shjohnst, GitHub: shjohnst).


Having just updated to the latest version of everything (after a long time on an older version), I get the following error whenever pulseblasters are programmed:

#!python

2018-07-31 14:41:42,987 ERROR BLACS.pulseblaster_1_main_worker.worker: Exception in job:
Traceback (most recent call last):
  File "C:\labscript_suite\labscript_devices\PulseBlaster.py", line 861, in program_manual
    pb_inst_dds2(0,0,0,values['dds 0']['gate'],0,0,0,0,values['dds 1']['gate'],0,flags, WAIT, 0, 100)
  File "C:\Anaconda2\lib\site-packages\spinapi\spinapi.py", line 216, in pb_inst_dds2
    ctypes.c_int(flags),ctypes.c_int(inst),
TypeError: an integer is required

It seems as though "flags" is stored as unicode rather than an integer. Adding in a line to convert it to an int resolves this issue. Is there a reason why the flags are stored this way? Or am I just on an old version of SpinAPI (3.1.1)? I assume that someone has tested the pulseblaster since the Python 3 conversion?

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Not sure why we store them as strings, but we do. The problem is that they were previously bytestrings but are now unicode strings, and spinapi only became more accepting of string types for the bitfields in 3.2.0. Testing must have been done with an updated spinapi, and we forgot to add a version check. I'll add a version check to PulseBlaster.py.

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Should be fixed by pull request #45

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Merged in cbillington/labscript_devices/Python3_PulseBlasters (pull request #45)

Resolve issue #26

Approved-by: Shaun Johnstone shaun.johnstone@gmail.com

β†’ \<\<cset 3a021e8bde3a46b6ef40596999172a6b9f582332>>

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Merged in cbillington/labscript_devices/Python3_PulseBlasters (pull request #45)

Resolve issue #26

Approved-by: Shaun Johnstone shaun.johnstone@gmail.com

β†’ \<\<cset 3a021e8bde3a46b6ef40596999172a6b9f582332>>