mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01: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 bp in [0, 7]:
|
||||
for corr_tag in [None, 'my_Corr_tag']:
|
||||
my_corr = pe.Corr(obs_list, padding=[fp, bp])
|
||||
my_corr.tag = corr_tag
|
||||
pe.input.json.dump_to_json(my_corr, 'corr')
|
||||
recover = pe.input.json.load_json('corr')
|
||||
os.remove('corr.json.gz')
|
||||
assert np.all([o.is_zero() for o in [x for x in (my_corr - recover) if x is not None]])
|
||||
for index, entry in enumerate(my_corr):
|
||||
if entry is None:
|
||||
assert recover[index] is None
|
||||
assert my_corr.tag == recover.tag
|
||||
assert my_corr.reweighted == recover.reweighted
|
||||
for gap in [False, True]:
|
||||
my_corr = pe.Corr(obs_list, padding=[fp, bp])
|
||||
my_corr.tag = corr_tag
|
||||
if gap:
|
||||
my_corr.content[4] = None
|
||||
pe.input.json.dump_to_json(my_corr, 'corr')
|
||||
recover = pe.input.json.load_json('corr')
|
||||
os.remove('corr.json.gz')
|
||||
assert np.all([o.is_zero() for o in [x for x in (my_corr - recover) if x is not None]])
|
||||
for index, entry in enumerate(my_corr):
|
||||
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():
|
||||
|
|
Loading…
Add table
Reference in a new issue