Skip to content
Snippets Groups Projects
Commit 8e8719bf authored by Christian's avatar Christian
Browse files

Improved module structure

- changed the directory structure to allow standard package install
- fixed the setup.py to install the package, not only the script
- changed the Tango Server filename to be without extension, to allow
the Tango Starter Device to work with the server
parent 11c4b50e
No related branches found
No related tags found
No related merge requests found
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8 # Version 3.0.12
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
from sys import version_info pkg = __name__.rpartition('.')[0]
if version_info >= (2, 6, 0): mname = '.'.join((pkg, '_AmptekHardwareInterface')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_AmptekHardwareInterface')
_AmptekHardwareInterface = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper(): def swig_import_helper():
from os.path import dirname from os.path import dirname
import imp import imp
...@@ -19,22 +26,27 @@ if version_info >= (2, 6, 0): ...@@ -19,22 +26,27 @@ if version_info >= (2, 6, 0):
except ImportError: except ImportError:
import _AmptekHardwareInterface import _AmptekHardwareInterface
return _AmptekHardwareInterface return _AmptekHardwareInterface
if fp is not None:
try: try:
_mod = imp.load_module('_AmptekHardwareInterface', fp, pathname, description) _mod = imp.load_module('_AmptekHardwareInterface', fp, pathname, description)
finally: finally:
if fp is not None:
fp.close() fp.close()
return _mod return _mod
_AmptekHardwareInterface = swig_import_helper() _AmptekHardwareInterface = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
import _AmptekHardwareInterface import _AmptekHardwareInterface
del version_info del _swig_python_version_info
try: try:
_swig_property = property _swig_property = property
except NameError: except NameError:
pass # Python < 2.2 doesn't have 'property'. pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1): def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"): if (name == "thisown"):
...@@ -56,37 +68,22 @@ def _swig_setattr(self, class_type, name, value): ...@@ -56,37 +68,22 @@ def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0) return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1): def _swig_getattr(self, class_type, name):
if (name == "thisown"): if (name == "thisown"):
return self.this.own() return self.this.own()
method = class_type.__swig_getmethods__.get(name, None) method = class_type.__swig_getmethods__.get(name, None)
if method: if method:
return method(self) return method(self)
if (not static): raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self): def _swig_repr(self):
try: try:
strthis = "proxy of " + self.this.__repr__() strthis = "proxy of " + self.this.__repr__()
except Exception: except __builtin__.Exception:
strthis = "" strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
def _swig_setattr_nondynamic_method(set): def _swig_setattr_nondynamic_method(set):
def set_attr(self, name, value): def set_attr(self, name, value):
...@@ -239,7 +236,7 @@ class IntVector(object): ...@@ -239,7 +236,7 @@ class IntVector(object):
this = _AmptekHardwareInterface.new_IntVector(*args) this = _AmptekHardwareInterface.new_IntVector(*args)
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
def push_back(self, x): def push_back(self, x):
...@@ -349,7 +346,7 @@ class StringVector(object): ...@@ -349,7 +346,7 @@ class StringVector(object):
this = _AmptekHardwareInterface.new_StringVector(*args) this = _AmptekHardwareInterface.new_StringVector(*args)
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
def push_back(self, x): def push_back(self, x):
...@@ -459,7 +456,7 @@ class DoubleVector(object): ...@@ -459,7 +456,7 @@ class DoubleVector(object):
this = _AmptekHardwareInterface.new_DoubleVector(*args) this = _AmptekHardwareInterface.new_DoubleVector(*args)
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
def push_back(self, x): def push_back(self, x):
...@@ -569,7 +566,7 @@ class UIntVector(object): ...@@ -569,7 +566,7 @@ class UIntVector(object):
this = _AmptekHardwareInterface.new_UIntVector(*args) this = _AmptekHardwareInterface.new_UIntVector(*args)
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
def push_back(self, x): def push_back(self, x):
...@@ -600,20 +597,10 @@ class UIntVector(object): ...@@ -600,20 +597,10 @@ class UIntVector(object):
UIntVector_swigregister = _AmptekHardwareInterface.UIntVector_swigregister UIntVector_swigregister = _AmptekHardwareInterface.UIntVector_swigregister
UIntVector_swigregister(UIntVector) UIntVector_swigregister(UIntVector)
_AmptekHardwareInterface.SPECLEN_swigconstant(_AmptekHardwareInterface)
SPECLEN = _AmptekHardwareInterface.SPECLEN SPECLEN = _AmptekHardwareInterface.SPECLEN
_AmptekHardwareInterface.NOT_CONNECTED_swigconstant(_AmptekHardwareInterface)
NOT_CONNECTED = _AmptekHardwareInterface.NOT_CONNECTED NOT_CONNECTED = _AmptekHardwareInterface.NOT_CONNECTED
_AmptekHardwareInterface.ON_swigconstant(_AmptekHardwareInterface)
ON = _AmptekHardwareInterface.ON ON = _AmptekHardwareInterface.ON
_AmptekHardwareInterface.RECORDING_swigconstant(_AmptekHardwareInterface)
RECORDING = _AmptekHardwareInterface.RECORDING RECORDING = _AmptekHardwareInterface.RECORDING
_AmptekHardwareInterface.ERROR_swigconstant(_AmptekHardwareInterface)
ERROR = _AmptekHardwareInterface.ERROR ERROR = _AmptekHardwareInterface.ERROR
class AmptekHardwareInterface(object): class AmptekHardwareInterface(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
...@@ -623,7 +610,7 @@ class AmptekHardwareInterface(object): ...@@ -623,7 +610,7 @@ class AmptekHardwareInterface(object):
this = _AmptekHardwareInterface.new_AmptekHardwareInterface() this = _AmptekHardwareInterface.new_AmptekHardwareInterface()
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _AmptekHardwareInterface.delete_AmptekHardwareInterface __swig_destroy__ = _AmptekHardwareInterface.delete_AmptekHardwareInterface
__del__ = lambda self: None __del__ = lambda self: None
...@@ -702,8 +689,6 @@ class AmptekHardwareInterface(object): ...@@ -702,8 +689,6 @@ class AmptekHardwareInterface(object):
AmptekHardwareInterface_swigregister = _AmptekHardwareInterface.AmptekHardwareInterface_swigregister AmptekHardwareInterface_swigregister = _AmptekHardwareInterface.AmptekHardwareInterface_swigregister
AmptekHardwareInterface_swigregister(AmptekHardwareInterface) AmptekHardwareInterface_swigregister(AmptekHardwareInterface)
_AmptekHardwareInterface.STATUS_SIZE_swigconstant(_AmptekHardwareInterface)
STATUS_SIZE = _AmptekHardwareInterface.STATUS_SIZE STATUS_SIZE = _AmptekHardwareInterface.STATUS_SIZE
class AmptekStatus(object): class AmptekStatus(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
...@@ -713,7 +698,7 @@ class AmptekStatus(object): ...@@ -713,7 +698,7 @@ class AmptekStatus(object):
this = _AmptekHardwareInterface.new_AmptekStatus(*args) this = _AmptekHardwareInterface.new_AmptekStatus(*args)
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _AmptekHardwareInterface.delete_AmptekStatus __swig_destroy__ = _AmptekHardwareInterface.delete_AmptekStatus
__del__ = lambda self: None __del__ = lambda self: None
...@@ -815,7 +800,7 @@ class AmptekSpectrum(object): ...@@ -815,7 +800,7 @@ class AmptekSpectrum(object):
this = _AmptekHardwareInterface.new_AmptekSpectrum(*args) this = _AmptekHardwareInterface.new_AmptekSpectrum(*args)
try: try:
self.this.append(this) self.this.append(this)
except Exception: except __builtin__.Exception:
self.this = this self.this = this
def AgeMillis(self): def AgeMillis(self):
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,7 +4,7 @@ from tango import AttrQuality, AttrWriteType, DispLevel, DevState, DebugIt ...@@ -4,7 +4,7 @@ from tango import AttrQuality, AttrWriteType, DispLevel, DevState, DebugIt
from tango.server import Device, attribute, command, pipe, device_property from tango.server import Device, attribute, command, pipe, device_property
from collections import OrderedDict from collections import OrderedDict
import tango import tango
import AmptekHardwareInterface from amptek_hardware_interface import AmptekHardwareInterface
import numpy as np import numpy as np
import os import os
...@@ -221,6 +221,8 @@ class AmptekPX5(Device): ...@@ -221,6 +221,8 @@ class AmptekPX5(Device):
self.other_params["TECS"] = { "value": "N/A", "name": "TEC Temperature Target" } self.other_params["TECS"] = { "value": "N/A", "name": "TEC Temperature Target" }
self.other_params["PAPS"] = { "value": "N/A", "name": "Preamp Volage", "options": ["8.5", "5", "OFF"] } self.other_params["PAPS"] = { "value": "N/A", "name": "Preamp Volage", "options": ["8.5", "5", "OFF"] }
self.other_params["MCAE"] = { "value": "N/A", "name": "Initial MCA Enable", "options": ["ON", "OFF"] } self.other_params["MCAE"] = { "value": "N/A", "name": "Initial MCA Enable", "options": ["ON", "OFF"] }
self.other_params["CON1"] = { "value": "N/A", "name": "Connector 1 Select (PX5)", "options": ["DAC","AUXOUT1","AUXIN1"] }
self.other_params["CON2"] = { "value": "N/A", "name": "Connector 2 Select (PX5)", "options": ["AUXOUT2","AUXIN2","GATEH","GATEL"] }
self.parameter_dicts['other']= self.other_params self.parameter_dicts['other']= self.other_params
...@@ -613,9 +615,11 @@ class AmptekPX5(Device): ...@@ -613,9 +615,11 @@ class AmptekPX5(Device):
def set_presetacctime(self, t): def set_presetacctime(self, t):
self.interface.SetPresetAccumulationTime(t) self.interface.SetPresetAccumulationTime(t)
self.load_config_dict( self.acquisition_params )
def set_presetrealtime(self, t): def set_presetrealtime(self, t):
self.interface.SetPresetRealTime(t) self.interface.SetPresetRealTime(t)
self.load_config_dict( self.acquisition_params )
......
File moved
...@@ -14,7 +14,7 @@ except AttributeError: ...@@ -14,7 +14,7 @@ except AttributeError:
numpy_include = numpy.get_numpy_include() numpy_include = numpy.get_numpy_include()
# HexitecIO extension module # HexitecIO extension module
_AmptekHardwareInterface = Extension("_AmptekHardwareInterface", _AmptekHardwareInterface = Extension("_AmptekHardwareInterface",
["python/AmptekHardwareInterface.i",] + ["src/" + f for f in os.listdir("src") if os.path.isfile("src/" + f)], ["python/amptek_hardware_interface/AmptekHardwareInterface.i",] + ["src/" + f for f in os.listdir("src") if os.path.isfile("src/" + f)],
include_dirs = [numpy_include, "include"], include_dirs = [numpy_include, "include"],
swig_opts=['-c++',"-modern" , "-nomodernargs"], swig_opts=['-c++',"-modern" , "-nomodernargs"],
extra_compile_args = ["-std=c++11", "-g"], extra_compile_args = ["-std=c++11", "-g"],
...@@ -24,7 +24,9 @@ _AmptekHardwareInterface = Extension("_AmptekHardwareInterface", ...@@ -24,7 +24,9 @@ _AmptekHardwareInterface = Extension("_AmptekHardwareInterface",
# NumyTypemapTests setup # NumyTypemapTests setup
setup( name = "AmptekHardwareInterface function", setup( name = "AmptekHardwareInterface function",
description = "Implementation of the Amptek DP5 Protocol", description = "Implementation of the Amptek DP5 Protocol",
scripts = ["python/AmptekPX5.py"], package_dir = {"amptek_hardware_interface": "python/amptek_hardware_interface"},
packages = ["amptek_hardware_interface"],
scripts = ["python/amptek_hardware_interface/AmptekPX5"],
author = "Christian Koernig", author = "Christian Koernig",
version = "0.1", version = "0.1",
ext_modules = [_AmptekHardwareInterface] ext_modules = [_AmptekHardwareInterface]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment