Did something on elog

This commit is contained in:
Roman Mankowsky
2017-11-13 15:06:52 +01:00
24 changed files with 197 additions and 11 deletions
+3
View File
@@ -0,0 +1,3 @@
__pycache__/
*.pyc
*.swp
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
import pyscan
+6 -1
View File
@@ -104,6 +104,11 @@ aliases = {
'alias' : 'MonAtt',
'z_und' : 138,
'desc' : 'Intensity/Position monitor after Attenuator'},
'SAROP21-PPRM138' : {
'alias' : 'ProfAtt',
'z_und' : 138,
'desc' : 'Profile monitor after Attenuator',
'eco_type' : 'xdiagnostics.profile_monitors.Pprm'},
'SAROP21-OKBV139' : {
'alias' : 'KbVer',
'z_und' : 139,
@@ -122,7 +127,7 @@ aliases = {
'SARES20-PROF142-M1' : {
'alias' : 'Xeye',
'z_und' : 142,
'desc' : 'General purpose station',
'desc' : 'Mobile X-ray eye in Bernina hutch',
'eco_type' : 'xdiagnostics.profile_monitors.Bernina_XEYE'},
'SLAAR21-LMOT' : {
'alias' : 'LasExp',
Binary file not shown.
+53 -3
View File
@@ -1,14 +1,22 @@
import numpy as np
from epics import caget
from epics import PV
from cam_server import PipelineClient
from cam_server.utils import get_host_port_from_stream_address
from bsread import source, SUB
import subprocess
_cameraArrayTypes = ['monochrome','rgb']
class CameraCA:
def __init__(self, pvname, cameraArrayType='monochrome'):
def __init__(self, pvname, cameraArrayType='monochrome',elog=None):
self.Id = pvname
self.isBS = False
self.px_height = None
self.px_width = None
self.elog = elog
def get_px_height(self):
if not self.px_height:
@@ -26,8 +34,50 @@ class CameraCA:
numpix = int(caget(self.Id+':FPICTURE.NORD'))
i = caget(self.Id+':FPICTURE', count=numpix)
return i.reshape(h,w)
def gui(self, guiType='xdm'):
""" Adjustable convention"""
cmd = ['caqtdm','-macro']
cmd.append('\"NAME=%s,CAMNAME=%s\"'%(self.Id, self.Id))
cmd.append('/sf/controls/config/qt/Camera/CameraMiniView.ui')
return subprocess.Popen(' '.join(cmd),shell=True)
#/sf/controls/config/qt/Camera/CameraMiniView.ui" with macro "NAME=SAROP21-PPRM138,CAMNAME=SAROP21-PPRM138
class CameraBS:
def __init__(self,Id,elog):
# First create the pipeline for the selected camera.
client = PipelineClient()
self._instance_id, self._stream_address = \
client.create_instance_from_config(\
{"camera_name": Id})
# Extract the stream host and port from the stream_address.
self._stream_host, self._stream_port = \
get_host_port_from_stream_address(stream_address)
self.checkServer()
def checkServer(self):
# Check if your instance is running on the server.
if self._instance_id not in client.get_server_info()["active_instances"]:
raise ValueError("Requested pipeline is not running.")
def get_message(self):
# Open connection to the stream. When exiting the 'with' section, the source disconnects by itself.
with source(host=self._stream_host, port=self._stream_port, mode=SUB) as input_stream:
input_stream.connect()
# Read one message.
message = input_stream.receive()
# Print out the received stream data - dictionary.
# print("Dictionary with data:\n", message.data.data)
# Print out the X center of mass.
# print("X center of mass: ", message.data.data["x_center_of_mass"].value)
return message.data
+22 -6
View File
@@ -1,6 +1,7 @@
from ..eco_epics.motor import Motor as _Motor
import subprocess
from threading import Thread
from epics import PV
_MotorRocordStandardProperties = \
{}
@@ -12,9 +13,10 @@ def _keywordChecker(kw_key_list_tups):
assert tkey in tlist, "Keyword %s should be one of %s"%(tkw,tlist)
class MotorRecord:
def __init__(self,pvname):
def __init__(self,pvname, elog=None):
self.Id = pvname
self._motor = _Motor(pvname)
self._elog = elog
# Conventional methods and properties for all Adjustable objects
@@ -39,15 +41,15 @@ class MotorRecord:
pass
def get_current_value(self,posType='user'):
def get_current_value(self,posType='user',readback=True):
""" Adjustable convention"""
_keywordChecker([('posType',posType,_posTypes)])
if posType == 'user':
return self._motor.get_position()
return self._motor.get_position( readback=readback)
if posType == 'dial':
return self._motor.get_position(dial=True)
return self._motor.get_position( readback=readback, dial=True)
if posType == 'raw':
return self._motor.get_position(raw=True)
return self._motor.get_position( readback=readback, raw=True)
def set_current_value(self,value,posType='user'):
""" Adjustable convention"""
@@ -79,6 +81,12 @@ class MotorRecord:
""" Adjustable convention"""
pass
def get_moveDone(self):
""" Adjustable convention"""
""" 0: moving 1: move done"""
return PV(str(self.Id+".DMOV")).value
def set_limits(self, values, posType='user', relative_to_present=False):
""" Adjustable convention"""
_keywordChecker([('posType',posType,_posTypes)])
@@ -121,7 +129,11 @@ class MotorRecord:
def wm(self,*args,**kwargs):
return self.get_current_value(*args,**kwargs)
def mvr(self,value,*args,**kwargs):
startvalue = self.get_current_value(*args,**kwargs)
if(self.get_moveDone == 1):
startvalue = self.get_current_value(readback=True,*args,**kwargs)
else:
startvalue = self.get_current_value(readback=False,*args,**kwargs)
self._currentChange = self.changeTo(value+startvalue,*args,**kwargs)
def wait(self):
self._currentChange.wait()
@@ -134,6 +146,10 @@ class MotorRecord:
def __repr__(self):
return self.__str__()
def __call__(self,value,*args,**kwargs):
self.changeTo(value,*args,**kqwargs)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -18,6 +18,7 @@ def _attach_device(devDict,devId):
print(istr)
exec(istr)
tdev = eval('_%s(Id=\'%s\')'%(eco_type_name,devId))
tdev.name = dev_alias
globals().update([(dev_alias,tdev)])
+18
View File
@@ -0,0 +1,18 @@
from ..devices_general.motors import MotorRecord
from epics import PV
class Laser_Exp:
def __init__(self,Id):
self.Id = Id
### Mirrors used in the expeirment ###
try:
self.phi = MotorRecord(Id+'-M517:MOT')
except:
print('No Standa steering phi mirror')
pass
try:
self.th = MotorRecord(Id+'-M518:MOT')
except:
print('No Standa steering theta mirror')
pass
+18
View File
@@ -0,0 +1,18 @@
from ..devices_general.motors import MotorRecord
from epics import PV
class Laser_Exp:
def __init__(self,Id):
self.Id = Id
### Mirrors used in the expeirment ###
try:
self.phi = MotorRecord(Id+'-M517:MOT')
except:
print('No Standa steering phi mirror')
pass
try:
self.th = MotorRecord(Id+'-M518:MOT')
except:
print('No Standa steering theta mirror')
pass
Binary file not shown.
Binary file not shown.
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
class GasDetector:
def __init__(self):
pass
class SolidTargetDetector:
def __init__(self):
pass
Binary file not shown.
+21 -1
View File
@@ -1,7 +1,27 @@
from ..devices_general.motors import MotorRecord
class AttenuatorAramis:
def __init__(idpv='SAROP-OATT135'):
def __init__(Id,elog=None):
self.Id = Id
pass
def __call__():
pass
def __str__():
pass
def __status__():
def updateE():
pass
def set_transmission(self,value):
pass
def setE():
pass
def get_transmission(self,E=current):
pass
+14
View File
@@ -0,0 +1,14 @@
class OffsetMirror:
def __init__(self,Id,deflection='up',elog=None):
self.elog = elog
self.deflection = deflection
if deflection is 'up':
self.x
def out(self):
pass
def in(self):
pass
View File
+29
View File
@@ -0,0 +1,29 @@
from ..devices_general.motors import MotorRecord
class SlitJJ(Id,elog=None):
def __init__():
pass
def set_hg(self,value):
pass
def set_vg(self,value):
pass
def set_ho(self,value):
pass
def set_vo(self,value):
pass
def set_gap(self,hor,ver):
pass
def set_offs(self,hor,ver):
pass
def __call__(self,*args):
self.set_gap(*args)