diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/lock_eit.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 29cc7ea..0fa2c43 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -10,7 +10,7 @@ from qolab.hardware.rf_generator import AgilentE8257D from qolab.feedback import PID from qolab.data import TraceSetSameX, TraceXY, Trace -def adjustRF(pid, scope, rfgen): +def adjustRF(pid, scope, rfgen, nsteps=1000, fname=None): pid.reset() errorTrace = Trace("error") @@ -41,7 +41,7 @@ def adjustRF(pid, scope, rfgen): # while True: - for i in range(0,10): + for i in range(0,nsteps): timenow = time.time() ch1=scope.getTrace(1, decimate=False) @@ -57,7 +57,9 @@ def adjustRF(pid, scope, rfgen): log.addPointToTrace(err, "error") log.addPointToTrace(freq0, "frequency") log.addPointToTrace(fdbck, "feedback") - # time.sleep(.01) + + if fname is not None: + log.save(fname, item_format='.15e') plt.clf() log.plot() @@ -93,9 +95,15 @@ if __name__ == '__main__': rfgen.setFreqFixed(freqDeltaM2+100) pid = PID(100,400,0, sign=-1) - log=adjustRF(pid, scope, rfgen) + # initial lock + log=adjustRF(pid, scope, rfgen, nsteps=100) + + # long term lock fname = apparatus.getNextDataFile() + print(fname) + log=adjustRF(pid, scope, rfgen, nsteps=10000, fname=fname) + log.save(fname, item_format='.15e') |