Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: array must not contain infs or NaNs #14

Open
TakuNishiumi opened this issue May 19, 2020 · 0 comments
Open

ValueError: array must not contain infs or NaNs #14

TakuNishiumi opened this issue May 19, 2020 · 0 comments

Comments

@TakuNishiumi
Copy link

TakuNishiumi commented May 19, 2020

Hello, Hannu.
When I executed this scipt, I got ValueError.

My environment:
ubuntu18.04
conda 4.8.3
python3.6
ldtk 1.0 pypi_0 pypi

from IPython.display import display, Latex
from ldtk import LDPSetCreator, BoxcarFilter, TabulatedFilter
from ldtk.filters import sdss_g, sdss_r, sdss_i, sdss_z
#from ldtk import BoxcarFilter
#from datetime import datetime

# Input stellar infomation
sc = LDPSetCreator(teff=(5196,24), logg=(4.45,0.01), z=(0.31,0.04), filters=[sdss_g, sdss_r, sdss_i, sdss_z])

ps = sc.create_profiles(nsamples=2000)
ps.resample_linear_z(300)
qc,qe = ps.coeffs_qd(do_mc=True, n_mc_samples=10000)
for i,(c,e) in enumerate(zip(qc,qe)):
    display(Latex('u$_{i:d} = {c[0]:5.4f} \pm {e[0]:5.4f}\quad$'
                  'v$_{i:d} = {c[1]:5.4f} \pm {e[1]:5.4f}$'.format(i=i+1,c=c,e=e)))

and I got below Error.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-37-35e0573d3d0a> in <module>
     13 ps = sc.create_profiles(nsamples=2000)
     14 ps.resample_linear_z(300)
---> 15 qc,qe = ps.coeffs_qd(do_mc=True, n_mc_samples=10000)
     16 for i,(c,e) in enumerate(zip(qc,qe)):
     17     display(Latex('u$_{i:d} = {c[0]:5.4f} \pm {e[0]:5.4f}\quad$'

~/anaconda3/envs/py35/lib/python3.6/site-packages/LDTk-1.0-py3.6.egg/ldtk/ldtk.py in _coeffs(self, return_cm, do_mc, n_mc_samples, mc_thin, mc_burn, ldmodel, ngc)
    230 
    231                 for i in range(1,n_mc_samples):
--> 232                     pos_t  = multivariate_normal(chain[i-1], diag(s**2))
    233                     logl_t = self._lnlike(pos_t, flt=iflt, ldmodel=ldmodel)
    234                     if uniform() < exp(logl_t-logl[i-1]):

mtrand.pyx in mtrand.RandomState.multivariate_normal()

~/.local/lib/python3.6/site-packages/scipy/linalg/decomp_svd.py in svd(a, full_matrices, compute_uv, overwrite_a, check_finite, lapack_driver)
    107 
    108     """
--> 109     a1 = _asarray_validated(a, check_finite=check_finite)
    110     if len(a1.shape) != 2:
    111         raise ValueError('expected matrix')

~/.local/lib/python3.6/site-packages/scipy/_lib/_util.py in _asarray_validated(a, check_finite, sparse_ok, objects_ok, mask_ok, as_inexact)
    244             raise ValueError('masked arrays are not supported')
    245     toarray = np.asarray_chkfinite if check_finite else np.asarray
--> 246     a = toarray(a)
    247     if not objects_ok:
    248         if a.dtype is np.dtype('O'):

~/anaconda3/envs/py35/lib/python3.6/site-packages/numpy/lib/function_base.py in asarray_chkfinite(a, dtype, order)
    496     if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
    497         raise ValueError(
--> 498             "array must not contain infs or NaNs")
    499     return a
    500 

ValueError: array must not contain infs or NaNs

Do you have ideas to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant