mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 12:03:42 +02:00
fix: real and imag attributes of complex correlator object fixed.
This commit is contained in:
parent
313dec7cee
commit
060c23571e
1 changed files with 8 additions and 6 deletions
|
@ -1136,7 +1136,9 @@ class Corr:
|
||||||
for t in range(self.T):
|
for t in range(self.T):
|
||||||
if _check_for_none(self, newcontent[t]):
|
if _check_for_none(self, newcontent[t]):
|
||||||
continue
|
continue
|
||||||
if np.isnan(np.sum(newcontent[t]).value):
|
tmp_sum = np.sum(newcontent[t])
|
||||||
|
if hasattr(tmp_sum, "value"):
|
||||||
|
if np.isnan(tmp_sum.value):
|
||||||
newcontent[t] = None
|
newcontent[t] = None
|
||||||
if all([item is None for item in newcontent]):
|
if all([item is None for item in newcontent]):
|
||||||
raise Exception('Operation returns undefined correlator')
|
raise Exception('Operation returns undefined correlator')
|
||||||
|
@ -1194,8 +1196,8 @@ class Corr:
|
||||||
@property
|
@property
|
||||||
def real(self):
|
def real(self):
|
||||||
def return_real(obs_OR_cobs):
|
def return_real(obs_OR_cobs):
|
||||||
if isinstance(obs_OR_cobs, CObs):
|
if isinstance(obs_OR_cobs[0], CObs):
|
||||||
return obs_OR_cobs.real
|
return obs_OR_cobs[0].real
|
||||||
else:
|
else:
|
||||||
return obs_OR_cobs
|
return obs_OR_cobs
|
||||||
|
|
||||||
|
@ -1204,8 +1206,8 @@ class Corr:
|
||||||
@property
|
@property
|
||||||
def imag(self):
|
def imag(self):
|
||||||
def return_imag(obs_OR_cobs):
|
def return_imag(obs_OR_cobs):
|
||||||
if isinstance(obs_OR_cobs, CObs):
|
if isinstance(obs_OR_cobs[0], CObs):
|
||||||
return obs_OR_cobs.imag
|
return obs_OR_cobs[0].imag
|
||||||
else:
|
else:
|
||||||
return obs_OR_cobs * 0 # So it stays the right type
|
return obs_OR_cobs * 0 # So it stays the right type
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue