Skip to content
Snippets Groups Projects
Commit 3219b797 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

compare-structures: avoid writing NaN to JSON

parent abd42376
Branches
Tags
No related merge requests found
...@@ -81,6 +81,7 @@ import json ...@@ -81,6 +81,7 @@ import json
import time import time
import sys import sys
import traceback import traceback
import math
from ost import io from ost import io
from ost.mol.alg import scoring from ost.mol.alg import scoring
...@@ -497,7 +498,7 @@ def _ParseArgs(): ...@@ -497,7 +498,7 @@ def _ParseArgs():
def _RoundOrNone(num, decimals = 3): def _RoundOrNone(num, decimals = 3):
""" Helper to create valid JSON output """ Helper to create valid JSON output
""" """
if num is None: if num is None or math.isnan(num) or math.isinf(num):
return None return None
return round(num, decimals) return round(num, decimals)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment