diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/eit_with_vcsel.py | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/examples/eit_with_vcsel.py b/examples/eit_with_vcsel.py index f455c1a..e8d48eb 100644 --- a/examples/eit_with_vcsel.py +++ b/examples/eit_with_vcsel.py @@ -44,8 +44,9 @@ class BfieldDriver(KeysightE3612A): """ need to set power supply """ def __init__(self, *args, **kwds): super().__init__(*args, **kwds) - self.config['Device model'] = 'B field coil driver based on Keysight E3612A' - self.deviceProperties.add('B') + self.config['Device type'] = 'B field coil driver based on Keysight E3612A power supply' + self.config['Device model'] = 'v0.1' + self.deviceProperties.add({'B', 'Bslope_TperA', 'CoilAssignment'}) """" Rough magnetic field calibration of the 3 axes coils in large magnetic shield - Ch1: 70mA -> 650 kHz shift for delta m = 2 @@ -55,19 +56,26 @@ class BfieldDriver(KeysightE3612A): 20220601.magnetic_field_callibration/calibration_currentToB.dat """ # B response to current in a given channel - self.Bslope_TperA = { + self._Bslope_TperA = { 1: 0.0006574710928926532, 2: 0.0007064314754023079, 3: 0.0006635058865577695 } # assuming that Ch1 controls Bz, Ch2 -> By, Ch3 -> Bx - self.chX=3; self.chY=2; self.chZ=1 + self._coil_assignment = { 'chX': 3; 'chY': 2, 'chZ': 1 } + + def getBslope_TperA(self): + return self._Bslope_TperA + + def getCoilAssignment(self): + return self._coil_assignment def getB(self): - Bslope_TperA = self.Bslope_TperA - chX = self.chX - chY = self.chY - chZ = self.chZ + Bslope_TperA = self.getBslope_TperA() + coil_assignment = self.getCoilAssignment() + chX = coil_assignment['chX'] + chY = coil_assignment['chY'] + chZ = coil_assignment['chZ'] Ix = self.getChanIout(chX) Iy = self.getChanIout(chY) @@ -94,10 +102,11 @@ class BfieldDriver(KeysightE3612A): By = Bmag*np.sin(theta)*np.sin(phi) Bz = Bmag*np.cos(theta) - Bslope_TperA = self.Bslope_TperA - chX = self.chX - chY = self.chY - chZ = self.chZ + Bslope_TperA = self.getBslope_TperA() + coil_assignment = self.getCoilAssignment() + chX = coil_assignment['chX'] + chY = coil_assignment['chY'] + chZ = coil_assignment['chZ'] Ix = Bx / Bslope_TperA[chX] Iy = By / Bslope_TperA[chY] @@ -113,6 +122,7 @@ class BfieldDriver(KeysightE3612A): return Ix, Iy, Iz def setBinDegrees(self, Bmag=50e-6, theta=0, phi=0): + logger.info(f'Setting {Bmag=}, {theta=} {phi=} in degrees') return self.setB(Bmag=Bmag, theta=theta/180*np.pi, phi=phi/180*np.pi) # TSDB logger setting @@ -216,6 +226,13 @@ def calibrateCoilsCurrent(): getCurrentCalibrationData(ch=2) getCurrentCalibrationData(ch=3) +def setBandTakeTrace(Bmag=50e-6, theta=0, phi=0, central_frequency=6.83468e9, frequency_span=2500e3, Np=100, Nsweeps=1): + """ theta and phi assumed to be in degrees """ + Bfield.setBinDegrees(Bmag=Bmag, theta=theta, phi=phi) + trEIT = eitSweep(central_frequency, frequency_span, Np, Nsweeps=Nsweeps) + return trEIT + + def rotateBandGetEITtrace(): Np=1000 Nsweeps=5 |