Commit 631ea875 authored by Yb Tweezer's avatar Yb Tweezer
Browse files

switch to TimeBase driver and play with CMOT power

parent db017a1c
......@@ -76,8 +76,8 @@ shim_ud = +0.580 # up/down shim; 174: 0.4
# CMOT AOM settings
f_freqpow = 90.0 # start of frequency ramp; MHz
p_freqpow_beg = 29.0 # start of power ramp; dBm
p_freqpow_end = 0.0 # end of ramp; dBm
p_image = 23.0 # power for imaging; dBm
p_freqpow_end = -11.0 # end of ramp; dBm
p_image = 27.0 # power for imaging; dBm
p_image_cmot = 20.0 # power for imaging with CMOT beams; dBm
# PARAMETERS
......@@ -96,18 +96,27 @@ T_COMP = t0 + tau_comp + np.linspace(0.0, tau_comp_dur, 101) # compression ramp
B_COMP = np.linspace(B_green, B_green * 1.8, T_COMP.shape[0]) # compression ramp coil vals; s
bits_Bset = int(20) # number of bits to send in a servo setting
bits_DACset = int(4) # number of bits to send in a DAC-mode setting
det_block = 10.0 # shift the RF on the MOT beams to decouple the fiber; MHz
f_image0 = aom_fiber_optim + det_image0 # (nominal) CMOT final AOM frequency; MHz
mogramp_N = 1000 # number of steps in the frequency/power ramp
ramp_N = 1000 # number of steps in the frequency/power ramp
dailies_config = dict(
probe_image = probe_image,
CMOT_freq = f_image0,
CMOT_pow = p_freqpow_end,
)
def make_sequences(meas_type: DailyMeasType, name: str,
tau_tof: float, det_image: float, nu_freqpow: float) \
-> (SuperSequence, MOGTable):
def make_sequence(
meas_type: DailyMeasType,
name: str,
tau_tof: float,
det_image: float,
nu_freqpow: float,
) -> SuperSequence:
# ramp_N is the number of steps, not points, so use ramp_N + 1 for number of points
RAMP_T = t0 + np.linspace(tau_freqpow, tau_freqpow + tau_freqpow_dur, ramp_N + 1)
RAMP_F = np.linspace(f_freqpow, f_freqpow + nu_freqpow, ramp_N + 1)
RAMP_P = np.linspace(p_freqpow_beg, p_freqpow_end, ramp_N + 1)
if meas_type in {
DailyMeasType.TOF,
DailyMeasType.DET,
......@@ -135,16 +144,32 @@ def make_sequences(meas_type: DailyMeasType, name: str,
).to_sequence().with_color("C0"),
"Load green MOT": (Sequence()
+ Sequence.digital_hilo(
*C.mot3_green_aom,
t0 - 5e-3, # the mogtable is triggered on a falling edge
t0
)
+ Sequence([
Event.digital1(
**C.mot3_green_sh, s=1)
@ (t0 - 5e-3) # open shutter ahead of AOM
+ Sequence([ # turn on AOM to the right frequency/power
Event.digital1(**C.mot3_green_aom, s=0) # LOW == ON
@ (t0),
Event.digital1(**C.mot3_green_sh, s=1)
@ (t0 - 3.8e-3), # shutter delay
Event.analog(
**C.mot3_green_aom_fm,
s=MOT3_GREEN_AOM_FM(RAMP_F[0])
) @ (t0),
Event.analog(
**C.mot3_green_aom_am,
s=MOT3_GREEN_AOM_AM(RAMP_P[0])
) @ (t0),
])
+ Sequence(
[ # do the frequency ramp
Event.analog(**C.mot3_green_aom_fm, s=MOT3_GREEN_AOM_FM(f))
@ (t)
for t, f in zip(RAMP_T, RAMP_F)
]
+ [ # do the power ramp
Event.analog(**C.mot3_green_aom_am, s=MOT3_GREEN_AOM_AM(p))
@ (t)
for t, p in zip(RAMP_T, RAMP_P)
]
)
+ Sequence.serial_bits_c(
C.mot3_coils_sig,
t0,
......@@ -184,6 +209,13 @@ def make_sequences(meas_type: DailyMeasType, name: str,
])).with_color("C1"),
"Free space": (Sequence()
+ Sequence([ # detune and depower the MOT beams for TOF after the CMOT hold
Event.analog(
**C.mot3_green_aom_fm, s=MOT3_GREEN_AOM_FM(89.0)
) @ (t0 + tau_ncool),
Event.analog(**C.mot3_green_aom_am, s=-1) # s=-1 guarantees minimum power
@ (t0 + tau_ncool)
])
+ Sequence.serial_bits_c(
C.mot3_coils_sig,
t0 + tau_ncool,
......@@ -216,6 +248,39 @@ def make_sequences(meas_type: DailyMeasType, name: str,
)
) if probe_image else Sequence()
)
+ (
(
Sequence.digital_pulse(
*C.mot3_green_aom,
t0 + tau_ncool + tau_tof,
tau_image,
invert=True
)
+ Sequence.digital_pulse(
*C.mot3_green_sh,
0.0,
t0 + tau_all
)
+ Sequence([
Event.analog(
**C.mot3_green_aom_fm,
s=MOT3_GREEN_AOM_FM(aom_fiber_optim + det_image)
) @ (t0 + tau_ncool + tau_tof),
Event.analog(
**C.mot3_green_aom_am,
s=MOT3_GREEN_AOM_AM(p_image_cmot)
) @ (t0 + tau_ncool + tau_tof),
])
+ Sequence([
Event.analog(
**C.mot3_green_aom_fm,
s=MOT3_GREEN_AOM_FM(89.0)
) @ (t0 + tau_ncool + tau_tof + tau_image),
Event.analog(**C.mot3_green_aom_am, s=-1) # s=-1 guarantees minimum power
@ (t0 + tau_ncool + tau_tof + tau_image)
])
) if not probe_image else Sequence()
)
+ (
Sequence.digital_pulse(
*C.flir_trig,
......@@ -357,27 +422,7 @@ def make_sequences(meas_type: DailyMeasType, name: str,
)
sseq["Sequence"] = Sequence.digital_hilo(*C.dummy, 0.0, sseq.max_time() + 10e-3).with_color("0.25")
# mogramp_N is the number of steps, not points, so use mogramp_N + 1 for number of points
MOGRAMP_T = np.linspace(tau_freqpow, tau_freqpow + tau_freqpow_dur, mogramp_N + 1)
MOGRAMP_F = np.linspace(f_freqpow, f_freqpow + nu_freqpow, mogramp_N + 1)
MOGRAMP_P = np.linspace(p_freqpow_beg, p_freqpow_end, mogramp_N + 1)
tab = MOGTable()
# make sure the frequency/power is right at t0
tab << MOGEvent(frequency=MOGRAMP_F[0], power=MOGRAMP_P[0]) @ (0.0)
for t, f, p in zip(MOGRAMP_T, MOGRAMP_F, MOGRAMP_P):
tab << MOGEvent(frequency=f, power=p) @ t
# detune and depower the MOT beams for TOF after the CMOT hold
tab << MOGEvent(frequency=MOGRAMP_F[-1] + det_block, power=-50.0) \
@ (tau_ncool + 1.7e-3) # unknown source of timing errors
if not probe_image:
(tab
<< MOGEvent(frequency=aom_fiber_optim + det_image, power=p_image_cmot)
@ (tau_ncool + tau_tof + 1.7e-3) # unknown source of timing errors
<< MOGEvent(frequency=aom_fiber_optim + det_image + det_block, power=-50.0)
@ (tau_ncool + tau_tof + tau_image + 1.7e-3) # unknown source of timing errors
)
return sseq, tab
return sseq
## SCRIPT CONTROLLER
class DailyMeasurement(Controller):
......@@ -390,8 +435,6 @@ class DailyMeasurement(Controller):
# self.cam = FLIR.connect()
# self.cam.configure_capture(**flir_config).configure_trigger()
self.mog = MOGRF.connect()
self.tb = TIMEBASE.connect()
if probe_image:
self.tb.set_frequency(aom_fiber_optim + det_image0).set_amplitude(p_image)
......@@ -408,18 +451,17 @@ class DailyMeasurement(Controller):
f"_{rep}"
for rep, tau_tof in product(range(reps), TAU_TOF)
]
self.ssequences, self.mogtables \
= zip(*[
make_sequences(
self.mode,
f"tau_tof={tau_tof:.5f}"
f"_det-image={det_image0:+.5f}"
f"_nu-freqpow={nu_freqpow0:+.5f}",
tau_tof,
det_image0,
nu_freqpow0,
) for tau_tof in TAU_TOF
])
self.ssequences = [
make_sequence(
self.mode,
f"tau_tof={tau_tof:.5f}"
f"_det-image={det_image0:+.5f}"
f"_nu-freqpow={nu_freqpow0:+.5f}",
tau_tof,
det_image0,
nu_freqpow0,
) for tau_tof in TAU_TOF
]
self.sequences = [sseq.to_sequence() for sseq in self.ssequences]
elif self.mode == DailyMeasType.DET:
......@@ -431,18 +473,17 @@ class DailyMeasurement(Controller):
f"_{rep}"
for rep, det_image in product(range(reps), DET_IMAGE)
]
self.ssequences, self.mogtables \
= zip(*[
make_sequences(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image:+.5f}"
f"_nu-freqpow={nu_freqpow0:+.5f}",
tau_tof0,
det_image,
nu_freqpow0,
) for det_image in DET_IMAGE
])
self.ssequences = [
make_sequence(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image:+.5f}"
f"_nu-freqpow={nu_freqpow0:+.5f}",
tau_tof0,
det_image,
nu_freqpow0,
) for det_image in DET_IMAGE
]
self.sequences = [sseq.to_sequence() for sseq in self.ssequences]
elif self.mode == DailyMeasType.CMOT_DET:
......@@ -454,18 +495,17 @@ class DailyMeasurement(Controller):
f"_{rep}"
for rep, nu_freqpow in product(range(reps), NU_FREQPOW)
]
self.ssequences, self.mogtables \
= zip(*[
make_sequences(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image0:+.5f}"
f"_nu-freqpow={nu_freqpow:+.5f}",
tau_tof0,
det_image0,
nu_freqpow,
) for nu_freqpow in NU_FREQPOW
])
self.ssequences = [
make_sequence(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image0:+.5f}"
f"_nu-freqpow={nu_freqpow:+.5f}",
tau_tof0,
det_image0,
nu_freqpow,
) for nu_freqpow in NU_FREQPOW
]
self.sequences = [sseq.to_sequence() for sseq in self.ssequences]
elif self.mode == DailyMeasType.BMOT_NUM:
......@@ -476,17 +516,16 @@ class DailyMeasurement(Controller):
f"_{rep}"
for rep in range(reps)
]
self.ssequences, self.mogtables \
= zip(*[
make_sequences(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image0:+.5f}",
tau_tof0,
det_image0,
nu_freqpow0
)
])
self.ssequences = [
make_sequence(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image0:+.5f}",
tau_tof0,
det_image0,
nu_freqpow0
)
]
self.sequences = [sseq.to_sequence() for sseq in self.ssequences]
elif self.mode == DailyMeasType.BMOT_DET:
......@@ -497,17 +536,16 @@ class DailyMeasurement(Controller):
f"_{rep}"
for rep, det_image in product(range(reps), DET_IMAGE)
]
self.ssequences, self.mogtables \
= zip(*[
make_sequences(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image:+.5f}",
tau_tof0,
det_image,
nu_freqpow0,
) for det_image in DET_IMAGE
])
self.ssequences = [
make_sequence(
self.mode,
f"tau-tof={tau_tof0:.5f}"
f"_det-image={det_image:+.5f}",
tau_tof0,
det_image,
nu_freqpow0,
) for det_image in DET_IMAGE
]
self.sequences = [sseq.to_sequence() for sseq in self.ssequences]
else:
......@@ -515,18 +553,10 @@ class DailyMeasurement(Controller):
def run_sequence(self, *args):
for rep in range(reps):
for k, (seq, tab) in enumerate(zip(self.sequences, self.mogtables)):
for k, seq in enumerate(self.sequences):
if self.mode in {DailyMeasType.DET, DailyMeasType.BMOT_DET}:
self.tb.set_frequency(aom_fiber_optim + DET_IMAGE[k])
(self.mog
.set_frequency(1, 90.0).set_power(1, -50.0) # make sure CMOT AOM is off
.set_mode(1, "TSB")
.table_load(1, tab)
.table_arm(1)
.set_table_rearm(1, True)
)
self.comp.enqueue(seq).run().clear()
self.mog.table_stop(1).table_clear(1)
if take_background:
time.sleep(0.5)
......@@ -546,17 +576,6 @@ class DailyMeasurement(Controller):
self.comp.clear().set_defaults().disconnect()
(self.mog
.table_stop(1)
.table_clear(1)
.set_frequency(1, 90.0).set_power(1, 29.04)
.set_frequency(3, aom_fiber_optim + det_image0).set_power(3, p_image)
.set_frequency(4, aom_fiber_optim + det_image0).set_power(4, p_image)
.set_mode(1, "NSB")
.set_output(1, True)
.disconnect()
)
# def run_camera(self, *args):
# self.frames = self.cam.acquire_frames(
# num_frames=(
......@@ -604,21 +623,6 @@ class DailyMeasurement(Controller):
# print(f"couldn't disconnect from Flir camera"
# f"\n{type(err).__name__}: {err}")
try:
(self.mog
.table_stop(1)
.table_clear(1)
.set_frequency(1, 90.0).set_power(1, 29.04)
.set_frequency(3, aom_fiber_optim + det_image0).set_power(3, p_image)
.set_frequency(4, aom_fiber_optim + det_image0).set_power(4, p_image)
.set_mode(1, "NSB")
.set_output(1, True)
.disconnect()
)
except BaseException as err:
print(f"couldn't reset MOGRF"
f"\n{type(err).__name__}: {err}")
def postcmd(self, *args):
pass
# names = list()
......@@ -689,27 +693,20 @@ class DailyMeasurement(Controller):
sys.exit(0)
self.mode = run_modes[args[0]]
if self.mode == DailyMeasType.TOF:
sseq, tab = make_sequences(self.mode, "", TAU_TOF.max(), det_image0, nu_freqpow0)
sseq = make_sequence(self.mode, "", TAU_TOF.max(), det_image0, nu_freqpow0)
elif self.mode == DailyMeasType.DET:
sseq, tab = make_sequences(self.mode, "", tau_tof0, DET_IMAGE.max(), nu_freqpow0)
sseq = make_sequence(self.mode, "", tau_tof0, DET_IMAGE.max(), nu_freqpow0)
elif self.mode == DailyMeasType.CMOT_DET:
sseq, tab = make_sequences(self.mode, "", tau_tof0, det_image0, NU_FREQPOW.max())
sseq = make_sequence(self.mode, "", tau_tof0, det_image0, NU_FREQPOW.max())
elif self.mode == DailyMeasType.BMOT_NUM:
sseq, tab = make_sequences(self.mode, "", tau_tof0, det_image0, nu_freqpow0)
sseq = make_sequence(self.mode, "", tau_tof0, det_image0, nu_freqpow0)
elif self.mode == DailyMeasType.BMOT_DET:
sseq, tab = make_sequences(self.mode, "", tau_tof0, DET_IMAGE.max(), nu_freqpow0)
sseq = make_sequence(self.mode, "", tau_tof0, DET_IMAGE.max(), nu_freqpow0)
try:
tmin, tmax = float(args[1]), float(args[2])
except IndexError:
tmin, tmax = sseq.min_time(), sseq.max_time()
sseq.draw_detailed(
mogtables=[
( tab.with_color("C6"), dict(name="Green MOT AOM", offset=t0) ),
] if self.mode not in {
DailyMeasType.BMOT_NUM,
DailyMeasType.BMOT_DET,
} else list()
).set_xlim(tmin, tmax).show()
sseq.draw_detailed().set_xlim(tmin, tmax).show()
sys.exit(0)
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment