generalized addPeak, addYAFF, addCond, etc.
to addContainer(container,data_pos) fixed action group
This commit is contained in:
@@ -24,6 +24,8 @@ class Conductivity(BaseContainer):
|
||||
|
||||
|
||||
def function(self, p ,x):
|
||||
if self._abort:
|
||||
raise StopIteration
|
||||
return functions.cond_cmplx(p,x)
|
||||
|
||||
def start_parameter(self, pos):
|
||||
@@ -41,6 +43,8 @@ class PowerComplex(BaseContainer):
|
||||
self.param_number = 2
|
||||
|
||||
def function( self, p, x ):
|
||||
if self._abort:
|
||||
raise StopIteration
|
||||
return functions.power_cmplx(p, x)
|
||||
|
||||
def start_parameter(self, pos):
|
||||
@@ -58,6 +62,8 @@ class Static(BaseContainer):
|
||||
self.param_number = 1
|
||||
|
||||
def function( self, p, x ):
|
||||
if self._abort:
|
||||
raise StopIteration
|
||||
return functions.static_cmplx(p, x)
|
||||
|
||||
def start_parameter(self, position):
|
||||
@@ -65,18 +71,22 @@ class Static(BaseContainer):
|
||||
self.set_parameter(beta=cond_par)
|
||||
|
||||
class Peak(BaseContainer):
|
||||
def __init__( self, id_num=None, plt_real=None, plt_imag=None, limits=None ):
|
||||
def __init__( self, plt_real=None, plt_imag=None, limits=None ):
|
||||
super(Peak, self).__init__(plt_real=plt_real, plt_imag=plt_imag, limits=limits)
|
||||
self.widget = gui.container_widgets.PeakWidget()
|
||||
self.widget.setId(id_num)
|
||||
self.color = id_to_color(id_num)
|
||||
self.widget.setColor(self.color)
|
||||
self.id_num = id_num
|
||||
self.id_label = "Hav-Neg"
|
||||
self.id_string = "hn"
|
||||
self.param_number = 4
|
||||
|
||||
def set_id(self, id_num):
|
||||
self.widget.setId(id_num)
|
||||
self.color = id_to_color(id_num)
|
||||
self.widget.setColor(self.color)
|
||||
self.id_num = id_num
|
||||
|
||||
def function( self, p, x ):
|
||||
if self._abort:
|
||||
raise StopIteration
|
||||
return functions.hn(p, x)
|
||||
|
||||
def start_parameter(self, pos):
|
||||
@@ -117,6 +127,8 @@ class YAFF(BaseContainer):
|
||||
self.update_data()
|
||||
|
||||
def function( self, p, x ):
|
||||
if self._abort:
|
||||
raise StopIteration
|
||||
ya = self._libyaff.loss(p, x)
|
||||
cplx = np.array([ya.imag, ya.real])
|
||||
return cplx
|
||||
|
@@ -8,10 +8,18 @@ __author__ = 'markusro'
|
||||
|
||||
class QABCMeta(abc.ABCMeta, QObject.__class__):
|
||||
"""
|
||||
Allows us to use ABCMeta
|
||||
Allows us to use abstract base class module to fixate the container API.
|
||||
|
||||
The metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases.
|
||||
|
||||
This means the BaseContainer's metaclass must also be a subclass of QObject, as
|
||||
the BaseContainer is itself a subclass of QObject.
|
||||
|
||||
This class provides a suitable metaclass.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class BaseContainer(QObject):
|
||||
"""
|
||||
This class provides placeholders (or default) methods for "container" objects.
|
||||
@@ -155,12 +163,12 @@ class BaseContainer(QObject):
|
||||
|
||||
@abc.abstractmethod
|
||||
def start_parameter(self, position):
|
||||
raise NotImplementedError("This needs to be implemented in your subclass")
|
||||
raise NotImplementedError("This needs to be implemented in your container subclass")
|
||||
|
||||
@abc.abstractmethod
|
||||
def function( self, p, x ):
|
||||
if self._abort:
|
||||
raise StopIteration
|
||||
raise NotImplementedError("This needs to be implemented in your subclass")
|
||||
raise NotImplementedError("This needs to be implemented in your container subclass")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user