Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cfel-sc-public
Kamzik3
Commits
a11357e4
Commit
a11357e4
authored
May 19, 2022
by
Jerome Carnis
🦊
Browse files
deviceEigerP11.py: use constant Quantity for the max repetition rate
parent
f4e5c007
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamzik3/devices/deviceEigerP11.py
View file @
a11357e4
...
...
@@ -21,6 +21,7 @@ from kamzik3.constants import (
STATUS_BUSY
,
STATUS_CONFIGURED
,
STATUS_IDLE
,
UNIT
,
VALUE
,
)
from
kamzik3.devices.device
import
Device
...
...
@@ -35,6 +36,8 @@ from kamzik3.snippets.snippetsDecorators import expose_method
FRAMES_PER_FILE_SCAN
=
1000
FRAMES_PER_FILE_LIVE
=
1000000
# any large number is ok, images are not saved in the live-view mode
MAX_ACQUISITION_rate
=
units
.
Quantity
(
100
,
"Hz"
)
# according to Jan Meyer, 10ms is the lowest frame time
class
InterfaceStatus
(
IntEnum
):
...
...
@@ -167,13 +170,17 @@ class DeviceTangoEigerDetector(DeviceTango):
saving_directory
=
"shotDir"
,
prefix
=
Name
,
nb_frames
=
nb_frames
)
exposure
=
float
(
self
.
to_device_unit
(
"FrameTime"
,
Exposure
).
m
)
# According to Jan 10ms is lowest frame time
frame_time
=
10e-3
if
exposure
<
10e-3
else
exposure
converted_exposure
=
self
.
detector
.
to_device_unit
(
"FrameTime"
,
Exposure
)
frame_time
=
(
10e-3
if
converted_exposure
<
(
1
/
MAX_ACQUISITION_rate
).
to
(
self
.
get_value
(
"FrameTime"
,
key
=
UNIT
))
else
float
(
converted_exposure
.
m
)
)
self
.
set_attribute
([
"TriggerMode"
,
VALUE
],
TriggerMode
.
INTS
.
value
)
self
.
set_attribute
([
"FrameTime"
,
VALUE
],
frame_time
)
self
.
set_attribute
([
"CountTime"
,
VALUE
],
exposure
)
self
.
set_attribute
([
"CountTime"
,
VALUE
],
float
(
converted_
exposure
.
m
)
)
self
.
set_attribute
([
"Ntrigger"
,
VALUE
],
1
)
self
.
set_attribute
([
"Nimages"
,
VALUE
],
nb_frames
)
self
.
Arm
()
...
...
@@ -204,12 +211,17 @@ class DeviceTangoEigerDetector(DeviceTango):
self
.
set_attribute
(
[
"EigerStream"
,
"Mode"
,
VALUE
],
InterfaceStatus
.
DISABLED
.
value
)
exposure
=
float
(
self
.
to_device_unit
(
"FrameTime"
,
Exposure
).
m
)
# According to Jan Meyer 10ms is the lowest frame time
frame_time
=
10e-3
if
exposure
<
10e-3
else
exposure
converted_exposure
=
self
.
detector
.
to_device_unit
(
"FrameTime"
,
Exposure
)
frame_time
=
(
10e-3
if
converted_exposure
<
(
1
/
MAX_ACQUISITION_rate
).
to
(
self
.
get_value
(
"FrameTime"
,
key
=
UNIT
))
else
float
(
converted_exposure
.
m
)
)
self
.
set_attribute
([
"FrameTime"
,
VALUE
],
frame_time
)
self
.
set_attribute
([
"CountTime"
,
VALUE
],
exposure
)
self
.
set_attribute
([
"CountTime"
,
VALUE
],
float
(
converted_
exposure
.
m
)
)
self
.
set_attribute
([
"Ntrigger"
,
VALUE
],
1
)
self
.
set_attribute
([
"Nimages"
,
VALUE
],
FRAMES_PER_FILE_LIVE
)
self
.
Arm
()
...
...
@@ -395,10 +407,25 @@ class EigerScanner(DeviceScanner):
scan_dir_name
=
"{}_{}"
.
format
(
scan_prefix
,
scan_count
-
1
)
params
=
scanner_input
.
method_parameters
exposure_time
=
float
(
units
.
Quantity
(
params
[
"Exposure"
]).
to
(
"s"
).
m
)
frame_time
=
10e-3
if
exposure_time
<
10e-3
else
exposure_time
if
any
(
val
not
in
params
for
val
in
[
"Exposure"
,
"Frames"
]):
raise
DeviceError
(
"The input parameters 'Exposure' and 'Frames' are required in"
f
"scanner_input, got
{
params
.
keys
()
}
"
)
converted_exposure
=
units
.
Quantity
(
params
[
"Exposure"
]).
to
(
self
.
detector
.
get_value
(
"FrameTime"
,
key
=
UNIT
)
)
frame_time
=
(
10e-3
if
converted_exposure
<
(
1
/
MAX_ACQUISITION_rate
).
to
(
self
.
detector
.
get_value
(
"FrameTime"
,
key
=
UNIT
)
)
else
float
(
converted_exposure
.
m
)
)
self
.
detector
.
set_attribute
([
"FrameTime"
,
VALUE
],
frame_time
)
self
.
detector
.
set_attribute
([
"CountTime"
,
VALUE
],
exposure
_time
)
self
.
detector
.
set_attribute
([
"CountTime"
,
VALUE
],
float
(
converted_
exposure
.
m
)
)
frames_count
=
int
(
float
(
params
[
"Frames"
]))
total_frames
=
self
.
_recount_steps
(
parent_macro
,
scanner_input
)
*
frames_count
...
...
Dmitry Egorov
@dmitry.egorov
mentioned in commit
8bf185e6
·
Dec 12, 2022
mentioned in commit
8bf185e6
mentioned in commit 8bf185e61de4674b215fd9b9bf11371dd0abd8aa
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment