refactor: updated configs, minor improvements, formatting
This commit is contained in:
@@ -1,25 +1,15 @@
|
|||||||
"""
|
"""
|
||||||
Pre-startup script for BEC client. This script is executed before the BEC client
|
Pre-startup script for BEC client. This script is executed before the BEC client
|
||||||
is started. It can be used to set up the BEC client configuration. The script is
|
is started. It can be used to add additional command line arguments.
|
||||||
executed in the global namespace of the BEC client. This means that all
|
|
||||||
variables defined here are available in the BEC client.
|
|
||||||
|
|
||||||
To set up the BEC client configuration, use the ServiceConfig class. For example,
|
|
||||||
to set the configuration file path, add the following lines to the script:
|
|
||||||
|
|
||||||
import pathlib
|
|
||||||
from bec_lib.core import ServiceConfig
|
|
||||||
|
|
||||||
current_path = pathlib.Path(__file__).parent.resolve()
|
|
||||||
CONFIG_PATH = f"{current_path}/<path_to_my_config_file.yaml>"
|
|
||||||
|
|
||||||
config = ServiceConfig(CONFIG_PATH)
|
|
||||||
|
|
||||||
If this startup script defined a ServiceConfig object, the BEC client will use
|
|
||||||
it to configure itself. Otherwise, the BEC client will use the default config.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# example:
|
|
||||||
# current_path = pathlib.Path(__file__).parent.resolve()
|
def extend_command_line_args(parser):
|
||||||
# CONFIG_PATH = f"{current_path}/../../../bec_config.yaml"
|
"""
|
||||||
# config = ServiceConfig(CONFIG_PATH)
|
Extend the command line arguments of the BEC client.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# example:
|
||||||
|
# parser.add_argument("--session", help="Session name", type=str, default="my_default_session")
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
feyex:
|
feyex:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: D
|
axis_Id: D
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -18,7 +18,7 @@ feyex:
|
|||||||
out: -1
|
out: -1
|
||||||
feyey:
|
feyey:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: E
|
axis_Id: E
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -35,7 +35,7 @@ feyey:
|
|||||||
in: -10.467
|
in: -10.467
|
||||||
fheater:
|
fheater:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -50,7 +50,7 @@ fheater:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
flomni_samples:
|
flomni_samples:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniSampleStorage
|
deviceClass: csaxs_bec.devices.epics.devices.flomni_sample_storage.FlomniSampleStorage
|
||||||
deviceConfig: {}
|
deviceConfig: {}
|
||||||
enabled: true
|
enabled: true
|
||||||
onFailure: buffer
|
onFailure: buffer
|
||||||
@@ -58,7 +58,7 @@ flomni_samples:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
foptx:
|
foptx:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -75,7 +75,7 @@ foptx:
|
|||||||
in: -13.761
|
in: -13.761
|
||||||
fopty:
|
fopty:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: F
|
axis_Id: F
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -93,7 +93,7 @@ fopty:
|
|||||||
out: 0.752
|
out: 0.752
|
||||||
foptz:
|
foptz:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -110,7 +110,7 @@ foptz:
|
|||||||
in: 23
|
in: 23
|
||||||
fosax:
|
fosax:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: SmaractMotor
|
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -128,7 +128,7 @@ fosax:
|
|||||||
out: 5.3
|
out: 5.3
|
||||||
fosay:
|
fosay:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: SmaractMotor
|
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -145,7 +145,7 @@ fosay:
|
|||||||
in: 0.367
|
in: 0.367
|
||||||
fosaz:
|
fosaz:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: SmaractMotor
|
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -163,7 +163,7 @@ fosaz:
|
|||||||
out: 6
|
out: 6
|
||||||
fsamroy:
|
fsamroy:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FuprGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fupr_ophyd.FuprGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -178,7 +178,7 @@ fsamroy:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
fsamx:
|
fsamx:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: E
|
axis_Id: E
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -195,7 +195,7 @@ fsamx:
|
|||||||
in: -1.1
|
in: -1.1
|
||||||
fsamy:
|
fsamy:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: F
|
axis_Id: F
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -212,7 +212,7 @@ fsamy:
|
|||||||
in: 2.75
|
in: 2.75
|
||||||
ftracky:
|
ftracky:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: H
|
axis_Id: H
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -227,7 +227,7 @@ ftracky:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
ftrackz:
|
ftrackz:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: G
|
axis_Id: G
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -242,7 +242,7 @@ ftrackz:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
ftransx:
|
ftransx:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -257,7 +257,7 @@ ftransx:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
ftransy:
|
ftransy:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -272,7 +272,7 @@ ftransy:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
ftransz:
|
ftransz:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -287,7 +287,7 @@ ftransz:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
ftray:
|
ftray:
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: D
|
axis_Id: D
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -302,7 +302,7 @@ ftray:
|
|||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
rtx:
|
rtx:
|
||||||
description: flomni rt
|
description: flomni rt
|
||||||
deviceClass: RtFlomniMotor
|
deviceClass: csaxs_bec.devices.rt_lamni.rt_flomni_ophyd.RtFlomniMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -318,7 +318,7 @@ rtx:
|
|||||||
rt_pid_voltage: -0.06219
|
rt_pid_voltage: -0.06219
|
||||||
rty:
|
rty:
|
||||||
description: flomni rt
|
description: flomni rt
|
||||||
deviceClass: RtFlomniMotor
|
deviceClass: csaxs_bec.devices.rt_lamni.rt_flomni_ophyd.RtFlomniMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -332,7 +332,7 @@ rty:
|
|||||||
tomo_additional_offsety: 0
|
tomo_additional_offsety: 0
|
||||||
rtz:
|
rtz:
|
||||||
description: flomni rt
|
description: flomni rt
|
||||||
deviceClass: RtFlomniMotor
|
deviceClass: csaxs_bec.devices.rt_lamni.rt_flomni_ophyd.RtFlomniMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
|
|||||||
+22
-22
@@ -1,7 +1,7 @@
|
|||||||
fheater:
|
fheater:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -16,7 +16,7 @@ fheater:
|
|||||||
feyex:
|
feyex:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: D
|
axis_Id: D
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -34,7 +34,7 @@ feyex:
|
|||||||
feyey:
|
feyey:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: E
|
axis_Id: E
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -51,7 +51,7 @@ feyey:
|
|||||||
foptx:
|
foptx:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -68,7 +68,7 @@ foptx:
|
|||||||
fopty:
|
fopty:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: F
|
axis_Id: F
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -86,7 +86,7 @@ fopty:
|
|||||||
foptz:
|
foptz:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -103,7 +103,7 @@ foptz:
|
|||||||
fosax:
|
fosax:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: SmaractMotor
|
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -121,7 +121,7 @@ fosax:
|
|||||||
fosay:
|
fosay:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: SmaractMotor
|
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -138,7 +138,7 @@ fosay:
|
|||||||
fosaz:
|
fosaz:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: SmaractMotor
|
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -156,7 +156,7 @@ fosaz:
|
|||||||
fsamroy:
|
fsamroy:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FuprGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fupr_ophyd.FuprGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -171,7 +171,7 @@ fsamroy:
|
|||||||
fsamx:
|
fsamx:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: E
|
axis_Id: E
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -188,7 +188,7 @@ fsamx:
|
|||||||
fsamy:
|
fsamy:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: F
|
axis_Id: F
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -205,7 +205,7 @@ fsamy:
|
|||||||
ftracky:
|
ftracky:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: H
|
axis_Id: H
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -220,7 +220,7 @@ ftracky:
|
|||||||
ftrackz:
|
ftrackz:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: G
|
axis_Id: G
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -235,7 +235,7 @@ ftrackz:
|
|||||||
ftransx:
|
ftransx:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -250,7 +250,7 @@ ftransx:
|
|||||||
ftransy:
|
ftransy:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -265,7 +265,7 @@ ftransy:
|
|||||||
ftransz:
|
ftransz:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -280,7 +280,7 @@ ftransz:
|
|||||||
ftray:
|
ftray:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniGalilMotor
|
deviceClass: csaxs_bec.devices.galil.fgalil_ophyd.FlomniGalilMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: D
|
axis_Id: D
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -296,7 +296,7 @@ ftray:
|
|||||||
flomni_samples:
|
flomni_samples:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: phase plate angle
|
description: phase plate angle
|
||||||
deviceClass: FlomniSampleStorage
|
deviceClass: csaxs_bec.devices.epics.devices.FlomniSampleStorage
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
onFailure: buffer
|
onFailure: buffer
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -305,7 +305,7 @@ flomni_samples:
|
|||||||
rtx:
|
rtx:
|
||||||
readoutPriority: on_request
|
readoutPriority: on_request
|
||||||
description: flomni rt
|
description: flomni rt
|
||||||
deviceClass: RtFlomniMotor
|
deviceClass: csaxs_bec.devices.rt_lamni.rt_flomni_ophyd.RtFlomniMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: A
|
axis_Id: A
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -317,7 +317,7 @@ rtx:
|
|||||||
rty:
|
rty:
|
||||||
readoutPriority: on_request
|
readoutPriority: on_request
|
||||||
description: flomni rt
|
description: flomni rt
|
||||||
deviceClass: RtFlomniMotor
|
deviceClass: csaxs_bec.devices.rt_lamni.rt_flomni_ophyd.RtFlomniMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: B
|
axis_Id: B
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
@@ -329,7 +329,7 @@ rty:
|
|||||||
rtz:
|
rtz:
|
||||||
readoutPriority: on_request
|
readoutPriority: on_request
|
||||||
description: flomni rt
|
description: flomni rt
|
||||||
deviceClass: RtFlomniMotor
|
deviceClass: csaxs_bec.devices.rt_lamni.rt_flomni_ophyd.RtFlomniMotor
|
||||||
deviceConfig:
|
deviceConfig:
|
||||||
axis_Id: C
|
axis_Id: C
|
||||||
host: mpc2844.psi.ch
|
host: mpc2844.psi.ch
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,304 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Created on Wed Oct 13 18:06:15 2021
|
||||||
|
|
||||||
|
@author: mohacsi_i
|
||||||
|
|
||||||
|
IMPORTANT: Virtual monochromator axes should be implemented already in EPICS!!!
|
||||||
|
"""
|
||||||
|
|
||||||
|
import time
|
||||||
|
from math import asin, atan, isclose, sin, sqrt, tan
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from ophyd import (
|
||||||
|
Component,
|
||||||
|
Device,
|
||||||
|
EpicsMotor,
|
||||||
|
EpicsSignal,
|
||||||
|
EpicsSignalRO,
|
||||||
|
Kind,
|
||||||
|
PseudoPositioner,
|
||||||
|
PseudoSingle,
|
||||||
|
PVPositioner,
|
||||||
|
Signal,
|
||||||
|
)
|
||||||
|
from ophyd.pseudopos import pseudo_position_argument, real_position_argument
|
||||||
|
|
||||||
|
|
||||||
|
class PmMonoBender(PseudoPositioner):
|
||||||
|
"""Monochromator bender
|
||||||
|
|
||||||
|
Small wrapper to combine the four monochromator bender motors.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Real axes
|
||||||
|
ai = Component(EpicsMotor, "TRYA", name="ai")
|
||||||
|
bo = Component(EpicsMotor, "TRYB", name="bo")
|
||||||
|
co = Component(EpicsMotor, "TRYC", name="co")
|
||||||
|
di = Component(EpicsMotor, "TRYD", name="di")
|
||||||
|
|
||||||
|
# Virtual axis
|
||||||
|
bend = Component(PseudoSingle, name="bend")
|
||||||
|
|
||||||
|
_real = ["ai", "bo", "co", "di"]
|
||||||
|
|
||||||
|
@pseudo_position_argument
|
||||||
|
def forward(self, pseudo_pos):
|
||||||
|
delta = pseudo_pos.bend - 0.25 * (
|
||||||
|
self.ai.position + self.bo.position + self.co.position + self.di.position
|
||||||
|
)
|
||||||
|
return self.RealPosition(
|
||||||
|
ai=self.ai.position + delta,
|
||||||
|
bo=self.bo.position + delta,
|
||||||
|
co=self.co.position + delta,
|
||||||
|
di=self.di.position + delta,
|
||||||
|
)
|
||||||
|
|
||||||
|
@real_position_argument
|
||||||
|
def inverse(self, real_pos):
|
||||||
|
return self.PseudoPosition(
|
||||||
|
bend=0.25 * (real_pos.ai + real_pos.bo + real_pos.co + real_pos.di)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def r2d(radians):
|
||||||
|
return radians * 180 / 3.141592
|
||||||
|
|
||||||
|
|
||||||
|
def d2r(degrees):
|
||||||
|
return degrees * 3.141592 / 180.0
|
||||||
|
|
||||||
|
|
||||||
|
class PmDetectorRotation(PseudoPositioner):
|
||||||
|
"""Detector rotation pseudo motor
|
||||||
|
|
||||||
|
Small wrapper to convert detector pusher position to rotation angle.
|
||||||
|
"""
|
||||||
|
|
||||||
|
_tables_dt_push_dist_mm = 890
|
||||||
|
# Real axes
|
||||||
|
dtpush = Component(EpicsMotor, "", name="dtpush")
|
||||||
|
|
||||||
|
# Virtual axis
|
||||||
|
dtth = Component(PseudoSingle, name="dtth")
|
||||||
|
|
||||||
|
_real = ["dtpush"]
|
||||||
|
|
||||||
|
@pseudo_position_argument
|
||||||
|
def forward(self, pseudo_pos):
|
||||||
|
return self.RealPosition(
|
||||||
|
dtpush=d2r(tan(-3.14 / 180 * pseudo_pos.dtth)) * self._tables_dt_push_dist_mm
|
||||||
|
)
|
||||||
|
|
||||||
|
@real_position_argument
|
||||||
|
def inverse(self, real_pos):
|
||||||
|
return self.PseudoPosition(dtth=r2d(-atan(real_pos.dtpush / self._tables_dt_push_dist_mm)))
|
||||||
|
|
||||||
|
|
||||||
|
class GirderMotorX1(PVPositioner):
|
||||||
|
"""Girder X translation pseudo motor"""
|
||||||
|
|
||||||
|
setpoint = Component(EpicsSignal, ":X_SET", name="sp")
|
||||||
|
readback = Component(EpicsSignalRO, ":X1", name="rbv")
|
||||||
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
|
class GirderMotorY1(PVPositioner):
|
||||||
|
"""Girder Y translation pseudo motor"""
|
||||||
|
|
||||||
|
setpoint = Component(EpicsSignal, ":Y_SET", name="sp")
|
||||||
|
readback = Component(EpicsSignalRO, ":Y1", name="rbv")
|
||||||
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
|
class GirderMotorYAW(PVPositioner):
|
||||||
|
"""Girder YAW pseudo motor"""
|
||||||
|
|
||||||
|
setpoint = Component(EpicsSignal, ":YAW_SET", name="sp")
|
||||||
|
readback = Component(EpicsSignalRO, ":YAW1", name="rbv")
|
||||||
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
|
class GirderMotorROLL(PVPositioner):
|
||||||
|
"""Girder ROLL pseudo motor"""
|
||||||
|
|
||||||
|
setpoint = Component(EpicsSignal, ":ROLL_SET", name="sp")
|
||||||
|
readback = Component(EpicsSignalRO, ":ROLL1", name="rbv")
|
||||||
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
|
class GirderMotorPITCH(PVPositioner):
|
||||||
|
"""Girder YAW pseudo motor"""
|
||||||
|
|
||||||
|
setpoint = Component(EpicsSignal, ":PITCH_SET", name="sp")
|
||||||
|
readback = Component(EpicsSignalRO, ":PITCH1", name="rbv")
|
||||||
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
|
class VirtualEpicsSignalRO(EpicsSignalRO):
|
||||||
|
"""This is a test class to create derives signals from one or
|
||||||
|
multiple original signals...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def calc(self, val):
|
||||||
|
return val
|
||||||
|
|
||||||
|
def get(self, *args, **kwargs):
|
||||||
|
raw = super().get(*args, **kwargs)
|
||||||
|
return self.calc(raw)
|
||||||
|
|
||||||
|
|
||||||
|
class MonoTheta1(VirtualEpicsSignalRO):
|
||||||
|
"""Converts the pusher motor position to theta angle"""
|
||||||
|
|
||||||
|
_mono_a0_enc_scale1 = -1.0
|
||||||
|
_mono_a1_lever_length1 = 206.706
|
||||||
|
_mono_a2_pusher_offs1 = 6.85858
|
||||||
|
_mono_a3_enc_offs1 = -16.9731
|
||||||
|
|
||||||
|
def calc(self, val):
|
||||||
|
asin_arg = (val - self._mono_a2_pusher_offs1) / self._mono_a1_lever_length1
|
||||||
|
theta1 = (
|
||||||
|
self._mono_a0_enc_scale1 * asin(asin_arg) / 3.141592 * 180.0 + self._mono_a3_enc_offs1
|
||||||
|
)
|
||||||
|
return theta1
|
||||||
|
|
||||||
|
|
||||||
|
class MonoTheta2(VirtualEpicsSignalRO):
|
||||||
|
"""Converts the pusher motor position to theta angle"""
|
||||||
|
|
||||||
|
_mono_a3_enc_offs2 = -19.7072
|
||||||
|
_mono_a2_pusher_offs2 = 5.93905
|
||||||
|
_mono_a1_lever_length2 = 206.572
|
||||||
|
_mono_a0_enc_scale2 = -1.0
|
||||||
|
|
||||||
|
def calc(self, val):
|
||||||
|
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
||||||
|
theta2 = (
|
||||||
|
self._mono_a0_enc_scale2 * asin(asin_arg) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
|
||||||
|
)
|
||||||
|
return theta2
|
||||||
|
|
||||||
|
|
||||||
|
MONO_THETA2_OFFSETS_FILENAME = (
|
||||||
|
"/sls/X12SA/data/gac-x12saop/spec/macros/spec_data/mono_th2_offsets.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EnergyKev(VirtualEpicsSignalRO):
|
||||||
|
"""Converts the pusher motor position to energy in keV"""
|
||||||
|
|
||||||
|
_mono_add_offs = True
|
||||||
|
_mono_a3_enc_offs2 = -19.7072
|
||||||
|
_mono_a2_pusher_offs2 = 5.93905
|
||||||
|
_mono_a1_lever_length2 = 206.572
|
||||||
|
_mono_a0_enc_scale2 = -1.0
|
||||||
|
_mono_hce = 12.39852066
|
||||||
|
_mono_2d2 = 2 * 5.43102 / sqrt(3)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self._th2_offsets = np.loadtxt(MONO_THETA2_OFFSETS_FILENAME)
|
||||||
|
|
||||||
|
def _mono_get_th2_offs(self, energy_keV):
|
||||||
|
if self._th2_offsets is None:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
max_offs = np.max(self._th2_offsets[:, 1])
|
||||||
|
|
||||||
|
if max_offs > 0.2:
|
||||||
|
raise ValueError(
|
||||||
|
f"\nThe empirical moth2 corrections are as high as {max_offs} deg\nThis is unreasonable and the corrections will not be used.\n\n***PLEASE INFORM BEAMLINE SCIENTISTS***\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
offs = np.interp(energy_keV, self._th2_offsets[:, 0], self._th2_offsets[:, 1])
|
||||||
|
# print(offs)
|
||||||
|
return offs
|
||||||
|
|
||||||
|
def calc(self, val):
|
||||||
|
_mono_sintheta2_to_Ekev = -self._mono_hce / self._mono_2d2
|
||||||
|
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
||||||
|
theta2_deg = (
|
||||||
|
self._mono_a0_enc_scale2 * asin(asin_arg) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
|
||||||
|
)
|
||||||
|
E_keV = _mono_sintheta2_to_Ekev / sin(theta2_deg / 180.0 * 3.141592)
|
||||||
|
|
||||||
|
if self._mono_add_offs:
|
||||||
|
theta2_deg -= self._mono_get_th2_offs(E_keV)
|
||||||
|
E_keV = _mono_sintheta2_to_Ekev / sin(theta2_deg / 180.0 * 3.141592)
|
||||||
|
return E_keV
|
||||||
|
|
||||||
|
|
||||||
|
class CurrentSum(Signal):
|
||||||
|
"""Adds up four current signals from the parent"""
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.parent.ch1.subscribe(self._emit_value)
|
||||||
|
|
||||||
|
def _emit_value(self, **kwargs):
|
||||||
|
timestamp = kwargs.pop("timestamp", time.time())
|
||||||
|
self.wait_for_connection()
|
||||||
|
self._run_subs(sub_type="value", timestamp=timestamp, obj=self)
|
||||||
|
|
||||||
|
def get(self, *args, **kwargs):
|
||||||
|
# self.parent._cnt.set(1).wait()
|
||||||
|
self._metadata["timestamp"] = time.time()
|
||||||
|
total = (
|
||||||
|
self.parent.ch1.get()
|
||||||
|
+ self.parent.ch2.get()
|
||||||
|
+ self.parent.ch3.get()
|
||||||
|
+ self.parent.ch4.get()
|
||||||
|
)
|
||||||
|
return total
|
||||||
|
|
||||||
|
|
||||||
|
class Bpm4i(Device):
|
||||||
|
SUB_VALUE = "value"
|
||||||
|
_default_sub = SUB_VALUE
|
||||||
|
_cont = Component(EpicsSignal, "CONT", put_complete=True, kind=Kind.omitted)
|
||||||
|
_cnt = Component(EpicsSignal, "CNT", put_complete=True, kind=Kind.omitted)
|
||||||
|
ch1 = Component(EpicsSignalRO, "S2", auto_monitor=True, kind=Kind.omitted, name="ch1")
|
||||||
|
ch2 = Component(EpicsSignalRO, "S3", auto_monitor=True, kind=Kind.omitted, name="ch2")
|
||||||
|
ch3 = Component(EpicsSignalRO, "S4", auto_monitor=True, kind=Kind.omitted, name="ch3")
|
||||||
|
ch4 = Component(EpicsSignalRO, "S5", auto_monitor=True, kind=Kind.omitted, name="ch4")
|
||||||
|
sum = Component(CurrentSum, kind=Kind.hinted, name="sum")
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
prefix="",
|
||||||
|
*,
|
||||||
|
name,
|
||||||
|
kind=None,
|
||||||
|
read_attrs=None,
|
||||||
|
configuration_attrs=None,
|
||||||
|
parent=None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
|
super().__init__(
|
||||||
|
prefix,
|
||||||
|
name=name,
|
||||||
|
kind=kind,
|
||||||
|
read_attrs=read_attrs,
|
||||||
|
configuration_attrs=configuration_attrs,
|
||||||
|
parent=parent,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
self.sum.name = self.name
|
||||||
|
# Ensure the scaler counts automatically
|
||||||
|
self._cont.wait_for_connection()
|
||||||
|
self._cont.set(1).wait()
|
||||||
|
self.ch1.subscribe(self._emit_value)
|
||||||
|
|
||||||
|
def _emit_value(self, **kwargs):
|
||||||
|
timestamp = kwargs.pop("timestamp", time.time())
|
||||||
|
self.wait_for_connection()
|
||||||
|
self._run_subs(sub_type=self.SUB_VALUE, timestamp=timestamp, obj=self)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
dut = Bpm4i("X12SA-OP1-SCALER.", name="bpm4")
|
||||||
|
dut.wait_for_connection()
|
||||||
|
print(dut.read())
|
||||||
|
print(dut.describe())
|
||||||
+2
-1
@@ -24,7 +24,8 @@ plugin_bec = "csaxs_bec"
|
|||||||
plugin_scans = "csaxs_bec.scans"
|
plugin_scans = "csaxs_bec.scans"
|
||||||
|
|
||||||
[project.entry-points."bec.ipython_client"]
|
[project.entry-points."bec.ipython_client"]
|
||||||
plugin_ipython_client = "csaxs_bec.bec_ipython_client"
|
plugin_ipython_client_pre = "simulations_bec.bec_ipython_client.startup.pre_startup"
|
||||||
|
plugin_ipython_client_post = "simulations_bec.bec_ipython_client.startup"
|
||||||
|
|
||||||
[project.entry-points."bec.widgets"]
|
[project.entry-points."bec.widgets"]
|
||||||
plugin_widgets = "csaxs_bec.bec_widgets"
|
plugin_widgets = "csaxs_bec.bec_widgets"
|
||||||
|
|||||||
Reference in New Issue
Block a user