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

Add JSON encoding for int and float types

parent d858a275
No related branches found
No related tags found
1 merge request!866Add JSON encoding for int and float types
Pipeline #152411 passed
......@@ -977,6 +977,10 @@ class BilbyJsonEncoder(json.JSONEncoder):
def default(self, obj):
from .prior import MultivariateGaussianDist, Prior, PriorDict
from ..gw.prior import HealPixMapPriorDist
if isinstance(obj, np.integer):
return int(obj)
if isinstance(obj, np.floating):
return float(obj)
if isinstance(obj, PriorDict):
return {'__prior_dict__': True, 'content': obj._get_json_dict()}
if isinstance(obj, (MultivariateGaussianDist, HealPixMapPriorDist, Prior)):
......
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