pyerrors/correlators.py: Allowing for None values in pe.Corr.prune (#272)

* pyerrors/correlators.py: Allowing for None values in pe.Corr.prune

Closes: fjosw#271

* wip

* test/correlators_test.py: Adding test for updated prune method.

Closes #271
This commit is contained in:
Ruaidhrí 2025-10-19 11:28:36 +01:00 committed by GitHub
commit e0bfcabc0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 6 deletions

View file

@ -1405,13 +1405,15 @@ class Corr:
tmpmat = np.empty((Ntrunc, Ntrunc), dtype=object)
rmat = []
for t in range(basematrix.T):
for i in range(Ntrunc):
for j in range(Ntrunc):
tmpmat[i][j] = evecs[i].T @ self[t] @ evecs[j]
rmat.append(np.copy(tmpmat))
if self.content[t] is None:
rmat.append(None)
else:
for i in range(Ntrunc):
for j in range(Ntrunc):
tmpmat[i][j] = evecs[i].T @ self[t] @ evecs[j]
rmat.append(np.copy(tmpmat))
newcontent = [None if (self.content[t] is None) else rmat[t] for t in range(self.T)]
return Corr(newcontent)
return Corr(rmat)
def _sort_vectors(vec_set_in, ts):