Commit a2c1c99e authored by Samuel Debionne's avatar Samuel Debionne

Merge branch 'camera_old_location' into 'master'

Camera old location

Closes #7

See merge request !32
parents ec6b5943 122bfb65
Pipeline #12750 passed with stages
in 25 seconds
......@@ -32,6 +32,6 @@ if (LIMA_ENABLE_PYTHON)
install(FILES AttrHelper.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(FILES EnvHelper.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(FILES EdfFile.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server")
install(DIRECTORY camera 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.
############################################################################
# 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)
def read_AcquisitionFrameRateEnable(self, attr):
attr.set_value(_BaslerCam.getAcquisitionFrameRateEnable())
def write_AcquisitionFrameRateEnable(self, attr):
data=attr.get_write_value()
_BaslerCam.setAcquisitionFrameRateEnable(data)
def read_AcquisitionFrameRateAbs(self, attr):
attr.set_value(_BaslerCam.getAcquisitionFrameRateAbs())
def write_AcquisitionFrameRateAbs(self, attr):
data=attr.get_write_value()
_BaslerCam.setAcquisitionFrameRateAbs(data)
#==================================================================
#
# 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 = {
'AcquisitionFrameRateEnable':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'AcquisitionFrameRateAbs':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ_WRITE]],
}
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 = {}
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