California-Planet-Search / radvel

General Toolkit for Modeling Radial Velocity Data
http://radvel.readthedocs.io
MIT License
57 stars 52 forks source link

Replace '-inf' with '-np.inf' in model comparison table string. #365

Closed jvanzand closed 2 years ago

jvanzand commented 2 years ago

Some models have likelihoods of 0 at machine precision. Their assigned log-likelihood is -np.inf, but str(-np.inf) is "-inf". When the radvel.driver.report() function evaluates this string using eval(), it finds that -inf is not defined. The resulting error aborts the model comparison table entirely. I used a simple replacement in report() to replace all instances of "-inf" with "-np.inf" in the radvel stat file just before it is evaluated:

status['ic_compare']['ic'] = status['ic_compare']['ic'].replace('-inf', '-np.inf')