added more components
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import numpy as np
|
||||
from epics import caget
|
||||
|
||||
from cam_server import PipelineClient
|
||||
from cam_server.utils import get_host_port_from_stream_address
|
||||
from bsread import source, SUB
|
||||
|
||||
|
||||
_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:
|
||||
@@ -28,6 +34,38 @@ class CameraCA:
|
||||
return i.reshape(h,w)
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,9 +12,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
|
||||
@@ -134,6 +135,10 @@ class MotorRecord:
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __call__(self,value,*args,**kwargs):
|
||||
self.changeTo(value,*args,**kqwargs)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)])
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
class GasDetector:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
class SolidTargetDetector:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user