mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-16 12:33:41 +02:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
0a76877e4e
3 changed files with 42 additions and 31 deletions
|
@ -367,9 +367,9 @@ def read_qtop(path, prefix, c, dtr_cnfg=1, version="1.2", **kwargs):
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
path:
|
path : str
|
||||||
path of the measurement files
|
path of the measurement files
|
||||||
prefix:
|
prefix : str
|
||||||
prefix of the measurement files, e.g. <prefix>_id0_r0.ms.dat
|
prefix of the measurement files, e.g. <prefix>_id0_r0.ms.dat
|
||||||
c : double
|
c : double
|
||||||
Smearing radius in units of the lattice extent, c = sqrt(8 t0) / L
|
Smearing radius in units of the lattice extent, c = sqrt(8 t0) / L
|
||||||
|
@ -545,11 +545,19 @@ def read_qtop(path, prefix, c, dtr_cnfg=1, version="1.2", **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def read_qtop_sector(target=0, **kwargs):
|
def read_qtop_sector(target=0, **kwargs):
|
||||||
"""target: int
|
"""Constructs reweighting factors to a specified topological sector.
|
||||||
specifies the topological sector to be reweighted to (default 0)
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
target : int
|
||||||
|
Specifies the topological sector to be reweighted to (default 0)
|
||||||
q_top : Obs
|
q_top : Obs
|
||||||
alternatively takes args of read_qtop method as kwargs
|
Alternatively takes args of read_qtop method as kwargs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not isinstance(target, int):
|
||||||
|
raise Exception("'target' has to be an integer.")
|
||||||
|
|
||||||
if "q_top" in kwargs:
|
if "q_top" in kwargs:
|
||||||
qtop = kwargs.get("q_top")
|
qtop = kwargs.get("q_top")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -79,7 +79,7 @@ def _assert_equal_properties(ol, otype=Obs):
|
||||||
if not isinstance(o, otype):
|
if not isinstance(o, otype):
|
||||||
raise Exception("Wrong data type in list.")
|
raise Exception("Wrong data type in list.")
|
||||||
if not ol[0].is_merged == o.is_merged:
|
if not ol[0].is_merged == o.is_merged:
|
||||||
raise Exception("All Obs in list have to be defined on the same set of configs.")
|
raise Exception("All Obs in list have to have the same state 'is_merged'.")
|
||||||
if not ol[0].reweighted == o.reweighted:
|
if not ol[0].reweighted == o.reweighted:
|
||||||
raise Exception("All Obs in list have to have the same property 'reweighted'.")
|
raise Exception("All Obs in list have to have the same property 'reweighted'.")
|
||||||
if not ol[0].e_content == o.e_content:
|
if not ol[0].e_content == o.e_content:
|
||||||
|
|
|
@ -98,11 +98,11 @@ def test_json_corr_io():
|
||||||
for obs_list in [my_list, rw_list]:
|
for obs_list in [my_list, rw_list]:
|
||||||
for tag in [None, "test"]:
|
for tag in [None, "test"]:
|
||||||
obs_list[3].tag = tag
|
obs_list[3].tag = tag
|
||||||
for fp in [0, 2]:
|
for pad in [0, 2]:
|
||||||
for bp in [0, 7]:
|
|
||||||
for corr_tag in [None, 'my_Corr_tag']:
|
for corr_tag in [None, 'my_Corr_tag']:
|
||||||
|
for prange in [None, [3, 6]]:
|
||||||
for gap in [False, True]:
|
for gap in [False, True]:
|
||||||
my_corr = pe.Corr(obs_list, padding=[fp, bp])
|
my_corr = pe.Corr(obs_list, padding=[pad, pad], prange=prange)
|
||||||
my_corr.tag = corr_tag
|
my_corr.tag = corr_tag
|
||||||
if gap:
|
if gap:
|
||||||
my_corr.content[4] = None
|
my_corr.content[4] = None
|
||||||
|
@ -114,6 +114,7 @@ def test_json_corr_io():
|
||||||
if entry is None:
|
if entry is None:
|
||||||
assert recover[index] is None
|
assert recover[index] is None
|
||||||
assert my_corr.tag == recover.tag
|
assert my_corr.tag == recover.tag
|
||||||
|
assert my_corr.prange == recover.prange
|
||||||
assert my_corr.reweighted == recover.reweighted
|
assert my_corr.reweighted == recover.reweighted
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +124,8 @@ def test_json_corr_2d_io():
|
||||||
for tag in [None, "test"]:
|
for tag in [None, "test"]:
|
||||||
obs_list[3][0, 1].tag = tag
|
obs_list[3][0, 1].tag = tag
|
||||||
for padding in [0, 1]:
|
for padding in [0, 1]:
|
||||||
my_corr = pe.Corr(obs_list, padding=[padding, padding])
|
for prange in [None, [3, 6]]:
|
||||||
|
my_corr = pe.Corr(obs_list, padding=[padding, padding], prange=prange)
|
||||||
my_corr.tag = tag
|
my_corr.tag = tag
|
||||||
pe.input.json.dump_to_json(my_corr, 'corr')
|
pe.input.json.dump_to_json(my_corr, 'corr')
|
||||||
recover = pe.input.json.load_json('corr')
|
recover = pe.input.json.load_json('corr')
|
||||||
|
@ -133,3 +135,4 @@ def test_json_corr_2d_io():
|
||||||
if entry is None:
|
if entry is None:
|
||||||
assert recover[index] is None
|
assert recover[index] is None
|
||||||
assert my_corr.tag == recover.tag
|
assert my_corr.tag == recover.tag
|
||||||
|
assert my_corr.prange == recover.prange
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue