Hi - I'm attempting to fit a GRAVITY spectrum (with covariance matrix) using ultranest and keep running into this error. It appears related to this ultranest error (JohannesBuchner/UltraNest#5). My code is as follows:
% add in object
database.add_object('SECRET GRAVITY OBSERVATION',
distance=distance,
app_mag=None,
spectrum={'GRAVITY':(file, file, 500.)},
)
% add in model and init FitModel object
model_choice = 'drift-phoenix'
fit = species.FitModel(object_name='SECRET GRAVITY OBSERVATION,
model=model_choice,
bounds={'teff': (300., 1900.)},
inc_phot=False,
inc_spec=True,
fit_corr=['GRAVITY'],
weights=None)
fit.run_ultranest(tag='SECRET',
min_num_live_points=500,
output=figpref+'ultranest',
prior={'mass': (11., 1.)}
)
Running nested sampling with UltraNest...
/Users/wbalmer/ultranest/ultranest/store.py:195: DeprecationWarning: np.float
is a deprecated alias for the builtin float
. To silence this warning, use float
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64
here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
'points', dtype=np.float,
AssertionError Traceback (most recent call last)
/var/folders/0q/4ls9h2fn4lv90qs43vdtzvkw0002tl/T/ipykernel_94525/3740028938.py in
----> 1 fit.run_ultranest(tag='SECRET',
2 min_num_live_points=t00,
3 output=figpref+'ultranest',
4 prior={'mass': (11., 1.)}
5 )
/opt/anaconda3/envs/exog/lib/python3.9/site-packages/typeguard/init.py in wrapper(*args, **kwargs)
925 memo = _CallMemo(python_func, _localns, args=args, kwargs=kwargs)
926 check_argument_types(memo)
--> 927 retval = func(*args, **kwargs)
928 try:
929 check_return_type(retval, memo)
~/species/species/analysis/fit_model.py in run_ultranest(self, tag, min_num_live_points, output, prior)
1785 return self.lnlike_func(params, prior=prior)
1786
-> 1787 sampler = ultranest.ReactiveNestedSampler(self.modelpar,
1788 lnlike_ultranest,
1789 transform=lnprior_ultranest,
~/ultranest/ultranest/integrator.py in init(self, param_names, loglike, transform, derived_param_names, wrapped_params, resume, run_num, log_dir, num_test_samples, draw_multiple, num_bootstraps, vectorized, ndraw_min, ndraw_max, storage_backend, warmstart_max_tau)
1093 self.ndraw_max = ndraw_max
1094 self.build_tregion = transform is not None
-> 1095 if not self._check_likelihood_function(transform, loglike, num_test_samples):
1096 assert self.log_to_disk
1097 if resume_similar and self.log_to_disk:
~/ultranest/ultranest/integrator.py in _check_likelihood_function(self, transform, loglike, num_test_samples)
1160 assert np.shape(logl) == (num_test_samples,), (
1161 "Error in loglikelihood function: returned shape is %s, expected %s" % (np.shape(logl), (num_test_samples,)))
-> 1162 assert np.isfinite(logl).all(), (
1163 "Error in loglikelihood function: returned non-finite number: %s for input u=%s p=%s" % (logl, u, p))
1164
AssertionError: Error in loglikelihood function: returned non-finite number: [-69595.69916114 nan] for input u=[[0.88514244 0.80027242 0.94738644 0.90123026 0.50204652 0.04512219]
[0.1820225 0.83629702 0.48314143 0.17793817 0.37901221 0.37225628]] p=[[ 1.71622790e+03 5.00068104e+00 2.52647792e-01 1.43086118e+00
-1.49386045e+00 4.51221917e-02]
[ 5.91236000e+02 5.09074255e+00 -1.65172711e-01 9.24556720e-01
-1.86296336e+00 3.72256282e-01]]
Wondering what might be going wrong here and if there's a potential solution. Appears to happen for at least exo-rem and drift-phoenix models, I haven't tested others, and also appears to happen whether or not I include "fit_corr=['GRAVITY']" or not. Wondering if its a problem with the spectrum itself?