npr doc extended, CObs now have real and imag properties

This commit is contained in:
Fabian Joswig 2021-10-21 10:59:53 +01:00
parent e7efa822b0
commit 7efe9612bc
2 changed files with 25 additions and 9 deletions

View file

@ -650,13 +650,21 @@ class Obs:
class CObs:
"""Class for a complex valued observable."""
__slots__ = ['real', 'imag', 'tag']
__slots__ = ['_real', '_imag', 'tag']
def __init__(self, real, imag=0.0):
self.real = real
self.imag = imag
self._real = real
self._imag = imag
self.tag = None
@property
def real(self):
return self._real
@property
def imag(self):
return self._imag
def gamma_method(self, **kwargs):
if isinstance(self.real, Obs):
self.real.gamma_method(**kwargs)