Commit a51dc512 authored by Yb Tweezer's avatar Yb Tweezer
Browse files

parameter adjustment and add tau_pause between tau_ncool and tau_twzr_load

parent c6f6ecda
......@@ -35,20 +35,20 @@ camera_config = {
## MAIN SEQUENCE PARAMETERS
# general
reps = 50 # repeat shots for statistics
reps = 500 # repeat shots for statistics
clk_freq = 10e6 # serial_bits clock frequency; Hz
take_background = False # include a background image
flir_two_shots = False # use the Flir to take two shots
check_556_tweezer = False # use the 556 tweezer instead of the probe beams
# timings (not to scale)
# | tau_all |
# start | t0 | tau_ncool | tau_twzr_load | tau_hold | tau_pp | tau_dark | tau_probe | end
# | | |
# <tau_comp> | |
# | <tau_flir> |
# | | <tau_andor>
# | t_ramp | tau_ramp |
# | tau_all |
# start | t0 | tau_ncool | tau_pause | tau_twzr_load | tau_hold | tau_pp | tau_dark | tau_probe | end
# | | | |
# <tau_comp> | | |
# | | <tau_flir>,<tau_flir_second> |
# | | <tau_andor>
# | t_ramp | tau_ramp | ... |
# |
# <tau_ref>
t0 = 300e-3 # transfer to green MOT; s
......@@ -57,28 +57,31 @@ tau_blue_overlap = 2e-3 # overlap time of blue beams with green beams relative t
tau_ncool = 100e-3 # narrow cooling/compression time; s
tau_comp = 46e-3 # start compression ramping relative to beginning of narrow cooling; s
T_COMP = t0 + tau_comp + np.linspace(0.0, 4e-3, 51) # compression ramp times
tau_twzr_load = 50e-3 # time to load into tweezers; s
tau_hold = 10e-3 # hold with CMOT beams at imaging (proxy) frequency
tau_pause = 0.75e-3 # pause between ncool and load; s
tau_twzr_load = 2.5e-3 # time to load into tweezers; s
tau_hold = 0e-3 # hold with CMOT beams at imaging (proxy) frequency
tau_dark = 27e-3 # shutter opening time for EMCCD; s
tau_pp = 0e-3 # parity projection time; s
tau_probe = 50e-3 # probe imaging time; s
tau_all = tau_ncool + tau_twzr_load + tau_hold + tau_pp + tau_dark + tau_probe # main sequence time; s
tau_probe = 30e-3 # probe imaging time; s
tau_all = ( # main sequence time; s
tau_ncool
+ tau_pause
+ tau_twzr_load
+ tau_hold
+ tau_pp
+ tau_dark
+ tau_probe
)
# camera timings
tau_flir = -10e-3 # Flir camera time relative to end of narrow cooling; s
tau_flir_second = tau_twzr_load + tau_pp + tau_dark + 0.1e-3 # second Flir shot relative to end of narrow cooling; s
TAU_ANDOR = np.linspace(0.0e-3, 400e-3, 9) # EMCCD camera time relative to end of dark period; s
TAU_ANDOR = np.array([0.0e-3])
# tau_andor = -17.0e-3
tau_flir = -10e-3 # Flir camera time rel. to end of pause after narrow cooling; s
tau_flir_second = tau_twzr_load + tau_pp + tau_dark + 0.1e-3 # second Flir shot rel. to end of pause after narrow cooling; s
TAU_ANDOR = np.array([0.0e-3]) # EMCCD camera time relative to end of dark period; s
# coil settings
SHIMS_FB = np.linspace(1.255, 1.255, 1) # Front/Back shim scans: 1.22; +1.2 for 174
SHIMS_LR = np.linspace(0.165, 0.165, 1) # Left/Right shim scans: 0.20; -0.2 for 174
# SHIMS_LR = np.append(
# np.linspace(-0.30, -0.12, 5),
# np.linspace(+0.12, +0.30, 5),
# )
SHIMS_UD = np.linspace(0.565, 0.565, 1) # Up/Down shim scans: 0.57; +0.4 for 174
SHIMS_FB = np.linspace(1.200, 1.200, 1) # Front/Back shim scans: 1.22; +1.2 for 174
SHIMS_LR = np.linspace(0.125, 0.125, 1) # Left/Right shim scans: 0.20; -0.2 for 174
SHIMS_UD = np.linspace(0.580, 0.580, 1) # Up/Down shim scans: 0.57; +0.4 for 174
B_blue = int(441815) # blue MOT gradient setting
B_green = int(44182 * 1.25) # 174: 1.25 -> 1.1
bits_Bset = int(20) # number of bits in a servo setting
......@@ -86,10 +89,9 @@ bits_DACset = int(4) # number of bits in a DAC-mode setting
B_COMP = np.linspace(B_green, B_green * 1.8, T_COMP.shape[0]) # compression ramp values
# detunings
DET_MOT = np.linspace(+0.9, +0.9, 1) # green MOT detuning for tweezer loading (rel. to CMOT); MHz
DET_PROBE_PROXY = 3.68 + np.linspace(-1.0, +1.0, 11) # imaging conditions proxy using CMOT beams (rel. to AOM center); MHz
DET_PROBE = 3.68 + np.linspace(-0.4, -0.4, 1) # probe beam detuning for imaging (rel. to AOM center); MHz
# DET_PP = 3.68 + np.linspace(-1.0, +1.0, 11) # green MOT detuning for parity projection (rel. to AOM center); MHz
DET_MOT = np.linspace(+1.3, +1.3, 1) # green MOT detuning for tweezer loading (rel. to CMOT); MHz
DET_PROBE_PROXY = 3.68 + np.linspace(+0.8, +0.8, 1) # imaging conditions proxy using CMOT beams (rel. to AOM center); MHz
DET_PROBE = 3.68 + np.linspace(-0.3, -0.3, 1) # probe beam detuning for imaging (rel. to AOM center); MHz
DET_PP = 3.68 + np.linspace(+0.8, +0.8, 1)
det_block = 10 # shift the RF on the MOT beams to decouple the fiber; MHz
det_556_tweezer = 3.68 # detuning on the 556 tweezer (probe) path (rel. to AOM center); MHz
......@@ -113,16 +115,21 @@ p_ramp_end = 0.0 # end of ramp; dBm
p_probe = 14.0 # power in probe beam AOMs; dBm
p_556_tweezer = -10.0 # power in the 556 tweezer (probe) AOM; dBm
def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau_andor: float) \
allvars = {
k: list(v) if isinstance(v, np.ndarray) else v
for k, v in vars().items() if isinstance(v, (str, int, float, complex, tuple, list, dict, np.ndarray))
}
def make_sequence(shim_fb: float, shim_lr: float, shim_ud: float, tau_andor: float) \
-> SuperSequence:
SEQ = SuperSequence(
outdir.joinpath("sequences"),
name,
f"fb={shim_fb:.5f}_lr={shim_lr:.5f}_ud={shim_ud:.5f}_tau-andor={tau_andor:.5f}",
{
"Flir": (Sequence()
+ Sequence.digital_pulse(
*C.flir_trig,
t0 + tau_ncool + tau_flir,
t0 + tau_ncool + tau_pause + tau_flir,
camera_config["exposure_time"] * 1e-6 # convert back us -> s
)
).with_color("C2"),
......@@ -130,7 +137,7 @@ def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau
"EMCCD": (Sequence()
+ Sequence.digital_pulse(
*C.andor_trig,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp + tau_dark + tau_andor - 27e-3, # shutter time
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp + tau_dark + tau_andor - 27e-3, # shutter time
10e-3 # pulse length is arbitrary; currently set to exposure time
)
).with_color("C2"),
......@@ -167,7 +174,7 @@ def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau
"MOT servo off": (Sequence()
+ Sequence.serial_bits_c(
C.mot3_coils_sig,
t0 + tau_ncool + tau_twzr_load, # time for MOT to disperse
t0 + tau_ncool + tau_pause + tau_twzr_load, # time for MOT to disperse
0, bits_Bset, # turn off to disperse MOT before imaging
AD5791_DAC, bits_DACset,
C.mot3_coils_clk, C.mot3_coils_sync,
......@@ -257,8 +264,8 @@ def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau
# ]
+ Sequence.digital_hilo(
*C.mot3_green_sh,
t0 - 1e-3,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp,
t0 - 3.8e-3,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp,
)
+ Sequence.serial_bits_c(
......@@ -302,7 +309,7 @@ def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau
SEQ["Flir"]
+ Sequence.digital_pulse(
*C.flir_trig,
t0 + tau_ncool + tau_flir_second,
t0 + tau_ncool + tau_pause + tau_flir_second,
camera_config["exposure_time"] * 1e-6 # convert us -> s
)
).with_color("C2")
......@@ -310,18 +317,18 @@ def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau
SEQ["556 tweezer"] = (Sequence()
+ Sequence.digital_pulse(
*C.tweezer_green_aom,
t0 + tau_ncool,
t0 + tau_ncool + tau_pause,
camera_config["exposure_time"] * 1e-6 # convert us -> s
+ 2e-3 # make sure the tweezer is on while Flir is exposed
)
+ Sequence.digital_pulse(
*C.tweezer_green_sh,
t0 + tau_ncool - 5e-3, # shutter time and a bit extra for noise
t0 + tau_ncool + tau_pause - 5e-3, # shutter time and a bit extra for noise
camera_config["exposure_time"] * 1e-6 + 10e-3
)
# + Sequence.digital_pulse(
# *C.probe_green_aom,
# t0 + tau_ncool,
# t0 + tau_ncool + tau_pause,
# camera_config["exposure_time"] * 1e-6 # convert us -> s
# + 2e-3 # make sure the tweezer is on while Flir is exposed
# )
......@@ -330,13 +337,13 @@ def make_sequence(name: str, shim_fb: float, shim_lr: float, shim_ud: float, tau
SEQ["Green imaging"] = (Sequence()
+ Sequence.digital_pulse(
*C.probe_green_aom,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp + tau_dark,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp + tau_dark,
tau_probe,
invert=True
)
# + Sequence.digital_pulse(
# *C.probe_green_sh,
# t0 + tau_ncool - 2e-3, # account for 2 ms shutter delay
# t0 + tau_ncool + tau_pause - 2e-3, # account for 2 ms shutter delay
# tau_twzr_load + tau_probe
# )
).with_color("C6")
......@@ -398,20 +405,20 @@ def make_mot_mogtable(mot_det: float, probe_proxy_det: float, pp_det: float):
(mogtable
# apply detuning for loading
<< MOGEvent(frequency=RAMP_F[-1] + mot_det)
@ (-tau_ref + tau_ncool + 1.7e-3) # unknown source of timing error
@ (-tau_ref + tau_ncool + tau_pause + 1.7e-3) # unknown source of timing error
# switch to imaging frequency to test in-tweezer cooling
<< MOGEvent(frequency=90.0 + probe_proxy_det)
@ (-tau_ref + tau_ncool + tau_twzr_load + 1.7e-3) # unknown source of timing error
@ (-tau_ref + tau_ncool + tau_pause + tau_twzr_load + 1.7e-3) # unknown source of timing error
# apply detuning for parity projection
<< MOGEvent(frequency=90.0 + pp_det)
@ (-tau_ref + tau_ncool + tau_twzr_load + tau_hold + 1.7e-3) # unknown source of timing error
@ (-tau_ref + tau_ncool + tau_pause + tau_twzr_load + tau_hold + 1.7e-3) # unknown source of timing error
# detune and depower the MOT beams for loading tweezers after the CMOT ramp
# is finished
<< MOGEvent(frequency=RAMP_F[-1] + det_block, power=-50.0)
@ (-tau_ref + tau_ncool + tau_twzr_load + tau_hold + tau_pp + 1.7e-3) # unknown source of timing error
@ (-tau_ref + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp + 1.7e-3) # unknown source of timing error
)
return mogtable
......@@ -442,36 +449,49 @@ class NarrowCoolingTweezerAlignment(Controller):
# pre-construct all sequences and mogtables so we don't have to do it
# in the main loop
print("[control] pre-computing sequences ... ", end="", flush=True)
self.sequences = list()
self.ssequences = list()
for fb, lr, ud, tau_andor in product(SHIMS_FB, SHIMS_LR, SHIMS_UD, TAU_ANDOR):
name = f"fb={fb:.5f}_lr={lr:.5f}_ud={ud:.5f}_tau-andor={tau_andor:.5f}"
sseq = make_sequence(name, fb, lr, ud, tau_andor)
self.sequences.append(sseq.to_sequence())
self.ssequences.append(sseq)
# track the mogtables separately because they're slow to load to the controller
# they should be the slowest-varying parameter in scans
self.mot_mogtables = [
make_mot_mogtable(d_mot, d_probe_proxy, d_pp)
for d_mot, d_probe_proxy, d_pp in product(DET_MOT, DET_PROBE_PROXY, DET_PP)
]
print(f"done ({len(self.mot_mogtables) * len(self.sequences) * reps})")
# print("[control] pre-computing sequences ... ", end="", flush=True)
# self.sequences = list()
# self.ssequences = list()
# for fb, lr, ud, tau_andor in product(SHIMS_FB, SHIMS_LR, SHIMS_UD, TAU_ANDOR):
# name = f"fb={fb:.5f}_lr={lr:.5f}_ud={ud:.5f}_tau-andor={tau_andor:.5f}"
# sseq = make_sequence(name, fb, lr, ud, tau_andor)
# self.sequences.append(sseq.to_sequence())
# self.ssequences.append(sseq)
# # track the mogtables separately because they're slow to load to the controller
# # they should be the slowest-varying parameter in scans
# self.mot_mogtables = [
# make_mot_mogtable(d_mot, d_probe_proxy, d_pp)
# for d_mot, d_probe_proxy, d_pp in product(DET_MOT, DET_PROBE_PROXY, DET_PP)
# ]
# print(f"done ({len(self.mot_mogtables) * len(self.sequences) * reps})")
def run_sequence(self, *args):
fmt = ("\r "
+ " ".join(
f"{{:{int(np.log10(len(X))) + 1:.0f}}}/{len(X)}"
for X in [self.mot_mogtables, DET_PROBE, self.sequences, range(reps)]
)
+ " ({:6.2f}%) "
)
N = [len(X) for X in [self.mot_mogtables, DET_PROBE, self.sequences, range(reps)]]
N_mog = np.prod([len(X) for X in [DET_MOT, DET_PROBE_PROXY, DET_PP]])
N_probe = len(DET_PROBE)
N_ew = np.prod([len(X) for X in [SHIMS_FB, SHIMS_LR, SHIMS_UD, TAU_ANDOR]])
N = [N_mog, N_probe, N_ew, reps]
NN = [np.prod(N[-k:]) for k in range(1, len(N))][::-1] + [1]
TOT = np.prod(N)
for i, table in enumerate(self.mot_mogtables):
fmt = (" "
+ " ".join(f"{{:{int(np.log10(n)) + 1:.0f}}}/{n}" for n in N)
+ " ({:6.2f}%) \r"
)
# loop over generators for memory efficiency
mot_mogtables = lambda: (
make_mot_mogtable(d_mot, d_probe_proxy, d_pp)
for d_mot, d_probe_proxy, d_pp in product(DET_MOT, DET_PROBE_PROXY, DET_PP)
)
sequences = lambda: (
make_sequence(fb, lr, ud, tau_andor).to_sequence()
for fb, lr, ud, tau_andor in product(SHIMS_FB, SHIMS_LR, SHIMS_UD, TAU_ANDOR)
)
t0 = timeit.default_timer()
for i, table in enumerate(mot_mogtables()):
(self.mog
.set_frequency(1, 90.0).set_power(1, -50.0) # make sure the AOM is off
.table_load(1, table)
......@@ -483,7 +503,7 @@ class NarrowCoolingTweezerAlignment(Controller):
(self.tb
.set_frequency(90.0 + d_probe)
)
for k, seq in enumerate(self.sequences):
for k, seq in enumerate(sequences()):
for rep in range(reps):
print(fmt.format(
i + 1, j + 1, k + 1, rep + 1,
......@@ -507,6 +527,12 @@ class NarrowCoolingTweezerAlignment(Controller):
.clear()
)
T = timeit.default_timer() - t0
print(
f" total elapsed time: {T:.2f} s"
f"\n average time per shot: {T / TOT:.2f} s"
)
self.comp.clear().disconnect()
(self.mog
......@@ -611,7 +637,7 @@ class NarrowCoolingTweezerAlignment(Controller):
# # sseq.save()
def cmd_visualize(self, *args):
seq = make_sequence("", SHIMS_FB.mean(), SHIMS_LR.mean(), SHIMS_UD.mean(), TAU_ANDOR.mean())
seq = make_sequence(SHIMS_FB.mean(), SHIMS_LR.mean(), SHIMS_UD.mean(), TAU_ANDOR.mean())
try:
tmin, tmax = float(args[0]), float(args[1])
except IndexError:
......@@ -623,11 +649,12 @@ class NarrowCoolingTweezerAlignment(Controller):
for t in [
t0,
t0 + tau_ncool,
t0 + tau_ncool + tau_twzr_load,
t0 + tau_ncool + tau_twzr_load + tau_hold,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp + tau_dark,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp + tau_dark + tau_probe,
t0 + tau_ncool + tau_pause,
t0 + tau_ncool + tau_pause + tau_twzr_load,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp + tau_dark,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp + tau_dark + tau_probe,
]:
P.axvline(t, color="r", linestyle="-", linewidth=0.4)
for t in [
......@@ -638,8 +665,8 @@ class NarrowCoolingTweezerAlignment(Controller):
P.axvline(t, color="g", linestyle="--", linewidth=0.4)
for t in [
t0 + tau_comp,
t0 + tau_ncool + tau_flir,
t0 + tau_ncool + tau_twzr_load + tau_hold + tau_pp + tau_dark + TAU_ANDOR.mean(),
t0 + tau_ncool + tau_pause + tau_flir,
t0 + tau_ncool + tau_pause + tau_twzr_load + tau_hold + tau_pp + tau_dark + TAU_ANDOR.mean(),
]:
P.axvline(t, color="b", linestyle=":", linewidth=0.4)
(P
......
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