From e80fde66308a872b5f600258f911db2339638a0a Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Sun, 13 Feb 2022 16:21:27 +0000 Subject: [PATCH] fix: Obs.dump can now be provided with a description for the json.gz file --- pyerrors/obs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyerrors/obs.py b/pyerrors/obs.py index 681cb270..c596a580 100644 --- a/pyerrors/obs.py +++ b/pyerrors/obs.py @@ -597,7 +597,7 @@ class Obs: return dict(zip(self.e_names, sizes)) - def dump(self, filename, datatype="json.gz", **kwargs): + def dump(self, filename, datatype="json.gz", description="", **kwargs): """Dump the Obs to a file 'name' of chosen format. Parameters @@ -607,6 +607,8 @@ class Obs: datatype : str Format of the exported file. Supported formats include "json.gz" and "pickle" + description : str + Description for output file, only relevant for json.gz format. path : str specifies a custom path for the file (default '.') """ @@ -617,7 +619,7 @@ class Obs: if datatype == "json.gz": from .input.json import dump_to_json - dump_to_json([self], file_name) + dump_to_json([self], file_name, description=description) elif datatype == "pickle": with open(file_name + '.p', 'wb') as fb: pickle.dump(self, fb)