...
 
Commits (108)
stages:
- build
- deploy
build-noarch:
stage: build
script:
- conda build ./conda --prefix-length=80 --output-folder=dist/ -c tango-controls --channel=http://bcu-ci.esrf.fr/stable
artifacts:
paths:
- dist/
tags:
- conda
deploy_devel:
stage: deploy
environment:
name: devel/$CI_COMMIT_REF_NAME
url: http://bcu-ci.esrf.fr/devel
dependencies:
- build-noarch
script:
- cp -Rf dist/* /conda-devel/
- conda index /conda-devel/
tags:
- conda
- linux
only:
- branches
except:
- stable
when: manual
deploy_stable:
stage: deploy
environment:
name: production
url: http://bcu-ci.esrf.fr/stable
dependencies:
- build-noarch
script:
- cp -Rf dist/* /conda/
- conda index /conda/
tags:
- conda
- linux
only:
- tags
- stable
......@@ -31,6 +31,7 @@ if (LIMA_ENABLE_PYTHON)
install(FILES LimaViewer.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(FILES AttrHelper.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(FILES EnvHelper.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(DIRECTORY camera DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(FILES EdfFile.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(FILES camera/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server/camera")
install(DIRECTORY plugins DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
endif()
This diff is collapsed.
This diff is collapsed.
......@@ -31,6 +31,12 @@ import functools
import PyTango
try:
import pkg_resources
except ImportError:
pkg_resources = None
ModDepend = ['Core', 'Espia']
Debug = 0
LimaDir = None
......@@ -51,10 +57,7 @@ def get_server_name(argv=None):
"""
if argv is None:
argv = sys.argv
full_exec_name = argv[0]
exec_name = os.path.split(full_exec_name)[-1]
exec_name = os.path.splitext(exec_name)[0]
return "/".join((exec_name, argv[1]))
return 'LimaCCDs/' + argv[1]
def get_device_class_map(server=None, cache=True):
"""
......@@ -384,7 +387,7 @@ def to_tango_object(ct, name_id):
return setattr(self.__dict__["__ct"], name, value)
def __dir__(self):
return dir(self.__dict__["__ct"]) + keys
return dir(self.__dict__["__ct"]) + list(keys)
def __reduce__(self):
import PyTango.client
......@@ -442,3 +445,40 @@ def create_tango_objects(ct_control, name_template):
tango_ct_map[tango_ct_control_name] = tango_ct_control, tango_object
return server, tango_ct_map
def _import(name):
__import__(name)
return sys.modules[name]
def get_entry_point(group, name):
# try to find an extension using setuptools entry points
if pkg_resources is None:
return None
entry_points = tuple(pkg_resources.iter_entry_points(group, name))
if not entry_points:
return None
elif len(entry_points) > 1:
raise ValueError('found more than one entry point matching {}'.format(name))
return entry_points[0]
def get_camera_module(name):
"""Returns the python module for the given camera type"""
entry_point = get_entry_point('Lima_tango_camera', name)
if entry_point is None:
# fallback to search in local camera directory
mod_name = 'Lima.Server.camera.{}'.format(name)
return _import(mod_name)
return entry_point.load()
def get_plugin_module(name):
"""Returns the python module for the given plugin type"""
entry_point = get_entry_point('Lima_tango_plugin', name)
if entry_point is None:
# fallback to search in local plugins directory
mod_name = 'Lima.Server.plugins.{}'.format(name)
return _import(mod_name)
return entry_point.load()
This diff is collapsed.
......@@ -254,10 +254,10 @@ def main():
U.server_init()
U.server_run()
except PyTango.DevFailed,e:
print '-------> Received a DevFailed exception:',e
except Exception,e:
print '-------> An unforeseen exception occured....',e
except PyTango.DevFailed as e:
print('-------> Received a DevFailed exception:',e)
except Exception as e:
print('-------> An unforeseen exception occured....',e)
if __name__ == '__main__':
main()
This diff is collapsed.
This diff is collapsed.
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
#=============================================================================
#
# file : Basler.py
#
# description : Python source for the Basler and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# Pilatus are implemented in this file.
#
# project : TANGO Device Server
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# (c) - Bliss - ESRF
#=============================================================================
#
import PyTango
from Lima import Core
from Lima import Basler as BaslerAcq
from Lima.Server import AttrHelper
class Basler(PyTango.Device_4Impl):
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,*args) :
PyTango.Device_4Impl.__init__(self,*args)
self.init_device()
self.__Attribute2FunctionBase = {
}
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
#use AttrHelper
return AttrHelper.get_attr_string_value_list(self, attr_name)
#==================================================================
#
# Basler read/write attribute methods
#
#==================================================================
def __getattr__(self,name) :
#use AttrHelper
return AttrHelper.get_attr_4u(self,name,_BaslerCam)
#==================================================================
#
# BaslerClass class definition
#
#==================================================================
class BaslerClass(PyTango.DeviceClass):
class_property_list = {}
device_property_list = {
# define one and only one of the following 4 properties:
'camera_id':
[PyTango.DevString,
"Camera ID", None],
'cam_ip_address':
[PyTango.DevString,
"Camera ip address",[]],
'serial_number':
[PyTango.DevString,
"Camera serial number", None],
'user_name':
[PyTango.DevString,
"Camera user name", None],
'inter_packet_delay':
[PyTango.DevLong,
"Inter Packet Delay",0],
'frame_transmission_delay':
[PyTango.DevLong,
"Frame Transmission Delay",0],
'packet_size':
[PyTango.DevLong,
"Network packet size (MTU)",8000],
}
cmd_list = {
'getAttrStringValueList':
[[PyTango.DevString, "Attribute name"],
[PyTango.DevVarStringArray, "Authorized String value list"]],
}
attr_list = {
}
def __init__(self,name) :
PyTango.DeviceClass.__init__(self,name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
_BaslerCam = None
_BaslerInterface = None
# packet_size = 8000 suppose the eth MTU is set at least to 8192 (Jumbo mode !)
# otherwise frame transfer can failed, the package size must but
# correspond to the MTU, see README file under Pylon-3.2.2 installation
# directory for for details about network optimization.
def get_control(frame_transmission_delay = 0, inter_packet_delay = 0,
packet_size = 8000,**keys) :
global _BaslerCam
global _BaslerInterface
if 'camera_id' in keys:
camera_id = keys['camera_id']
elif 'serial_number' in keys:
camera_id = 'sn://' + keys['serial_number']
elif 'cam_ip_address' in keys:
camera_id = 'ip://' + keys['cam_ip_address']
elif 'user_name' in keys:
camera_id = 'uname://' + keys['user_name']
else:
# if no property is present it uses the server personal name
# as Basler user name to identify the camera
util = PyTango.Util.instance()
camera_id = 'uname://' + util.get_ds_inst_name()
print ("basler camera_id:", camera_id)
if _BaslerCam is None:
_BaslerCam = BaslerAcq.Camera(camera_id, int(packet_size))
_BaslerCam.setInterPacketDelay(int(inter_packet_delay))
_BaslerCam.setFrameTransmissionDelay(int(frame_transmission_delay))
_BaslerInterface = BaslerAcq.Interface(_BaslerCam)
return Core.CtControl(_BaslerInterface)
def get_tango_specific_class_n_device():
return BaslerClass,Basler
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
#=============================================================================
#
# file : Dexela.py
#
# description : Python source for the Dexela and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# Pilatus are implemented in this file.
#
# project : TANGO Device Server
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# (c) - Bliss - ESRF
#=============================================================================
#
import os
import PyTango
from Lima import Core
from Lima import Dexela as DexelaAcq
from Lima.Server import AttrHelper
class Dexela(PyTango.Device_4Impl):
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,*args) :
PyTango.Device_4Impl.__init__(self,*args)
self.init_device()
self.__Attribute2FunctionBase = {
}
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
#Full well mode
self.__FullWellMode = {'HIGH' : _DexelaInterface.High,
'LOW' : _DexelaInterface.Low}
self.__SkipFirstFrame = {'YES' : True,
'NO' : False}
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
#use AttrHelper
return AttrHelper.get_attr_string_value_list(self, attr_name)
#==================================================================
#
# Dexela read/write attribute methods
#
#==================================================================
def __getattr__(self,name) :
#use AttrHelper
return AttrHelper.get_attr_4u(self,name,_DexelaInterface)
#==================================================================
#
# DexelaClass class definition
#
#==================================================================
class DexelaClass(PyTango.DeviceClass):
class_property_list = {}
device_property_list = {
'format_file':
[PyTango.DevString,
"Format file",[]],
}
cmd_list = {
'getAttrStringValueList':
[[PyTango.DevString, "Attribute name"],
[PyTango.DevVarStringArray, "Authorized String value list"]],
}
attr_list = {
'skip_first_frame':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
}
def __init__(self,name) :
PyTango.DeviceClass.__init__(self,name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
_DexelaInterface = None
def get_control(format_file) :
global _DexelaInterface
if _DexelaInterface is None:
_DexelaInterface = DexelaAcq.Interface(format_file)
return Core.CtControl(_DexelaInterface)
def get_tango_specific_class_n_device():
return DexelaClass,Dexela
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
#=============================================================================
#
# file : Eiger.py
#
# description : Python source for the Eiger and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# Eiger are implemented in this file.
#
# project : TANGO Device Server
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
#
# (c) - Software Engineering Group - ESRF
#=============================================================================
#
import PyTango
import sys
from Lima import Core
from Lima.Server import AttrHelper
#==================================================================
# Eiger Class Description:
#
#
#==================================================================
class Eiger(PyTango.Device_4Impl):
#--------- Add you global variables here --------------------------
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
self.init_device()
self.__CountrateCorrection = {'ON':True,
'OFF':False}
self.__FlatfieldCorrection = {'ON':True,
'OFF':False}
self.__AutoSummation = {'ON':True,
'OFF':False}
self.__EfficiencyCorrection = {'ON':True,
'OFF':False}
self.__VirtualPixelCorrection = {'ON':True,
'OFF':False}
self.__PixelMask = {'ON':True,
'OFF':False}
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
return AttrHelper.get_attr_string_value_list(self,attr_name)
#----------------------------------------------------------------------------
# delete all memory files
#----------------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def deleteMemoryFiles(self):
_EigerCamera.deleteMemoryFiles()
#==================================================================
#
# Eiger read/write attribute methods
#
#==================================================================
def __getattr__(self,name) :
return AttrHelper.get_attr_4u(self,name,_EigerCamera)
#==================================================================
#
# Eiger command methods
#
#==================================================================
#==================================================================
#
# EigerClass class definition
#
#==================================================================
class EigerClass(PyTango.DeviceClass):
# Class Properties
class_property_list = {
}
# Device Properties
device_property_list = {
'detector_ip_address':
[PyTango.DevString,
"Detector ip address",[]],
}
# Command definitions
cmd_list = {
'getAttrStringValueList':
[[PyTango.DevString, "Attribute name"],
[PyTango.DevVarStringArray, "Authorized String value list"]],
'deleteMemoryFiles':
[[PyTango.DevVoid, ""],
[PyTango.DevVoid, ""]],
}
# Attribute definitions
attr_list = {
'temperature':
[[PyTango.DevFloat,
PyTango.SCALAR,
PyTango.READ]],
'humidity':
[[PyTango.DevFloat,
PyTango.SCALAR,
PyTango.READ]],
'countrate_correction':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'flatfield_correction':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'auto_summation':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'efficiency_correction':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'virtual_pixel_correction':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'pixel_mask':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'threshold_energy':
[[PyTango.DevFloat,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'photon_energy':
[[PyTango.DevFloat,
PyTango.SCALAR,
PyTango.READ_WRITE]],
}
#------------------------------------------------------------------
# EigerClass Constructor
#------------------------------------------------------------------
def __init__(self, name):
PyTango.DeviceClass.__init__(self, name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
from Lima import Eiger as EigerAcq
_EigerIterface = None
_EigerCamera = None
def get_control(detector_ip_address = "0",**keys) :
global _EigerIterface
global _EigerCamera
if _EigerIterface is None:
_EigerCamera = EigerAcq.Camera(detector_ip_address)
_EigerIterface = EigerAcq.Interface(_EigerCamera)
return Core.CtControl(_EigerIterface)
def get_tango_specific_class_n_device() :
return EigerClass,Eiger
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
#=============================================================================
#
# file : Fli.py
#
# description : Python source for the Fli and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# Pilatus are implemented in this file.
#
# project : TANGO Device Server
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# (c) - Bliss - ESRF
#=============================================================================
#
import PyTango
from Lima import Core
from Lima import Fli as FliAcq
from Lima.Server import AttrHelper
class Fli(PyTango.Device_4Impl):
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,*args) :
PyTango.Device_4Impl.__init__(self,*args)
self.__ExtTriggerLevel = {'LOW':0,
'HIGH':1}
self.__Attribute2FunctionBase = {
'temperature_sp': 'TemperatureSP',
'temperature_ccd': 'TemperatureCCD',
'temperature_base': 'TemperatureBase',
}
self.init_device()
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
if self.temperature_sp:
_FliInterface.setTemperatureSP(self.temperature_sp)
if self.ext_trigger_level:
_FliInterface.setExtTriggerLevel(self.__ExtTriggerLevel[self.ext_trigger_level])
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
#use AttrHelper
return AttrHelper.get_attr_string_value_list(self, attr_name)
#==================================================================
#
# Fli read/write attribute methods
#
#==================================================================
def __getattr__(self,name) :
#use AttrHelper
return AttrHelper.get_attr_4u(self,name,_FliInterface)
#==================================================================
#
# FliClass class definition
#
#==================================================================
class FliClass(PyTango.DeviceClass):
class_property_list = {}
device_property_list = {
# define one and only one of the following 4 properties:
'camera_path':
[PyTango.DevString,
"Camera device path", []],
'temperature_sp':
[PyTango.DevDouble,
'Temperature set point in Celsius', []],
'ext_trigger_level':
[PyTango.DevString,
'level of external trigger input ("LOW"/"HIGH")', []],
}
cmd_list = {
'getAttrStringValueList':
[[PyTango.DevString, "Attribute name"],
[PyTango.DevVarStringArray, "Authorized String value list"]],
}
attr_list = {
'cooler_power':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ],
{
'unit': '%',
'format': '%1f',
'description': 'cooler power (%)',
}],
'ext_trigger_level':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'unit': 'N/A',
'format': '',
'description': 'external trigger input level, see manual for usage LOW or HIGH',
}],
'temperature_sp':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'unit': 'C',
'format': '%1f',
'description': 'temperature set-point (C)',
}],
'temperature_ccd':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ],
{
'unit': 'C',
'format': '%1f',
'description': 'sensor temperature (C)',
}],
'temperature_base':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ],
{
'unit': 'C',
'format': '%1f',
'description': 'base (external) temperature (C)',
}],
}
def __init__(self,name) :
PyTango.DeviceClass.__init__(self,name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
_FliCam = None
_FliInterface = None
def get_control(camera_path='/dev/fliusb0',**keys) :
global _FliCam
global _FliInterface
print ("FLI camera path: ", camera_path)
if _FliCam is None:
_FliCam = FliAcq.Camera(camera_path)
_FliInterface = FliAcq.Interface(_FliCam)
return Core.CtControl(_FliInterface)
def get_tango_specific_class_n_device():
return FliClass,Fli
This diff is collapsed.
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
#=============================================================================
#
# file : Lambda.py
#
# description : Python source for the Roper Scientific and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# Pilatus are implemented in this file.
#
# project : TANGO Device Server
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# (c) - Bliss - ESRF
#=============================================================================
#
import PyTango
from Lima import Core
from Lima import Lambda as LambdaAcq
from AttrHelper import get_attr_4u, get_attr_string_value_list
import AttrHelper
class Lambda(PyTango.Device_4Impl):
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,*args) :
PyTango.Device_4Impl.__init__(self,*args)
#self.__Attribute2FunctionBase = {'distortion_correction': 'DistortionCorrection',
# }
self.init_device()
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
return get_attr_string_value_list(self, attr_name)
def __getattr__(self,name) :
return get_attr_4u(self, name, _LambdaCam)
class LambdaClass(PyTango.DeviceClass):
class_property_list = {}
device_property_list = {
'config_path':
[PyTango.DevString,
"Path of the configuration file",[]],
}
cmd_list = {}
attr_list = {
'distortion_correction':
[[PyTango.DevUShort,
PyTango.SCALAR,
PyTango.READ]],
}
def __init__(self,name) :
PyTango.DeviceClass.__init__(self,name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
_LambdaCam = None
_LambdaInterface = None
def get_control(config_path = "",**keys) :
global _LambdaCam
global _LambdaInterface
if _LambdaCam is None:
_LambdaCam = LambdaAcq.Camera(config_path)
_LambdaInterface = LambdaAcq.Interface(_LambdaCam)
return Core.CtControl(_LambdaInterface)
def get_tango_specific_class_n_device():
return LambdaClass,Lambda
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
import PyTango
import sys
from Lima import Core
from Lima import PerkinElmer as PerkinElmerModule
from Lima.Server import AttrHelper
#==================================================================
# PerkinElmer Class Description:
#
#
#==================================================================
class PerkinElmer(PyTango.Device_4Impl):
#--------- Add you global variables here --------------------------
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
self.init_device()
self.__CorrectionMode = {'NO' : _PerkinElmerIterface.No,
'OFFSET ONLY' : _PerkinElmerIterface.OffsetOnly,
'OFFSET AND GAIN' : _PerkinElmerIterface.OffsetAndGain}
self.__KeepFirstImage = {'YES' : True,
'NO' : False}
self.__Attribute2FunctionBase = {'gain': 'Gain',
'correction_mode': 'CorrectionMode',
'keep_first_image': 'KeepFirstImage',
}
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
#==================================================================
#
# PerkinElmer read/write attribute methods
#
#==================================================================
def __getattr__(self,name) :
return AttrHelper.get_attr_4u(self,name,_PerkinElmerIterface)
#==================================================================
#
# PerkinElmer command methods
#
#==================================================================
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
return AttrHelper.get_attr_string_value_list(self, attr_name)
@Core.DEB_MEMBER_FUNCT
def startAcqOffsetImage(self,nbImageNtime) :
nbImage = int(nbImageNtime[0])
expTime = nbImageNtime[1]
_PerkinElmerIterface.startAcqOffsetImage(nbImage,expTime)
@Core.DEB_MEMBER_FUNCT
def startAcqGainImage(self,nbImageNtime) :
nbImage = int(nbImageNtime[0])
expTime = nbImageNtime[1]
_PerkinElmerIterface.startAcqGainImage(nbImage,expTime)
#==================================================================
#
# PerkinElmerClass class definition
#
#==================================================================
class PerkinElmerClass(PyTango.DeviceClass):
# Class Properties
class_property_list = {
}
# Device Properties
device_property_list = {
}
# Command definitions
cmd_list = {
'getAttrStringValueList':
[[PyTango.DevString, "Attribute name"],
[PyTango.DevVarStringArray, "Authorized String value list"]],
'startAcqOffsetImage':
[[PyTango.DevVarDoubleArray, "nb frames,exposure time"],
[PyTango.DevVoid]],
'startAcqGainImage':
[[PyTango.DevVarDoubleArray, "nb frames,exposure time"],
[PyTango.DevVoid]],
}
# Attribute definitions
attr_list = {
'correction_mode':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'gain':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'keep_first_image':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE]],
}
#------------------------------------------------------------------
# PerkinElmerClass Constructor
#------------------------------------------------------------------
def __init__(self, name):
PyTango.DeviceClass.__init__(self, name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
_PerkinElmerIterface = None
def get_control(**keys) :
global _PerkinElmerIterface
if _PerkinElmerIterface is None:
_PerkinElmerIterface = PerkinElmerModule.Interface()
return Core.CtControl(_PerkinElmerIterface)
def get_tango_specific_class_n_device() :
return PerkinElmerClass,PerkinElmer
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
xcopy *.py %SP_DIR%\Lima\Server\
xcopy camera\__init__.py %SP_DIR%\Lima\Server\camera\
xcopy /s plugins %SP_DIR%\Lima\Server\plugins\
mkdir -p $SP_DIR/Lima/Server && cp *.py $SP_DIR/Lima/Server/
mkdir -p $SP_DIR/Lima/Server/camera && cp camera/__init__.py $SP_DIR/Lima/Server/camera/
mkdir -p $SP_DIR/Lima/Server/plugins && cp -R plugins $SP_DIR/Lima/Server/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.