Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calng
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
Model registry
Operate
Environments
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
calibration
calng
Commits
a987b9ef
Commit
a987b9ef
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Handle fixed gain mode as operating condition, too
parent
00231fd2
No related branches found
Branches containing commit
No related tags found
2 merge requests
!12
Snapshot: field test deployed version as of end of run 202201
,
!3
Base correction device, CalCat interaction, DSSC and AGIPD devices
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/calng/AgipdCorrection.py
+18
-30
18 additions, 30 deletions
src/calng/AgipdCorrection.py
with
18 additions
and
30 deletions
src/calng/AgipdCorrection.py
+
18
−
30
View file @
a987b9ef
...
...
@@ -93,6 +93,8 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner):
g_gain_value
=
1
,
):
self
.
gain_mode
=
gain_mode
# default gain only matters when not thresholding (missing constant or fixed)
# note: gain stage (result of thresholding) is 0, 1, or 2
if
self
.
gain_mode
is
AgipdGainMode
.
ADAPTIVE_GAIN
:
self
.
default_gain
=
cupy
.
uint8
(
gain_mode
)
else
:
...
...
@@ -279,10 +281,6 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner):
def
correct
(
self
,
flags
):
if
flags
&
CorrectionFlags
.
BLSHIFT
:
raise
NotImplementedError
(
"
Baseline shift not implemented yet
"
)
if
self
.
gain_mode
is
not
AgipdGainMode
.
ADAPTIVE_GAIN
and
(
flags
&
CorrectionFlags
.
THRESHOLD
):
raise
ValueError
(
"
Cannot do gain thresholding in fixed gain mode
"
)
self
.
correction_kernel
(
self
.
full_grid
,
...
...
@@ -376,11 +374,11 @@ class AgipdCalcatFriend(calcat_utils.BaseCalcatFriend):
.
reconfigurable
()
.
commit
(),
DOUBLE
_ELEMENT
(
schema
)
STRING
_ELEMENT
(
schema
)
.
key
(
f
"
{
param_prefix
}
.gainMode
"
)
.
assignmentOptional
()
.
defaultValue
(
0
)
.
reconfigurable
(
)
.
defaultValue
(
"
ADAPTIVE_GAIN
"
)
.
options
(
"
ADAPTIVE_GAIN,FIXED_HIGH_GAIN,FIXED_MEDIUM_GAIN,FIXED_LOW_GAIN
"
)
.
commit
(),
DOUBLE_ELEMENT
(
schema
)
...
...
@@ -404,25 +402,25 @@ class AgipdCalcatFriend(calcat_utils.BaseCalcatFriend):
res
[
"
Pixels X
"
]
=
self
.
_get_param
(
"
pixelsX
"
)
res
[
"
Pixels Y
"
]
=
self
.
_get_param
(
"
pixelsY
"
)
res
[
"
Acquisition rate
"
]
=
self
.
_get_param
(
"
acquisitionRate
"
)
# TODO: make configurable whether or not to include gain setting?
# TODO: remove this workaround after CalCat update
integration_time
=
self
.
_get_param
(
"
integrationTime
"
)
if
integration_time
!=
12
:
res
[
"
Integration Time
"
]
=
integration_time
gain_mode
=
AgipdGainMode
[
self
.
_get_param
(
"
gainMode
"
)]
if
gain_mode
is
not
AgipdGainMode
.
ADAPTIVE_GAIN
:
res
[
"
Gain Mode
"
]
=
gain_mode
.
value
# TODO: make configurable whether or not to include gain setting?
res
[
"
Gain Setting
"
]
=
self
.
_get_param
(
"
gainSetting
"
)
return
res
def
illuminated_condition
(
self
):
res
=
calcat_utils
.
OperatingConditions
()
res
[
"
Memory cells
"
]
=
self
.
_get_param
(
"
memoryCells
"
)
res
[
"
Sensor Bias Voltage
"
]
=
self
.
_get_param
(
"
biasVoltage
"
)
res
[
"
Pixels X
"
]
=
self
.
_get_param
(
"
pixelsX
"
)
res
[
"
Pixels Y
"
]
=
self
.
_get_param
(
"
pixelsY
"
)
res
=
self
.
dark_condition
()
res
[
"
Source Energy
"
]
=
self
.
_get_param
(
"
photonEnergy
"
)
res
[
"
Acquisition rate
"
]
=
self
.
_get_param
(
"
acquisitionRate
"
)
integration_time
=
self
.
_get_param
(
"
integrationTime
"
)
if
integration_time
!=
12
:
res
[
"
Integration Time
"
]
=
integration_time
res
[
"
Gain Setting
"
]
=
self
.
_get_param
(
"
gainSetting
"
)
return
res
...
...
@@ -454,16 +452,6 @@ class AgipdCorrection(BaseCorrection):
.
setNewDefaultValue
(
"
cell
"
)
.
commit
(),
)
# WIP: fixed gain mode
(
STRING_ELEMENT
(
expected
)
.
key
(
"
gainMode
"
)
.
displayedName
(
"
Gain mode
"
)
.
assignmentOptional
()
.
defaultValue
(
"
ADAPTIVE_GAIN
"
)
.
options
(
"
ADAPTIVE_GAIN,FIXED_HIGH_GAIN,FIXED_MEDIUM_GAIN,FIXED_LOW_GAIN
"
)
.
commit
(),
)
(
OUTPUT_CHANNEL
(
expected
)
...
...
@@ -595,8 +583,8 @@ class AgipdCorrection(BaseCorrection):
def
__init__
(
self
,
config
):
super
().
__init__
(
config
)
#
TODO: consider different gpu runner for fixed gain m
ode
self
.
gain_mode
=
AgipdGainMode
[
config
.
get
(
"
gainMode
"
)]
#
note: gain mode single sourced from constant retrieval n
ode
self
.
gain_mode
=
AgipdGainMode
[
config
.
get
(
"
constantParameters.
gainMode
"
)]
try
:
self
.
bad_pixel_mask_value
=
np
.
float32
(
...
...
This diff is collapsed.
Click to expand it.
David Hammer
@hammerd
mentioned in commit
3566342d
·
2 years ago
mentioned in commit
3566342d
mentioned in commit 3566342d031db1bb435b6430f100afdbaaa6c4bf
Toggle commit list
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