...
 
Commits (137)
......@@ -8,3 +8,4 @@
*target*
*.bck
*.bak
build/
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 -c conda-forge
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
......@@ -172,6 +172,7 @@ def get_attr_4u(obj,name,interface,update_dict=True) :
function2Call)
if update_dict: obj.__dict__[name] = callable_obj
callable_obj.__name__ = name
return callable_obj
raise AttributeError('%s has no attribute %s' % (obj.__class__.__name__,name))
......
###########################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2017
# Copyright (C) : 2009-2019
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# CS40220 38043 Grenoble Cedex 9
# FRANCE
#
#
# Contact: lima@esrf.fr
#
#
# 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/>.
############################################################################
set(NAME "tango-python")
cmake_minimum_required(VERSION 3.1)
project(tango-python)
if (LIMA_ENABLE_PYTHON)
install(PROGRAMS scripts/LimaCCDs DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
......@@ -31,6 +33,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
......@@ -433,7 +436,7 @@ def create_tango_objects(ct_control, name_template):
tango_object = server.register_object(tango_ct, tango_ct_name, ct_name,
member_filter=__filter)
tango_ct_map[tango_ct_name] = tango_ct, tango_object
print("ctcontrol.{0}() = {1}".format(ct_func_name, getattr(tango_ct_control, ct_func_name)()))
#print("ctcontrol.{0}() = {1}".format(ct_func_name, getattr(tango_ct_control, ct_func_name)()))
tango_object = server.register_object(tango_ct_control,
tango_ct_control_name,
......@@ -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.
......@@ -58,7 +58,7 @@ import time
## Device States Description
## No states for this device
class LimaViewer (PyTango.Device_4Impl):
class LimaViewer (PyTango.LatestDeviceImpl):
#--------- Add you global variables here --------------------------
#----- PROTECTED REGION ID(LimaViewer.global_variables) ENABLED START -----#
......@@ -68,7 +68,7 @@ class LimaViewer (PyTango.Device_4Impl):
#----- PROTECTED REGION END -----# // LimaViewer.global_variables
def __init__(self,cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
PyTango.LatestDeviceImpl.__init__(self,cl,name)
self.debug_stream("In __init__()")
#----- PROTECTED REGION ID(LimaViewer.__init__) ENABLED START -----#
self.ImageType2NumpyType = {
......@@ -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()
[![License](https://img.shields.io/github/license/esrf-bliss/lima.svg?style=flat)](https://opensource.org/licenses/GPL-3.0)
[![Gitter](https://img.shields.io/gitter/room/esrf-bliss/lima.svg?style=flat)](https://gitter.im/esrf-bliss/LImA)
[![Conda](https://img.shields.io/conda/dn/esrf-bcu/lima-tango-server.svg?style=flat)](https://anaconda.org/esrf-bcu)
[![Version](https://img.shields.io/conda/vn/esrf-bcu/lima-tango-server.svg?style=flat)](https://anaconda.org/esrf-bcu)
[![Platform](https://img.shields.io/conda/pn/esrf-bcu/lima-tango-server.svg?style=flat)](https://anaconda.org/esrf-bcu)
# LImA TANGO python server
This is the LImA TANGO python server. It has to be installed with a camera plugin, e.g Basler.
## Install
### Camera python
conda install -c esrf-bcu lima-camera-basler
### Tango device server
conda install -c tango-controls -c esrf-bcu lima-tango-server
### Camera tango device server
conda install -c tango-controls -c esrf-bcu lima-basler-tango
# LImA
Lima ( **L** ibrary for **Im** age **A** cquisition) is a project for the unified control of 2D detectors. The aim is to clearly separate hardware specific code from common software configuration and features, like setting standard acquisition parameters (exposure time, external trigger), file saving and image processing.
Lima is a C++ library which can be used with many different cameras. The library also comes with a [Python](http://python.org) binding and provides a [PyTango](http://pytango.readthedocs.io/en/stable/) device server for remote control.
## Documentation
The documentation is available [here](https://lima.blissgarden.org)
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 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.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -19,9 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
__all__ = []
def _init_module() :
import os
cameras = []
for root,dirs,files in os.walk(__path__[0]) :
for file_name in files :
if file_name.startswith('__') : continue
......@@ -30,6 +31,15 @@ def _init_module() :
subdir = root[len(__path__[0]) + 1:]
if subdir:
base = '%s.%s' % (subdir,base)
__all__.append(base)
_init_module()
cameras.append(base)
try:
import pkg_resources
except ImportError:
pass
else:
for ep in pkg_resources.iter_entry_points('Lima_tango_camera'):
cameras.append(ep.name)
return cameras
__all__ = _init_module()
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.
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.
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.