Open sengle01 opened 4 months ago
This is an issue with your isochrones installation. Try running nosetests isochrones
and see if that fixes it. Otherwise I would advise you to search on their repository for answers.
Thank you for the reply and I'm sorry for the delay.
Is there a way of bypassing the isochrones requirement by saving a grid of isochrones locally and pointing astroARIADNE to them?
Hello,
I just installed astroARIADNE in its own environment - Linux running through Oracle VirtualBox on Windows 10. I keep receiving "KeyError: -4.0" when running fit_bma and was wondering if anyone else has received this recently, or if it's a known potential issue that I can resolve.
Let me know what other info you may need and I can get it uploaded. In the meantime, here is the (last portion of the) lengthy error message I receive.
Thank you and all the best, Scott
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 22/22 [00:00<00:00, 76.80it/s] /home/sengle/astroARIADNE/astroARIADNE/fitter.py:1348: RuntimeWarning: invalid value encountered in log10 mass = logg + 2 * np.log10(rad) - 4.437 HDR failed for parameter grav_mass, reverting to regular CI calculation. Be sure to check the histograms afterwards for diagnosis. ESTIMATING AGE AND MASS USING MIST ISOCHRONES /home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/arraylike.py:402: RuntimeWarning: divide by zero encountered in log10 result = getattr(ufunc, method)(*inputs, **kwargs) /home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py:149: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy subdf.loc[:, "dm_deep"] = deriv Exception while calling loglikelihood function: params: [ 2.22519199e+02 6.69865969e+00 2.35319420e-01 3.88792010e+03 7.34104175e-01 4.89700109e+00 3.11137688e+00 -8.78293402e+00 8.70338326e+00] args: [<isochrones.starmodel.SingleStarModel object at 0x792a6e8a5fc0>, {'Teff': (4844.09789469605, 1007.0735759952863), 'feh': (-0.01754527670853212, 0.3731783085297097), 'distance': (6799.705857847154, 14037.850398433035), 'parallax': (0.14706518501031288, 0.3036129957901268), 'radius': (16.918224592133477, 50.204976905573936), 'AV': (4.240917495811603, 1.2977339399352634), 'mass': (nan, nan), 'BP': (17.752867, 0.045829), 'G': (16.255878, 0.011676), 'RP': (15.044456, 0.031915), 'TESS': (14.915, 0.0422)}, ['BP', 'G', 'RP', 'TESS']] kwargs: {} exception: Traceback (most recent call last): File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3802, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: -4.0
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/sengle/.local/lib/python3.10/site-packages/dynesty/dynesty.py", line 913, in call return self.func(np.asarray(x).copy(), *self.args, self.kwargs) File "/home/sengle/astroARIADNE/astroARIADNE/isochrone.py", line 122, in loglike lp = lp0 + mod.lnpost(theta[: mod.n_params]) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/starmodel.py", line 539, in lnpost lnpr = self.lnprior(p) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/starmodel.py", line 1620, in lnprior lnp += self._priors["eep"].lnpdf(val, age=pars[self.age_index], feh=pars[self.feh_index]) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/priors.py", line 133, in lnpdf pdf = self.pdf(x, kwargs) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/priors.py", line 56, in pdf return self._pdf(x, **kwargs) / self._norm File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/priors.py", line 422, in _pdf orig_val, dx_deep = self.ic.interp_value(pars, [self.orig_par, self.deriv_prop]).squeeze() File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py", line 401, in interp_value return self.model_grid.interp(pars, props) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/grid.py", line 136, in interp self._interp = DFInterpolator(self.df, filename=filename, is_full=self.is_full) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py", line 160, in df self._df["dm_deep"] = self.get_dm_deep() File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py", line 146, in get_dm_deep subdf = df.loc[f, a] File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1067, in getitem return self._getitem_tuple(key) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1247, in _getitem_tuple return self._getitem_lowerdim(tup) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 991, in _getitem_lowerdim return getattr(section, self.name)[new_key] File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1067, in getitem return self._getitem_tuple(key) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1247, in _getitem_tuple return self._getitem_lowerdim(tup) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 941, in _getitem_lowerdim return self._getitem_nested_tuple(tup) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1047, in _getitem_nested_tuple obj = getattr(obj, self.name)._getitem_axis(key, axis=axis) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1312, in _getitem_axis return self._get_label(key, axis=axis) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1260, in _get_label return self.obj.xs(label, axis=axis) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/generic.py", line 4041, in xs return self[key] File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 3807, in getitem indexer = self.columns.get_loc(key) File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3804, in get_loc raise KeyError(key) from err KeyError: -4.0 Traceback (most recent call last): File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3802, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: -4.0
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/sengle/astroARIADNE/testariadne.py", line 67, in
f.fit_bma() # Begin fit!
File "/home/sengle/astroARIADNE/astroARIADNE/fitter.py", line 590, in fit_bma
self.save_bma(avgd)
File "/home/sengle/astroARIADNE/astroARIADNE/fitter.py", line 1120, in save_bma
age_samp, mass_samp, eep_samp = self.estimate_age(
File "/home/sengle/astroARIADNE/astroARIADNE/fitter.py", line 1457, in estimate_age
age_samp, mass_samp, eep_samp = estimate(used_bands, params, logg=False)
File "/home/sengle/astroARIADNE/astroARIADNE/isochrone.py", line 59, in estimate
sampler = dynesty.NestedSampler(
File "/home/sengle/.local/lib/python3.10/site-packages/dynesty/dynesty.py", line 680, in new
live_points, logvol_init, init_ncalls = _initialize_live_points(
File "/home/sengle/.local/lib/python3.10/site-packages/dynesty/dynamicsampler.py", line 438, in _initialize_live_points
cur_live_logl = loglikelihood.map(np.asarray(cur_live_v))
File "/home/sengle/.local/lib/python3.10/site-packages/dynesty/utils.py", line 171, in map
ret = list([
File "/home/sengle/.local/lib/python3.10/site-packages/dynesty/utils.py", line 171, in
ret = list([
File "/home/sengle/.local/lib/python3.10/site-packages/dynesty/dynesty.py", line 913, in call
return self.func(np.asarray(x).copy(), *self.args, self.kwargs)
File "/home/sengle/astroARIADNE/astroARIADNE/isochrone.py", line 122, in loglike
lp = lp0 + mod.lnpost(theta[: mod.n_params])
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/starmodel.py", line 539, in lnpost
lnpr = self.lnprior(p)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/starmodel.py", line 1620, in lnprior
lnp += self._priors["eep"].lnpdf(val, age=pars[self.age_index], feh=pars[self.feh_index])
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/priors.py", line 133, in lnpdf
pdf = self.pdf(x, kwargs)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/priors.py", line 56, in pdf
return self._pdf(x, **kwargs) / self._norm
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/priors.py", line 422, in _pdf
orig_val, dx_deep = self.ic.interp_value(pars, [self.orig_par, self.deriv_prop]).squeeze()
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py", line 401, in interp_value
return self.model_grid.interp(pars, props)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/grid.py", line 136, in interp
self._interp = DFInterpolator(self.df, filename=filename, is_full=self.is_full)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py", line 160, in df
self._df["dm_deep"] = self.get_dm_deep()
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/isochrones/models.py", line 146, in get_dm_deep
subdf = df.loc[f, a]
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1067, in getitem
return self._getitem_tuple(key)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1247, in _getitem_tuple
return self._getitem_lowerdim(tup)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 991, in _getitem_lowerdim
return getattr(section, self.name)[new_key]
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1067, in getitem
return self._getitem_tuple(key)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1247, in _getitem_tuple
return self._getitem_lowerdim(tup)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 941, in _getitem_lowerdim
return self._getitem_nested_tuple(tup)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1047, in _getitem_nested_tuple
obj = getattr(obj, self.name)._getitem_axis(key, axis=axis)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1312, in _getitem_axis
return self._get_label(key, axis=axis)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexing.py", line 1260, in _get_label
return self.obj.xs(label, axis=axis)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/generic.py", line 4041, in xs
return self[key]
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 3807, in getitem
indexer = self.columns.get_loc(key)
File "/home/sengle/anaconda3/envs/ariadne/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3804, in get_loc
raise KeyError(key) from err
KeyError: -4.0