From 3219b7970f54191a6ff8c9a22b517080d63d68b2 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Mon, 8 Jan 2024 09:25:14 +0100 Subject: [PATCH] compare-structures: avoid writing NaN to JSON --- actions/ost-compare-structures | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actions/ost-compare-structures b/actions/ost-compare-structures index fbae451dc..cfaabbd37 100644 --- a/actions/ost-compare-structures +++ b/actions/ost-compare-structures @@ -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) -- GitLab