From c25ee7e20279e2394186c3f7af3fd11f4e187c30 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 5 Apr 2022 23:44:00 -0400 Subject: added progress bars --- examples/eit_with_vcsel.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/eit_with_vcsel.py b/examples/eit_with_vcsel.py index b852f42..775f2e6 100644 --- a/examples/eit_with_vcsel.py +++ b/examples/eit_with_vcsel.py @@ -2,6 +2,7 @@ import pyvisa import numpy as np import platform import time +from tqdm import tqdm as pbar from qolab.data import TraceSetSameX, TraceXY, Trace @@ -32,7 +33,7 @@ ps.setChanIout(2, 0.070173) ps.setChanIout(3, 0.01057) print('Done setting magnetic field coils currents') -def eitSweep(central_frequency, frequency_span, Np): +def eitSweep(central_frequency, frequency_span, Np, Nsweeps=1): frList = np.linspace(central_frequency-frequency_span/2, central_frequency+frequency_span/2, Np) trFreq=Trace('Frequency') trFreq.config['unit']='Hz' @@ -43,16 +44,16 @@ def eitSweep(central_frequency, frequency_span, Np): trEIT = TraceSetSameX('EIT') - for fr in frList: - print(fr) - rfgen.setFreqFixed(fr) - time.sleep(dwellTime) - transmission = daq.getAIN(0) - lockin = daq.getAIN(1) + for sw in pbar(range(1,Nsweeps+1), desc="Sweep"): + for fr in pbar(frList, desc="Freq Scan"): + rfgen.setFreqFixed(fr) + time.sleep(dwellTime) + transmission = daq.getAIN(0) + lockin = daq.getAIN(1) - trFreq.addPoint(fr) - trTransmission.addPoint(transmission) - trLockin.addPoint(lockin) + trFreq.addPoint(fr) + trTransmission.addPoint(transmission) + trLockin.addPoint(lockin) trFreq.values = trFreq.values - central_frequency trEIT.addTraceX(trFreq) -- cgit v1.2.3