pymeasure icon indicating copy to clipboard operation
pymeasure copied to clipboard

Commit 9bd6e08 breaks `download_image` method of Teledyne LeCroy T3DSO1204 oscilloscope

Open LastStarDust opened this issue 2 years ago • 3 comments

Hello! I am the contributor for the following instruments:

  • Teledyne LeCroy T3DSO1204 oscilloscope
  • Texio PSW family power supply

A colleague of mine noticed that with the latest version of pymeasure v0.12.0, he cannot download the images from T3DSO1204 oscilloscope.

I confirmed that, on the master branch, the download_image method is never returning, i.e. it is blocking indefinitely, while on the branch of the original PR, it is working properly.

By using git bisect I found out that this commit breaks the download_image method.

The commit message is VISAAdapter's read_bytes(-1) reads until timeout. and it makes sense because this issue is timeout related.

LastStarDust avatar Aug 20 '23 03:08 LastStarDust

ping @bmoneke this came from #867. do you know how to best fix this? @LastStarDust do you have any logging that shows any (communication) differences between old and broken versions?

bilderbuchi avatar Sep 02 '23 15:09 bilderbuchi

I'll have a look.

BenediktBurger avatar Sep 05 '23 07:09 BenediktBurger

I looked at the code and the difference is, how we define read_bytes(-1). Previously we used read_raw to read until some (pyvisa defined) end, for example up to newline character if no term char was given.

I suspect two possibilities: Either the timeout is too long (and never encountered) as we read now until a timeout occurs, or the previous implementation expected implicitly a termchar as due to a pyvisa bug (https://github.com/pyvisa/pyvisa/issues/728) a newline char was assumed as termchar. You could try to set a different timeout (a short time) and check, whether that stops the reading at some point. Or even more basic, try to read, whatever the osci sends (read_bytes(1) in a loop until timeout).

btw @LastStarDust, why did you hardcode the adapter timeout:

if self.adapter.connection is not None:
    self.adapter.connection.timeout = 3000

instead of giving a normal kwarg init?

BenediktBurger avatar Sep 05 '23 14:09 BenediktBurger