Skip to content
Snippets Groups Projects
Commit a8a9906e authored by Colm Talbot's avatar Colm Talbot
Browse files

make grid save prior as json

parent debf6d7e
No related branches found
No related tags found
1 merge request!500Prior json format
Pipeline #73523 passed
......@@ -407,12 +407,10 @@ class Grid(object):
logger.debug("Saving result to {}".format(filename))
# Convert the prior to a string representation for saving on disk
dictionary = self._get_save_data_dictionary()
if dictionary.get('priors', False):
dictionary['priors'] = {key: str(self.priors[key]) for key in self.priors}
try:
dictionary["priors"] = dictionary["priors"]._get_json_dict()
if gzip or (os.path.splitext(filename)[-1] == '.gz'):
import gzip
# encode to a string
......@@ -469,12 +467,6 @@ class Grid(object):
else:
with open(fname, 'r') as file:
dictionary = json.load(file, object_hook=decode_bilby_json)
for key in dictionary.keys():
# Convert the loaded priors to bilby prior type
if key == 'priors':
for param in dictionary[key].keys():
dictionary[key][param] = str(dictionary[key][param])
dictionary[key] = PriorDict(dictionary[key])
try:
grid = cls(likelihood=None, priors=dictionary['priors'],
grid_size=dictionary['sample_points'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment