slaclab / pysmurf

Other
2 stars 9 forks source link

play_tes_bipolar_waveform holds information from last played waveform when you play a new one #446

Open jseibert575 opened 4 years ago

jseibert575 commented 4 years ago

When I play an arbitrary waveform using S.play_tes_bipolar_waveform (or some sinusoid using S.play_sine_tes), I get some strange behavior from the last played waveform as well. See plot below, which was a result of playing a sine wave of fixed frequency, stopping the waveform using S.stop_tes_bipolar_waveform, and then doubling the amplitude after waiting a short time. This happened repeatably, whether it was a sinusoid of differing frequency or differing amplitude, and for square waves as well.

I've also had issues using the continuous = False flag on S.play_tes_bipolar_waveform, and I wonder if that is related to this same problem.

image

image

image

swh76 commented 4 years ago

@jseibert575 for the first plot, did you double the amplitude, or the frequency? What's the third plot? Could you please paste recipe for reproducing? Also, what exactly are you looking at here - is this playing a sine on the bias of a superconducting TES while you read it out? If yes, what was the sample rate?

swh76 commented 4 years ago

FYI there is a known issue that you may also run into (which I don't think is what you're seeing, may be related) https://github.com/slaclab/pysmurf/issues/425.

jseibert575 commented 4 years ago

@swh76 The first plot is doubling the frequency and fixing amplitude, second plot is doubling amplitude and fixing frequency, I think I mixed up the order I pasted. The third plot is doubling the amplitude of a square wave.

jseibert575 commented 4 years ago

I have since deleted the code used to generate those plots, but this was the general idea. very basic: doubling frequency, fixing amp:


datfile = S.stream_data_on()
time.sleep(1)
S.play_sine_tes(1,0.004,10)
time.sleep(2)
S.stop_tes_bipolar_waveform(1)
time.sleep(1)
S.play_sine_tes(1,0.004,20)
time.sleep(2)
S.stop_tes_bipolar_waveform(1)
S.stream_data_off()
swh76 commented 4 years ago

@jseibert575 Mitch found one of the problems. I enable before loading the LUT tables, see here:

https://github.com/slaclab/pysmurf/blob/b21b5e0532c3b76bc979ce07a3cb2abac3182dfc/python/pysmurf/client/util/smurf_util.py#L4233

Will submit a PR to fix this soon.