diff options
Diffstat (limited to 'examples/lock_eit.py')
-rw-r--r-- | examples/lock_eit.py | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 90732d8..0cdd86f 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -10,21 +10,37 @@ from qolab.feedback import PID from qolab.data import TraceSetSameX, TraceXY, Trace def adjustRF(pid, scope, rfgen): + pid.reset() + errorTrace = Trace("error") errorTrace.config['unit']='V' timeTrace = Trace("time") timeTrace.config['unit']='S' - errorLog = TraceXY("error") errorLog.x = timeTrace errorLog.y = errorTrace + freqTrace = Trace("frequency") + freqTrace.config['unit']='Hz' + freqLog = TraceXY("frequency") + freqLog.x = timeTrace + freqLog.y = freqTrace + + feedbackTrace = Trace("feedback") + feedbackTrace.config['unit']='Hz' + feedbackLog = TraceXY("feedback") + feedbackLog.x = timeTrace + feedbackLog.y = feedbackTrace + + log = TraceSetSameX("timelog") log.addTrace(errorLog) + log.addTrace(freqLog) + log.addTrace(feedbackLog) # while True: - for i in range(0,100): + for i in range(0,10000): timenow = time.time() ch1=scope.getTrace(1, decimate=False) @@ -38,10 +54,12 @@ def adjustRF(pid, scope, rfgen): log.addPointToTrace(timenow) log.addPointToTrace(err, "error") - plt.clf() - log.plot() - time.sleep(.01) + log.addPointToTrace(freq0, "frequency") + log.addPointToTrace(fdbck, "feedback") + # time.sleep(.01) + plt.clf() + log.plot() return log @@ -70,6 +88,9 @@ if __name__ == '__main__': pid = PID(100,400,0, sign=-1) log=adjustRF(pid, scope, rfgen) + log.save('lock.dat', item_format='.15e') + + |