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
4cf72f2e
Commit
4cf72f2e
authored
May 20, 2022
by
Jerome Carnis
🦊
Browse files
deviceEigerP11.py: change constants to private, add docstring
parent
2ff29c4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamzik3/devices/deviceEigerP11.py
View file @
4cf72f2e
...
...
@@ -33,10 +33,10 @@ from kamzik3.macro.step import Step, StepDeviceMethod
from
kamzik3.snippets.snippetsDecorators
import
expose_method
FRAMES_PER_FILE_SCAN
=
1000
FRAMES_PER_FILE_LIVE
=
1000000
_
FRAMES_PER_FILE_SCAN
=
1000
_
FRAMES_PER_FILE_LIVE
=
1
_
000
_
000
# any large number is ok, images are not saved in the live-view mode
MAX_ACQUISITION_RATE
=
units
.
Quantity
(
100
,
"Hz"
)
_
MAX_ACQUISITION_RATE
=
units
.
Quantity
(
100
,
"Hz"
)
# according to Jan Meyer, 10ms is the lowest frame time
...
...
@@ -48,7 +48,12 @@ class InterfaceStatus(IntEnum):
class
TriggerMode
(
IntEnum
):
"""The trigger modes can be found in Eiger2 documentation (v1.5.0)."""
"""
The trigger modes can be found in Eiger2 documentation (v1.5.0).
Note that this mapping is valid only at P11, which uses a custom Tango device server
instead of what FS-EC provides.
"""
EXTE
=
0
EXTS
=
1
...
...
@@ -171,12 +176,12 @@ class DeviceTangoEigerDetector(DeviceTango):
)
converted_exposure
=
self
.
detector
.
to_device_unit
(
"FrameTime"
,
Exposure
)
min_frame_time
=
(
1
/
MAX_ACQUISITION_RATE
).
to
(
min_frame_time
=
(
1
/
_
MAX_ACQUISITION_RATE
).
to
(
self
.
get_value
(
"FrameTime"
,
key
=
UNIT
)
)
if
converted_exposure
<
min_frame_time
:
self
.
logger
.
error
(
f
"Can't acquire data faster than
{
MAX_ACQUISITION_RATE
}
, "
f
"Can't acquire data faster than
{
_
MAX_ACQUISITION_RATE
}
, "
"defaulting to it"
)
frame_time
=
min_frame_time
.
m
...
...
@@ -209,7 +214,7 @@ class DeviceTangoEigerDetector(DeviceTango):
[
"FileWriter"
,
"Mode"
,
VALUE
],
InterfaceStatus
.
DISABLED
.
value
)
self
.
set_attribute
(
[
"FileWriter"
,
"NimagesPerFile"
,
VALUE
],
FRAMES_PER_FILE_LIVE
[
"FileWriter"
,
"NimagesPerFile"
,
VALUE
],
_
FRAMES_PER_FILE_LIVE
)
if
self
.
eiger_stream
is
not
None
:
self
.
logger
.
info
(
"EigerStream disabled"
)
...
...
@@ -218,12 +223,12 @@ class DeviceTangoEigerDetector(DeviceTango):
)
converted_exposure
=
self
.
detector
.
to_device_unit
(
"FrameTime"
,
Exposure
)
min_frame_time
=
(
1
/
MAX_ACQUISITION_RATE
).
to
(
min_frame_time
=
(
1
/
_
MAX_ACQUISITION_RATE
).
to
(
self
.
get_value
(
"FrameTime"
,
key
=
UNIT
)
)
if
converted_exposure
<
min_frame_time
:
self
.
logger
.
error
(
f
"Can't acquire data faster than
{
MAX_ACQUISITION_RATE
}
, "
f
"Can't acquire data faster than
{
_
MAX_ACQUISITION_RATE
}
, "
"defaulting to it"
)
frame_time
=
min_frame_time
.
m
...
...
@@ -233,11 +238,11 @@ class DeviceTangoEigerDetector(DeviceTango):
self
.
set_attribute
([
"FrameTime"
,
VALUE
],
frame_time
)
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
.
set_attribute
([
"Nimages"
,
VALUE
],
_
FRAMES_PER_FILE_LIVE
)
self
.
Arm
()
self
.
Trigger
()
self
.
set_value
(
ATTR_FRAME_COUNT
,
self
.
get_value
(
ATTR_FRAME_COUNT
)
+
FRAMES_PER_FILE_LIVE
ATTR_FRAME_COUNT
,
self
.
get_value
(
ATTR_FRAME_COUNT
)
+
_
FRAMES_PER_FILE_LIVE
)
@
expose_method
()
...
...
@@ -389,7 +394,7 @@ class EigerSwScanner(DeviceScanner):
scanner_input
:
StepDeviceMethod
,
scanner_attributes
:
Dict
[
str
,
Any
],
parent_macro
:
Macro
,
):
)
->
StepDeviceMethod
:
if
kamzik3
.
session
is
None
:
raise
DeviceError
(
"kamzik session is None, can't get the device MacroServer"
...
...
@@ -430,12 +435,12 @@ class EigerSwScanner(DeviceScanner):
converted_exposure
=
units
.
Quantity
(
params
[
"Exposure"
]).
to
(
self
.
detector
.
get_value
(
"FrameTime"
,
key
=
UNIT
)
)
min_frame_time
=
(
1
/
MAX_ACQUISITION_RATE
).
to
(
min_frame_time
=
(
1
/
_
MAX_ACQUISITION_RATE
).
to
(
self
.
get_value
(
"FrameTime"
,
key
=
UNIT
)
)
if
converted_exposure
<
min_frame_time
:
self
.
logger
.
error
(
f
"Can't acquire data faster than
{
MAX_ACQUISITION_RATE
}
, "
f
"Can't acquire data faster than
{
_
MAX_ACQUISITION_RATE
}
, "
"defaulting to it"
)
frame_time
=
min_frame_time
.
m
...
...
@@ -461,7 +466,7 @@ class EigerSwScanner(DeviceScanner):
)
self
.
detector
.
set_attribute
([
"FileWriter"
,
"NamePattern"
,
VALUE
],
path
)
self
.
detector
.
set_attribute
(
[
"FileWriter"
,
"NimagesPerFile"
,
VALUE
],
FRAMES_PER_FILE_SCAN
[
"FileWriter"
,
"NimagesPerFile"
,
VALUE
],
_
FRAMES_PER_FILE_SCAN
)
self
.
detector
.
Arm
()
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