cleaned up cameras
This commit is contained in:
@@ -1,94 +1,40 @@
|
||||
from slic.core.adjustable import PVAdjustable
|
||||
from slic.core.device import Device
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.devices.general.detectors import CameraCA, CameraBS
|
||||
from slic.utils.deprecated.aliases import Alias, append_object_to_object
|
||||
|
||||
|
||||
def addMotorToSelf(self, ID=None, name=None):
|
||||
self.__dict__[name] = Motor(ID, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
class CameraSigma(Device):
|
||||
|
||||
def __init__(self, zoomstage_pvs=None, camera_pv=None, bshost=None, bsport=None, name="Sigma objective", **kwargs):
|
||||
super().__init__("SIGMA", name=name, **kwargs)
|
||||
|
||||
#def addPvRecordToSelf(
|
||||
# self, name=None, pvname_setvalue=None, pvname_readback=None, accuracy=None
|
||||
#):
|
||||
# self.__dict__[name] = PVAdjustable(
|
||||
# pvname_setvalue, pvname_readback=pvname_readback, accuracy=accuracy, name=name
|
||||
# )
|
||||
# self.alias.append(self.__dict__[name].alias)
|
||||
|
||||
|
||||
class Sigma:
|
||||
|
||||
def __init__(
|
||||
self, camera_pv=None, zoomstage_pvs={"set_value": "SARES20-OPSI:MOT_SP", "readback": "SEARES20-OPSI:MOT_RB",}, bshost=None, bsport=None, name=None,
|
||||
):
|
||||
self.alias = Alias(name)
|
||||
|
||||
self.name = name
|
||||
|
||||
append_object_to_object
|
||||
if zoomstage_pvs:
|
||||
append_object_to_object(self, PVAdjustable, zoomstage_pvs["set_value"], pvname_readback=zoomstage_pvs["readback"], name="zoom")
|
||||
self.zoom = PVAdjustable(zoomstage_pvs["set_value"], zoomstage_pvs["readback"])
|
||||
|
||||
try:
|
||||
if camera_pv:
|
||||
self.cam = CameraCA(camera_pv)
|
||||
except:
|
||||
print("Sigma Cam not found")
|
||||
pass
|
||||
|
||||
if bshost:
|
||||
self.camBS = CameraBS(host=bshost, port=bsport)
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
ostr = "*****Qioptic motor positions******\n"
|
||||
|
||||
for tkey, item in self.__dict__.items():
|
||||
if hasattr(item, "get_current_value"):
|
||||
pos = item.get_current_value()
|
||||
ostr += " " + tkey.ljust(17) + " : % 14g\n" % pos
|
||||
return ostr
|
||||
class CameraQioptiq:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
class Qioptiq:
|
||||
|
||||
def __init__(self, camera_pv=None, zoomstage_pv=None, bshost=None, bsport=None, name=None):
|
||||
self.alias = Alias(name)
|
||||
|
||||
self.name = name
|
||||
def __init__(self, zoomstage_pv=None, focusstage_pv=None, camera_pv=None, bshost=None, bsport=None, name="Qioptic sample viewer", **kwargs):
|
||||
super().__init__("QIOPTIQ", name=name, **kwargs)
|
||||
|
||||
if zoomstage_pv:
|
||||
append_object_to_object(self, Motor, zoomstage_pv, name="zoom")
|
||||
self.zoom = Motor(zoomstage_pv)
|
||||
|
||||
try:
|
||||
addMotorToSelf(self, ID="SARES20-EXP:MOT_QIOPT_F", name="focus")
|
||||
if focusstage_pv:
|
||||
self.focus = Motor(focusstage_pv)
|
||||
|
||||
except:
|
||||
print("Qioptic focus motor not found")
|
||||
pass
|
||||
try:
|
||||
if camera_pv:
|
||||
self.cam = CameraCA(camera_pv)
|
||||
except:
|
||||
print("Qioptic Cam not found")
|
||||
pass
|
||||
|
||||
if bshost:
|
||||
self.camBS = CameraBS(host=bshost, port=bsport)
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
ostr = "*****Qioptic motor positions******\n"
|
||||
|
||||
for tkey, item in self.__dict__.items():
|
||||
if hasattr(item, "get_current_value"):
|
||||
pos = item.get_current_value()
|
||||
ostr += " " + tkey.ljust(17) + " : % 14g\n" % pos
|
||||
return ostr
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user