mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
fix: Corr.m_eff can now returns None entries if the correlator has a
sign flip. Before that the logarithm of a negative number was computed and a warning was thrown.
This commit is contained in:
parent
92562d50e7
commit
763c759ae0
2 changed files with 13 additions and 0 deletions
|
@ -604,6 +604,8 @@ class Corr:
|
|||
for t in range(self.T - 1):
|
||||
if ((self.content[t] is None) or (self.content[t + 1] is None)) or (self.content[t + 1][0].value == 0):
|
||||
newcontent.append(None)
|
||||
elif self.content[t][0].value / self.content[t + 1][0].value < 0:
|
||||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(self.content[t] / self.content[t + 1])
|
||||
if(all([x is None for x in newcontent])):
|
||||
|
@ -627,6 +629,8 @@ class Corr:
|
|||
# Fill the two timeslices in the middle of the lattice with their predecessors
|
||||
elif variant == 'sinh' and t in [self.T / 2, self.T / 2 - 1]:
|
||||
newcontent.append(newcontent[-1])
|
||||
elif self.content[t][0].value / self.content[t + 1][0].value < 0:
|
||||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(np.abs(find_root(self.content[t][0] / self.content[t + 1][0], root_function, guess=guess)))
|
||||
if(all([x is None for x in newcontent])):
|
||||
|
|
|
@ -105,6 +105,15 @@ def test_m_eff():
|
|||
my_corr.m_eff('unkown_variant')
|
||||
|
||||
|
||||
def test_m_eff_negative_values():
|
||||
for padding in [0, 4]:
|
||||
my_corr = pe.correlators.Corr([1.0 * pe.pseudo_Obs(10, 0.1, 't'), 1.0 * pe.pseudo_Obs(9, 0.05, 't'), -pe.pseudo_Obs(9, 0.1, 't')], padding=[padding, padding])
|
||||
m_eff_log = my_corr.m_eff('log')
|
||||
assert m_eff_log[padding + 1] is None
|
||||
m_eff_cosh = my_corr.m_eff('cosh')
|
||||
assert m_eff_cosh[padding + 1] is None
|
||||
|
||||
|
||||
def test_reweighting():
|
||||
my_corr = pe.correlators.Corr([pe.pseudo_Obs(10, 0.1, 't'), pe.pseudo_Obs(0, 0.05, 't')])
|
||||
assert my_corr.reweighted is False
|
||||
|
|
Loading…
Add table
Reference in a new issue