Commit 77b016f3 authored by whooie's avatar whooie
Browse files

fix issues in computing atom number via fluorescence imaging

parent 5341c27e
......@@ -19,33 +19,20 @@ camera_config = {
}
# BUILD SEQUENCE
t0 = 10.0 # turn off the push beam
t0 = 10.0 # take the picture
SEQ = SuperSequence(outdir, "sequence", {
"Sequence": (Sequence
.digital_hilo(*C.dummy, 0.0, t0 + 100e-3)
.with_color("k").with_stack_idx(0)
),
"MOT coils": (Sequence
.digital_hilo(*C.coils, 0.0, t0 - 25e-3)
.with_color("C1").with_stack_idx(1)
),
#"MOT laser block": (Sequence
# .digital_pulse(*C.mot_laser, t0 - 12e-3, 1e-3,
# invert=True)
# .with_color("C0").with_stack_idx(2)
#),
"Push": (Sequence
.digital_hilo(*C.push_sh, 0.0, t0 - 10e-3)
.with_color("C3").with_stack_idx(3)
),
"Camera": (Sequence
.digital_pulse(*C.camera, t0 + 10e-6, camera_config["exposure_time"])
.with_color("C2").with_stack_idx(6)
.digital_pulse(*C.camera, t0, camera_config["exposure_time"])
.with_color("C2").with_stack_idx(1)
),
"Scope": (Sequence
.digital_hilo(*C.scope, t0 - 25e-3, t0 + 100e-3)
.with_color("C7").with_stack_idx(7)
.with_color("C7").with_stack_idx(2)
),
})
......@@ -78,11 +65,11 @@ class FluorescenceImaging(Controller):
frames = self.cam.acquire_frames(1)
data = AbsorptionData(
name=outdir,
arrays={f"dt_{DT[i]:.3f}": frame for i, frame in enumerate(frames)},
arrays={"image": frames[0]},
config=camera_config,
comments=comments
)
#data.compute_results()
data.compute_results()
data.save()
data.render_arrays()
......
......@@ -70,7 +70,7 @@ class ImagingData:
if printflag: print("[imaging] load arrays")
if not arrays_file.is_file():
raise Exception(f"Arrays file '{arrays_file}' does not exist")
arrays = np.load(arrays_file)
arrays = dict(np.load(arrays_file))
config_file = target.joinpath("config.toml")
if printflag: print("[imaging] load camera config")
......@@ -88,7 +88,7 @@ class ImagingData:
results = results_file.read_text() \
if results_file.is_file() else None
#if printflag: print(" Done.")
return AbsorptionData(outdir, arrays, config, comments, results)
return ImagingData(outdir, arrays, config, comments, results)
def render_arrays(self, target: pathlib.Path=None, dx=None,
printflag: bool=True):
......@@ -126,6 +126,13 @@ class ImagingData:
raise NotImplementedError
class AbsorptionData(ImagingData):
@staticmethod
def load(target: pathlib.Path, outdir: pathlib.Path=None,
printflag: bool=True):
data = ImagingData.load(target, outdir, printflag)
return AbsorptionData(
data.outdir, data.arrays, data.config, data.comments, data.results)
def compute_results(self, dA=(3.45)**2, printflag: bool=True):
_dA = self.config.get("bin_size", 1)**2 \
* (DEF_DX**2 if dA is None else dA)
......@@ -147,6 +154,13 @@ def compute_od(shadow: np.ndarray, bright: np.ndarray, dark: np.ndarray):
return OD
class FluorescenceData(ImagingData):
@staticmethod
def load(target: pathlib.Path, outdir: pathlib.Path=None,
printflag: bool=True):
data = ImagingData.load(target, outdir, printflag)
return FluorescenceData(
data.outdir, data.arrays, data.config, data.comments, data.results)
def compute_results(self, dA=3.45**2, printflag: bool=True):
_dA = self.config.get("bin_size", 1)**2 \
* (DEF_DX**2 if dA is None else dA)
......@@ -156,18 +170,18 @@ class FluorescenceData(ImagingData):
array,
0.76,
self.config["gain"], # dB
self.config["exposure_time"],
self.config["exposure_time"] * 1e-6, # s
(0.0127**2 * np.pi) / (4 * np.pi * 0.125**2),
50e6 * 2 * np.pi,
0.1
1.0
)
sx, sy = _fit_gaussian(array, _dA)
self.results = dict() if self.results is None else self.results
self.results.update(
{
f"N ({label})": float(N),
f"sx ({label})": float(sx),
f"sy ({label})": float(sy)
f"N_{label}": float(N),
f"sx_{label}": float(sx),
f"sy_{label}": float(sy)
}
)
return self
......@@ -176,8 +190,9 @@ def compute_mot_number(image, QE, gain, exposure_time, solid_angle,
detuning, intensity_parameter):
if image.max() >= 2**16:
print("[imaging] WARNING: image may contain clipping")
electron_rate = image.sum() * 16
photon_rate = electron_rate \
electron_rate = image.astype(np.float64).sum() / 16 # get to 12-bit values
photon_rate \
= electron_rate \
/ 10**(gain / 10) \
/ QE \
/ solid_angle \
......
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