diff --git a/pyerrors/input/json.py b/pyerrors/input/json.py index 6b854874..cdf203f2 100644 --- a/pyerrors/input/json.py +++ b/pyerrors/input/json.py @@ -171,6 +171,9 @@ def create_json_string(ol, description='', indent=1): names.append(key) idl.append(value) my_obs = Obs(samples, names, idl) + my_obs._covobs = obs._covobs + for name in obs._covobs: + my_obs.names.append(name) my_obs.reweighted = obs.reweighted my_obs.is_merged = obs.is_merged return my_obs diff --git a/tests/json_io_test.py b/tests/json_io_test.py index f5546d9f..04ccfd9f 100644 --- a/tests/json_io_test.py +++ b/tests/json_io_test.py @@ -242,3 +242,12 @@ def test_json_dict_io(): jsonio.dump_dict_to_json(od, fname, description=desc) os.remove(fname + '.json.gz') + + +def test_renorm_deriv_of_corr(tmp_path): + c = pe.Corr([pe.pseudo_Obs(i, .1, 'test') for i in range(10)]) + c *= pe.cov_Obs(1., .1, '#ren') + c = c.deriv() + pe.input.json.dump_to_json(c, (tmp_path / 'test').as_posix()) + recover = pe.input.json.load_json((tmp_path / 'test').as_posix()) + assert np.all([o == 0 for o in (c - recover)[1:-1]])