mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01: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,8 +1136,10 @@ class Corr:
|
|||
for t in range(self.T):
|
||||
if _check_for_none(self, newcontent[t]):
|
||||
continue
|
||||
if np.isnan(np.sum(newcontent[t]).value):
|
||||
newcontent[t] = None
|
||||
tmp_sum = np.sum(newcontent[t])
|
||||
if hasattr(tmp_sum, "value"):
|
||||
if np.isnan(tmp_sum.value):
|
||||
newcontent[t] = None
|
||||
if all([item is None for item in newcontent]):
|
||||
raise Exception('Operation returns undefined correlator')
|
||||
return Corr(newcontent)
|
||||
|
@ -1194,8 +1196,8 @@ class Corr:
|
|||
@property
|
||||
def real(self):
|
||||
def return_real(obs_OR_cobs):
|
||||
if isinstance(obs_OR_cobs, CObs):
|
||||
return obs_OR_cobs.real
|
||||
if isinstance(obs_OR_cobs[0], CObs):
|
||||
return obs_OR_cobs[0].real
|
||||
else:
|
||||
return obs_OR_cobs
|
||||
|
||||
|
@ -1204,8 +1206,8 @@ class Corr:
|
|||
@property
|
||||
def imag(self):
|
||||
def return_imag(obs_OR_cobs):
|
||||
if isinstance(obs_OR_cobs, CObs):
|
||||
return obs_OR_cobs.imag
|
||||
if isinstance(obs_OR_cobs[0], CObs):
|
||||
return obs_OR_cobs[0].imag
|
||||
else:
|
||||
return obs_OR_cobs * 0 # So it stays the right type
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue