aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-14 12:27:37 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-14 12:27:37 -0500
commit96a36de6beb38e506915ee15dd2b647d021fb86b (patch)
tree2c08ea8c1a109bb731b67f1d98e631caae875bc3 /examples
parent012df28894710c36bc24623fd48f93b45b6a0611 (diff)
downloadqolab-96a36de6beb38e506915ee15dd2b647d021fb86b.tar.gz
qolab-96a36de6beb38e506915ee15dd2b647d021fb86b.zip
improved datasaving
Diffstat (limited to 'examples')
-rw-r--r--examples/lock_eit.py16
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')