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
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,7 @@ import json
import time
import sys
import traceback
import math
from ost import io
from ost.mol.alg import scoring
......@@ -497,7 +498,7 @@ def _ParseArgs():
def _RoundOrNone(num, decimals = 3):
""" 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 round(num, decimals)
......
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