Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
experiment-control
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
whuie2
experiment-control
Commits
77b016f3
Commit
77b016f3
authored
3 years ago
by
whooie
Browse files
Options
Downloads
Patches
Plain Diff
fix issues in computing atom number via fluorescence imaging
parent
5341c27e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fluorescence_imaging.py
+6
-19
6 additions, 19 deletions
fluorescence_imaging.py
lib/imaging.py
+24
-9
24 additions, 9 deletions
lib/imaging.py
with
30 additions
and
28 deletions
fluorescence_imaging.py
+
6
−
19
View file @
77b016f3
...
...
@@ -19,33 +19,20 @@ camera_config = {
}
# BUILD SEQUENCE
t0
=
10.0
# t
urn off the push beam
t0
=
10.0
# t
ake 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
]
:
.
3
f
}
"
:
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
()
...
...
This diff is collapsed.
Click to expand it.
lib/imaging.py
+
24
−
9
View file @
77b016f3
...
...
@@ -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
Absorption
Data
(
outdir
,
arrays
,
config
,
comments
,
results
)
return
Imaging
Data
(
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
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment