Skip to content
Snippets Groups Projects
Commit 873d95c1 authored by Yb Tweezer's avatar Yb Tweezer
Browse files

remove need for background capture in fluorescence data processing

parent a28f2c5b
No related branches found
No related tags found
No related merge requests found
......@@ -165,15 +165,15 @@ class FluorescenceData(ImagingData):
_dA = self.config.get("bin_size", 1)**2 \
* (DEF_DX**2 if dA is None else dA)
if printflag: print("[imaging] Compute results")
N_bkgd = compute_mot_number(
self.arrays["background"].astype(np.float64),
0.40,
self.config["gain"],
self.config["exposure_time"] * 1e-6, # s
(0.0127**2 * np.pi) / (4 * np.pi * 0.125**2),
50e6 * 2 * np.pi,
1.0
) if "background" in self.arrays else 0
#N_bkgd = compute_mot_number(
# self.arrays["background"].astype(np.float64),
# 0.40,
# self.config["gain"], # dB
# self.config["exposure_time"] * 1e-6, # s
# (0.0127**2 * np.pi) / (4 * np.pi * 0.125**2),
# 50e6 * 2 * np.pi,
# 1.0
#) if "background" in self.arrays.keys() else 0.0
for label, array in self.arrays.items():
if label == "background":
continue
......@@ -181,14 +181,14 @@ class FluorescenceData(ImagingData):
if array.max() >= (dtype_info.max - dtype_info.bits):
print(f"[imaging] WARNING: image '{label}' may contain clipping")
N = compute_mot_number(
array,
array.astype(np.float64),
0.40,
self.config["gain"], # dB
self.config["exposure_time"] * 1e-6, # s
(0.0127**2 * np.pi) / (4 * np.pi * 0.125**2),
50e6 * 2 * np.pi,
1.0
) - N_bkgd
)
sx, sy = lls_fit_gaussian(array, _dA)
self.results = dict() if self.results is None else self.results
self.results.update({
......@@ -203,22 +203,36 @@ class FluorescenceData(ImagingData):
def compute_mot_number(image, QE, gain, exposure_time, solid_angle,
detuning, intensity_parameter):
H, W = image.shape
im = image[H//4:3*H//4, W//4:3*W//4]
K = 4
im = image[H//K:(K - 1)*H//K, W//K:(K - 1)*W//K]
im_bkgd = image.copy()
im_bkgd[H//K:(K - 1)*H//K, W//K:(K - 1)*W//K] = 0
#pd.Plotter().imshow(image).savefig("image.png").close()
#pd.Plotter().imshow(im).savefig("img.png").close()
#pd.Plotter().imshow(im_bkgd).savefig("img_bkgd.png").close()
electron_rate = im.astype(np.float64).sum()
electron_rate_bkgd = im_bkgd.astype(np.float64).sum()
photon_rate \
= electron_rate \
/ 10**(gain / 10) \
/ QE \
/ solid_angle \
/ exposure_time
photon_rate_bkgd \
= electron_rate_bkgd \
/ 10**(gain / 10) \
/ QE \
/ solid_angle \
/ exposure_time
Y = 29.1e6 * 2 * np.pi # transition linewidth; s^-1
l = 399e-9 # transition wavelength; m
I_sat = (Y * H * C * np.pi) / (3 * l**3)
scatter_rate = lambda D, I: \
(Y / 2) * I / (1 + 4 * (D / Y)**2 + I)
N = photon_rate / scatter_rate(detuning, intensity_parameter)
return N
N_bkgd = (K - 2)**2 / (4 * K - 4) \
* photon_rate_bkgd / scatter_rate(detuning, intensity_parameter)
return N - N_bkgd
def lls_fit_gaussian(A, dA):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment