mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 12:03:42 +02:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
7a14899d6d
2 changed files with 12 additions and 2 deletions
|
@ -65,14 +65,16 @@ class Corr:
|
||||||
|
|
||||||
def __getitem__(self, idx):
|
def __getitem__(self, idx):
|
||||||
"""Return the content of timeslice idx"""
|
"""Return the content of timeslice idx"""
|
||||||
if len(self.content[idx]) == 1:
|
if self.content[idx] is None:
|
||||||
|
return None
|
||||||
|
elif len(self.content[idx]) == 1:
|
||||||
return self.content[idx][0]
|
return self.content[idx][0]
|
||||||
else:
|
else:
|
||||||
return self.content[idx]
|
return self.content[idx]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def reweighted(self):
|
def reweighted(self):
|
||||||
bool_array = np.array([list(map(lambda x: x.reweighted, o)) for o in self.content])
|
bool_array = np.array([list(map(lambda x: x.reweighted, o)) for o in list(filter(None.__ne__, self.content))])
|
||||||
if np.all(bool_array == 1):
|
if np.all(bool_array == 1):
|
||||||
return True
|
return True
|
||||||
elif np.all(bool_array == 0):
|
elif np.all(bool_array == 0):
|
||||||
|
|
|
@ -99,6 +99,14 @@ def test_plateau():
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
my_corr.plateau()
|
my_corr.plateau()
|
||||||
|
|
||||||
|
|
||||||
|
def test_padded_correlator():
|
||||||
|
my_list = [pe.Obs([np.random.normal(1.0, 0.1, 100)], ['ens1']) for o in range(8)]
|
||||||
|
my_corr = pe.Corr(my_list, padding_front=7, padding_back=3)
|
||||||
|
my_corr.reweighted
|
||||||
|
[o for o in my_corr]
|
||||||
|
|
||||||
|
|
||||||
def test_utility():
|
def test_utility():
|
||||||
corr_content = []
|
corr_content = []
|
||||||
for t in range(8):
|
for t in range(8):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue