added get xy position to dsd

This commit is contained in:
2020-12-05 22:33:26 +01:00
parent 2e5dfce7aa
commit ad8a2cbf25
4 changed files with 60 additions and 20 deletions
+2 -2
View File
@@ -457,7 +457,7 @@ components = [
},
},
{
"args": ["SARES20-CAMS142-M2"],
"args": ["SARES20-CAMS142-M1"],
"name": "samplecam_sideview",
"z_und": 142,
"desc": "",
@@ -465,7 +465,7 @@ components = [
"kwargs": {},
},
{
"args": ["SARES20-CAMS142-M3"],
"args": ["SARES20-CAMS142-C3"],
"name": "samplecam_inline",
"z_und": 142,
"desc": "",
+12 -6
View File
@@ -1,4 +1,4 @@
from cam_server import CamClient,PipelineClient
from cam_server import CamClient, PipelineClient
from ..aliases import Alias, append_object_to_object
from .adjustable import PvRecord, PvEnum, AdjustableGetSet, AdjustableVirtual
from ..elements import Assembly
@@ -7,28 +7,31 @@ from .motors import MotorRecord
CAM_CLIENT = None
PIPELINE_CLIENT = None
def get_camclient():
global CAM_CLIENT
if not CAM_CLIENT:
CAM_CLIENT = CamClient()
return CAM_CLIENT
def get_pipelineclient():
global PIPELINE_CLIENT
if not PIPELINE_CLIENT:
PIPELINE_CLIENT = PipelineClient()
return PIPELINE_CLIENT
class CamserverConfig(Assembly):
def __init__(self, cam_id, camserver_alias=None, name=None):
super().__init__(name=name)
self.cam_id = cam_id
self.camserver_alias = camserver_alias
@property
@property
def cc(self):
return get_camclient()
@property
def pc(self):
return get_pipelineclient()
@@ -75,7 +78,7 @@ class CamserverConfig(Assembly):
self.set_config_fields(fields={"camera_calibration": calib})
def __repr__(self):
s = f"**Camera Server Config {self.camname} with Alias {self.name}**\n"
s = f"**Camera Server Config {self.cam_id} with Alias {self.name}**\n"
for key, item in self.get_current_value().items():
s += f"{key:20} : {item}\n"
return s
@@ -206,4 +209,7 @@ class CameraPCO(Assembly):
for ob, val in args:
ob(val)
self._set_parameters(1)
self.running(1)
False
False
+18 -8
View File
@@ -71,14 +71,24 @@ class Memory:
tmp(stat_now)
self.memories(mem)
def get_memory(self, index=None, key=None):
self.setup_path()
if not (index is None):
key = list(self.memories().keys())[index]
tmp = AdjustableFS(self.dir / Path(key + ".json"))
return tmp()
def get_memory(self, input=None, index=None, key=None):
if input:
if type(input) is dict:
return input
else:
tmp = AdjustableFS(Path(input))
return tmp()
else:
self.setup_path()
if not (index is None):
key = list(self.memories().keys())[index]
tmp = AdjustableFS(self.dir / Path(key + ".json"))
return tmp()
def recall(
self, input=None, memory_index=None, key=None, wait=True, show_changes_only=True
):
def recall(self, memory_index=None, key=None, wait=True, show_changes_only=True):
select = self.select_from_memory(
memory_index, show_changes_only=show_changes_only
)
@@ -138,7 +148,7 @@ class Memory:
continue
table.append([n, tselstr, key, present_value, comp_indicator, recall_value])
if len(table)==0:
if len(table) == 0:
return "No changes compared to memory!"
return tabulate(
table,
+28 -4
View File
@@ -9,6 +9,8 @@ from ..aliases import Alias, append_object_to_object
from ..elements.assembly import Assembly
from .profile_monitors import Pprm_dsd
from .intensity_monitors import SolidTargetDetectorPBPS_new_assembly
import numpy as np
class DownstreamDiagnostic(Assembly):
def __init__(
@@ -16,7 +18,29 @@ class DownstreamDiagnostic(Assembly):
name=None,
):
super().__init__(name=name)
self._append(MotorRecord, "SARES20-DSD:MOTOR_DSDX", name="xbase", is_setting=True)
self._append(MotorRecord, "SARES20-DSD:MOTOR_DSDY", name="ybase", is_setting=True)
self._append(Pprm_dsd, "SARES20-DSDPPRM", "SARES20-DSDPPRM", name="prof_dsd", is_setting=True, view_toplevel_only = False)
self._append(SolidTargetDetectorPBPS_new_assembly, pvname= "SARES20-DSDPBPS", name="mon_dsd", is_setting = True, view_toplevel_only=False)
self._append(
MotorRecord, "SARES20-DSD:MOTOR_DSDX", name="xbase", is_setting=True
)
self._append(
MotorRecord, "SARES20-DSD:MOTOR_DSDY", name="ybase", is_setting=True
)
self._append(
Pprm_dsd,
"SARES20-DSDPPRM",
"SARES20-DSDPPRM",
name="prof_dsd",
is_setting=True,
view_toplevel_only=False,
)
self._append(
SolidTargetDetectorPBPS_new_assembly,
pvname="SARES20-DSDPBPS",
name="mon_dsd",
is_setting=True,
view_toplevel_only=False,
)
def get_xyposition_for_kb_angles_in_rad(self, theta_kbver, theta_kbhor):
y = np.tan(2 * theta_kbver) * 7075
x = np.tan(2 * theta_kbhor) / np.cos(2 * theta_kbver) * 6325
return x, y