Commit d0dfad2e authored by whooie's avatar whooie
Browse files

Merge branch 'master' of gitlab-uiuc:whuie2/experiment-control

forgot to pull before pushing
parents 971b6cde 5d53ca3c
......@@ -38,7 +38,8 @@ class ImagingData:
arrays_file = io.fresh_filename(T.joinpath("arrays.npz"), overwrite)
if printflag: print("[imaging] save arrays")
np.savez_compressed(arrays_file, **self.arrays)
#np.savez_compressed(arrays_file, **self.arrays)
np.savez(arrays_file, **self.arrays)
config_file = io.fresh_filename(T.joinpath("config.toml"), overwrite)
if printflag: print("[imaging] save camera config")
......@@ -190,9 +191,9 @@ class FluorescenceData(ImagingData):
N_bkgd = compute_mot_number(
self.arrays["background"].astype(np.float64),
**compute_mot_number_params,
k=0
k=None
) if subtract_bkgd and "background" in self.arrays.keys() else 0.0
for label, array in self.arrays.items():
for k, (label, array) in enumerate(self.arrays.items()):
dtype_info = np.iinfo(array.dtype)
if array.max() >= (dtype_info.max - dtype_info.bits):
print(
......@@ -200,7 +201,7 @@ class FluorescenceData(ImagingData):
N = compute_mot_number(
array.astype(np.float64),
**compute_mot_number_params,
k=1
k=None
)
sx, sy = lls_fit_gaussian(array, _dA)
self.results = dict() if self.results is None else self.results
......@@ -215,15 +216,16 @@ class FluorescenceData(ImagingData):
return self
def compute_mot_number(image, QE, gain, exposure_time, solid_angle,
detuning, intensity_parameter, k=0):
detuning, intensity_parameter, k=None):
H, W = image.shape
K_h = 3.0
slice_h = pd.S[int(H / K_h) : int((K_h - 1) * H / K_h)]
K_w = 3.0
slice_w = pd.S[int(W / K_w) : int((K_w - 1) * W / K_w)]
im = image[slice_h, slice_w]
#pd.Plotter().imshow(image).savefig(f"image_{k}.png").close()
#pd.Plotter().imshow(im).savefig(f"img_{k}.png").close()
if k is not None:
pd.Plotter().imshow(image).savefig(f"image_{k}.png").close()
pd.Plotter().imshow(im).savefig(f"img_{k}.png").close()
electron_rate = im.astype(np.float64).sum()
photon_rate = (
electron_rate
......
......@@ -10,7 +10,7 @@ from lib.mogdriver import MOGDriver
from lib.dataio import DataPaths
import pathlib
DATA_HOME = pathlib.Path(r"C:\Users\EW\University of Illinois - Urbana\Covey Lab - Documents\Data")
DATA_HOME = pathlib.Path(r"C:\Users\EW\Documents\Data")
DATADIRS = DataPaths(
home = DATA_HOME,
absorption_imaging = DATA_HOME.joinpath("absorption imaging"),
......@@ -40,10 +40,11 @@ CONNECTIONS = ConnectionLayout(
mot3_shims_onoff = Digital(0, 0, 0),
mot3_blue_sh = Digital(1, 7, 1),
mot3_green_aom = Digital(0, 9, 0),
mot3_green_sh = Digital(1, 5, 0),
push_aom = Digital(0, 3, 1),
push_sh = Digital(1, 3, 1),
probe_aom = Digital(0, 5, 0),
probe_sh = Digital(1, 5, 0),
#probe_sh = Digital(1, 5, 0),
flir_trig = Digital(3, 0, 0),
andor_trig = Digital(3, 4, 0),
andor_sh = Digital(3, 6, 0),
......
......@@ -8,6 +8,7 @@ outdir = DATADIRS.fluorescence_imaging.joinpath(get_timestamp())
comments = """
Loading rate measurement
========================
4.25 A dispenser
"""[1:-1]
# CAMERA OPTIONS
......@@ -21,32 +22,32 @@ camera_config = {
# BUILD SEQUENCE
t0 = 0.5 # the window of times where pictures are taken is [t0, t0 + DT.max()]
R = 5 # repetitions for each dt
DT = np.array([np.linspace(0.0, 1.0, 21) for k in range(R)]).T.flatten()
R = 4 # repetitions for each dt
DT = np.array([np.linspace(0.0, 2.0, 11) for k in range(R)]).T.flatten()
z = int(np.ceil(np.log10(R)))
def make_sequence(dt, name=None):
name = f"dt={dt:.5f}" if name is None else name
seq_push = Sequence() << Event.digital1(**C.push_sh, s=0) @ 0.0
if dt != 0.0:
seq_push << Event.digital1(**C.push_sh, s=1) @ (t0 - 10e-3)
seq_push << Event.digital1(**C.push_sh, s=0) @ (t0 + dt - 10e-3)
SEQ = SuperSequence(outdir.joinpath("sequences"), name, {
"Sequence": (Sequence
.digital_hilo(*C.dummy, 0.0, t0 + dt + 500e-3)
.digital_hilo(*C.dummy, 0.0, t0 + dt + 100e-3)
.with_color("k").with_stack_idx(0)
),
"MOT beams": (Sequence
.digital_lohi(*C.mot3_blue_sh, 0.0, t0 - 50e-3)
.digital_lohi(*C.mot3_blue_sh, 0.0, t0 - 10e-3)
.with_color("C0").with_stack_idx(1)
),
"Push": (Sequence()
<< Event.digital1(**C.push_sh, s=0) @ 0.0
<< Event.digital1(**C.push_sh, s=1) @ (t0 - 10e-3)
<< Event.digital1(**C.push_sh, s=0) @ (t0 + dt - 5e-3)
).with_color("C3").with_stack_idx(3),
"Push": seq_push.with_color("C3").with_stack_idx(3),
"Camera": (Sequence
.digital_pulse(*C.flir_trig, t0 + dt, camera_config["exposure_time"] * 1e-6)
.with_color("C2").with_stack_idx(6)
),
"Scope": (Sequence
.digital_hilo(*C.scope_trig, t0 - 20e-3, t0 + dt + 500e-3)
.digital_hilo(*C.scope_trig, t0 - 20e-3, t0 + dt + 100e-3)
.with_color("C7").with_stack_idx(7)
),
}, C)
......@@ -54,23 +55,23 @@ def make_sequence(dt, name=None):
seq_bkgd = SuperSequence(outdir.joinpath("sequences"), f"background", {
"Sequence": (Sequence
.digital_hilo(*C.dummy, 0.0, 100e-3)
.digital_hilo(*C.dummy, 0.0, 200e-3)
),
"Push": (Sequence
.digital_lohi(*C.push_sh, 0.0, 100e-3)
.digital_lohi(*C.push_sh, 0.0, 200e-3)
),
"MOT beams": (Sequence
.digital_lohi(*C.mot3_blue_sh, 0.0, 50e-3)
.digital_lohi(*C.mot3_blue_sh, 0.0, 150e-3)
),
"MOT coils": (Sequence
.digital_hilo(*C.mot3_coils_igbt, 0.0, 100e-3)
.digital_hilo(*C.mot3_coils_onoff, 0.0, 100e-3)
.digital_hilo(*C.mot3_coils_igbt, 0.0, 200e-3)
.digital_hilo(*C.mot3_coils_onoff, 0.0, 200e-3)
),
"Camera": (Sequence
.digital_pulse(*C.flir_trig, 80e-3, camera_config["exposure_time"] * 1e-6)
.digital_pulse(*C.flir_trig, 180e-3, camera_config["exposure_time"] * 1e-6)
),
"Scope": (Sequence
.digital_hilo(*C.scope_trig, 0.0, 100e-3)
.digital_hilo(*C.scope_trig, 0.0, 200e-3)
),
}, C)
......@@ -109,12 +110,13 @@ class LoadingRate(Controller):
.run()
.clear()
)
#SEQ.save()
SEQ.save()
(self.comp
.enqueue(seq_bkgd.to_sequence())
.run()
.clear()
)
self.comp.def_digital(*C.push_sh, 1)
def run_camera(self, *args):
frames = self.cam.acquire_frames(1 + len(DT))
......@@ -129,9 +131,9 @@ class LoadingRate(Controller):
config=camera_config,
comments=comments
)
data.compute_results()
data.compute_results(subtract_bkgd=False)
data.save()
data.render_arrays()
#data.render_arrays()
def cmd_visualize(self, *args):
make_sequence(float(args[0]) if len(args) > 0 else DT.max()) \
......
......@@ -26,7 +26,7 @@ camera_config = {
# CONSTRUCT SEQUENCE
t0 = 1.8 # big coils start turning off at t0
R = 3 # repetition for each tau
#TAU = np.array([np.linspace(6.5e-3, 506.5e-3, 16) for k in range(R)]).T.flatten()
#TAU = np.array([np.linspace(6.5e-3, 126.5e-3, 5) for k in range(R)]).T.flatten()
TAU = np.array([
[
6.5e-3, 8e-3, 10e-3, 12e-3, 14e-3, 16e-3, 18e-3, 20e-3,
......@@ -34,6 +34,7 @@ TAU = np.array([
240e-3, 260e-3, 280e-3, 300e-3,
] for k in range(R)
]).T.flatten()
#TAU = np.array(R * [6.5e-3, 100e-3, 200e-3]).T.flatten()
z = int(np.ceil(np.log10(R)))
def make_sequence(tau, name=None):
......@@ -72,10 +73,14 @@ def make_sequence(tau, name=None):
.digital_hilo(*C.mot3_shims_onoff, t0 - 0.5e-3, t0 + tau)
).with_color("C1").with_stack_idx(3),
"Green beams": (Sequence
"Green beams AOM": (Sequence
.digital_hilo(*C.mot3_green_aom, t0, t0 + tau)
).with_color("C6").with_stack_idx(6),
"Green beams shutter": (Sequence
.digital_hilo(*C.mot3_green_sh, t0 - 10e-3, t0 + tau)
).with_color("C6").with_stack_idx(7),
"Camera": (Sequence
.digital_pulse(*C.flir_trig, t0 + tau,
camera_config["exposure_time"] / 1e6
......@@ -117,6 +122,7 @@ class MOTTransfer(Controller):
.def_digital(*C.push_aom, 1)
.def_digital(*C.push_sh, 1)
.def_digital(*C.mot3_green_aom, 0)
.def_digital(*C.mot3_green_sh, 0)
)
self.cam = FLIR.connect()
......
......@@ -3,13 +3,17 @@ from lib import *
from lib import CONNECTIONS as C
import sys, pathlib
#raise Exception("This script is outdated: needs timing updates")
outdir = DATADIRS.mot_transfer.joinpath(get_timestamp())
timestamp = get_timestamp()
print(timestamp)
outdir = DATADIRS.mot_transfer.joinpath(timestamp)
comments = """
MOT transfer (temperature)
==========================
71.8 MHz RF PDH
4.25 A dispenser current
Grenen shutter enabled
"""[1:-1]
# CAMERA OPTIONS
......@@ -65,10 +69,14 @@ def make_sequence(tau, name=None):
.digital_hilo(*C.mot3_shims_onoff, t0 - 0.5e-3, t0 + G)
).with_color("C1").with_stack_idx(3),
"Green beams": (Sequence
"Green beams AOM": (Sequence
.digital_hilo(*C.mot3_green_aom, t0 - 1e-3, t0 + G - 1e-3)
).with_color("C6").with_stack_idx(6),
"Green beams shutter": (Sequence
.digital_hilo(*C.mot3_green_sh, t0 - 16e-3 - 10e-3, t0 + G - 22e-3 - 1e-3)
).with_color("C7").with_stack_idx(7),
"Camera": (Sequence
.digital_pulse(*C.flir_trig, t0 + G + tau,
camera_config["exposure_time"] / 1e6
......@@ -110,6 +118,7 @@ class MOTTransferTemperature(Controller):
.def_digital(*C.push_aom, 1)
.def_digital(*C.push_sh, 1)
.def_digital(*C.mot3_green_aom, 0)
.def_digital(*C.mot3_green_sh, 0)
)
self.cam = FLIR.connect()
......@@ -123,7 +132,9 @@ class MOTTransferTemperature(Controller):
def run_sequence(self, *args):
for k, tau in enumerate(TAU):
sseq = make_sequence(tau, f"tau={tau:.5f}_{str(k % R).zfill(z):s}")
name = f"tau={tau:.5f}_{str(k % R).zfill(z):s}"
print(name)
sseq = make_sequence(tau, name)
(self.comp
.enqueue(sseq.to_sequence())
.run()
......
Markdown is supported
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