mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 11:33:42 +02:00
test: test of json output of a correlator with a gap added
This commit is contained in:
parent
01c3d02394
commit
6c99e05e5b
1 changed files with 14 additions and 11 deletions
|
@ -101,17 +101,20 @@ def test_json_corr_io():
|
||||||
for fp in [0, 2]:
|
for fp in [0, 2]:
|
||||||
for bp in [0, 7]:
|
for bp in [0, 7]:
|
||||||
for corr_tag in [None, 'my_Corr_tag']:
|
for corr_tag in [None, 'my_Corr_tag']:
|
||||||
my_corr = pe.Corr(obs_list, padding=[fp, bp])
|
for gap in [False, True]:
|
||||||
my_corr.tag = corr_tag
|
my_corr = pe.Corr(obs_list, padding=[fp, bp])
|
||||||
pe.input.json.dump_to_json(my_corr, 'corr')
|
my_corr.tag = corr_tag
|
||||||
recover = pe.input.json.load_json('corr')
|
if gap:
|
||||||
os.remove('corr.json.gz')
|
my_corr.content[4] = None
|
||||||
assert np.all([o.is_zero() for o in [x for x in (my_corr - recover) if x is not None]])
|
pe.input.json.dump_to_json(my_corr, 'corr')
|
||||||
for index, entry in enumerate(my_corr):
|
recover = pe.input.json.load_json('corr')
|
||||||
if entry is None:
|
os.remove('corr.json.gz')
|
||||||
assert recover[index] is None
|
assert np.all([o.is_zero() for o in [x for x in (my_corr - recover) if x is not None]])
|
||||||
assert my_corr.tag == recover.tag
|
for index, entry in enumerate(my_corr):
|
||||||
assert my_corr.reweighted == recover.reweighted
|
if entry is None:
|
||||||
|
assert recover[index] is None
|
||||||
|
assert my_corr.tag == recover.tag
|
||||||
|
assert my_corr.reweighted == recover.reweighted
|
||||||
|
|
||||||
|
|
||||||
def test_json_corr_2d_io():
|
def test_json_corr_2d_io():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue