mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 12:03:42 +02:00
feat: thin method added to Corr class which allows to thin out a
correlator in order suppress correlations between neighbouring entries
This commit is contained in:
parent
f8c8b27ec3
commit
ca04097272
2 changed files with 26 additions and 0 deletions
|
@ -376,6 +376,24 @@ class Corr:
|
|||
"""Reverse the time ordering of the Corr"""
|
||||
return Corr(self.content[:: -1])
|
||||
|
||||
def thin(self, spacing=2, offset=0):
|
||||
"""Thin out a correlator to suppress correlations
|
||||
|
||||
Parameters
|
||||
----------
|
||||
spacing : int
|
||||
Keep only every 'spacing'th entry of the correlator
|
||||
offset : int
|
||||
Offset the equal spacing
|
||||
"""
|
||||
new_content = []
|
||||
for t in range(self.T):
|
||||
if (offset + t) % spacing != 0:
|
||||
new_content.append(None)
|
||||
else:
|
||||
new_content.append(self.content[t])
|
||||
return Corr(new_content)
|
||||
|
||||
def correlate(self, partner):
|
||||
"""Correlate the correlator with another correlator or Obs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue