timothydmorton / isochrones

Pythonic stellar model grid access; easy MCMC fitting of stellar properties
http://isochrones.readthedocs.org
MIT License
123 stars 63 forks source link

Issue running nosetests #160

Open DavidMoiseNataf opened 3 years ago

DavidMoiseNataf commented 3 years ago

I think that the error occurs towards the end, and I've bolded it. Please advise.

conda activate isochrones (isochrones) $ nosetests isochrones /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_fits.py:6: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead. from pandas.util.testing import assert_frame_equal ........E...../Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/numpy/core/_asarray.py:171: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return array(a, dtype, copy=False, order=order, subok=True) ........../Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/priors.py:89: RuntimeWarning: divide by zero encountered in true_divide sigma = 1.0 / np.sqrt(hn) ..F.......

ERROR: isochrones.tests.test_fits.test_starfit

Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_fits.py", line 46, in test_starfit mod.samples File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 1045, in samples raise AttributeError("Must run MCMC (or load from file) " + "before accessing samples") AttributeError: Must run MCMC (or load from file) before accessing samples -------------------- >> begin captured stdout << --------------------- Fitting /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1 single starfit... kwarg RA=299.268036 ignored! single starfit calculation failed for /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1. Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starfit.py", line 96, in starfit mod.fit(verbose=verbose, overwrite=overwrite, kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 669, in fit return self.fit_mcmc(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc return self.fit_mcmc_old(**kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old p0 = self.emcee_p0(nwalkers) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 859, in emceep0 for , n in self.obs.Nstars.items(): AttributeError: 'NoneType' object has no attribute 'Nstars'

--------------------- >> end captured stdout << ---------------------- -------------------- >> begin captured logging << -------------------- isochrones: INFO: Testing starfit function with emcee... isochrones: WARNING: kwarg RA=299.268036 ignored! isochrones: ERROR: single starfit calculation failed for /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1. Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starfit.py", line 96, in starfit mod.fit(verbose=verbose, overwrite=overwrite, kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 669, in fit return self.fit_mcmc(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc return self.fit_mcmc_old(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old p0 = self.emcee_p0(nwalkers) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 859, in emceep0 for , n in self.obs.Nstars.items(): AttributeError: 'NoneType' object has no attribute 'Nstars' --------------------- >> end captured logging << ---------------------**

====================================================================== FAIL: Testing with first entry from Gaia DR1 TGAS table

Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_query.py", line 38, in test_queries assert tm.get_id() == b("03000819+0014074") # force byte literal b/c that's what gets returned AssertionError


Ran 34 tests in 150.525s

FAILED (errors=1, failures=1)

timothydmorton commented 3 years ago

I think this happens when starfit runs with the emcee sampler only, which means you probably haven't installed multinest. I'd recommend installing multinest and trying again.

DavidMoiseNataf commented 3 years ago

Hi Tim, I did need to install multinest, thank you. I think that the error message has now changed slightly, see below:

conda activate isochrones (isochrones) $ nosetests isochrones /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_fits.py:6: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead. from pandas.util.testing import assert_frame_equal ........E...../Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/numpy/core/_asarray.py:171: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return array(a, dtype, copy=False, order=order, subok=True) ........../Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/priors.py:89: RuntimeWarning: divide by zero encountered in true_divide sigma = 1.0 / np.sqrt(hn) ..F.......

ERROR: isochrones.tests.test_fits.test_starfit

Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_fits.py", line 46, in test_starfit mod.samples File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 1045, in samples raise AttributeError("Must run MCMC (or load from file) " + "before accessing samples") AttributeError: Must run MCMC (or load from file) before accessing samples -------------------- >> begin captured stdout << --------------------- Fitting /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1 single starfit... kwarg RA=299.268036 ignored! single starfit calculation failed for /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1. Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starfit.py", line 96, in starfit mod.fit(verbose=verbose, overwrite=overwrite, kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 669, in fit return self.fit_mcmc(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc return self.fit_mcmc_old(**kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old p0 = self.emcee_p0(nwalkers) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 859, in emceep0 for , n in self.obs.Nstars.items(): AttributeError: 'NoneType' object has no attribute 'Nstars'

--------------------- >> end captured stdout << ---------------------- -------------------- >> begin captured logging << -------------------- isochrones: INFO: Testing starfit function with emcee... isochrones: WARNING: kwarg RA=299.268036 ignored! isochrones: ERROR: single starfit calculation failed for /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1. Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starfit.py", line 96, in starfit mod.fit(verbose=verbose, overwrite=overwrite, kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 669, in fit return self.fit_mcmc(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc return self.fit_mcmc_old(**kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old p0 = self.emcee_p0(nwalkers) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 859, in emceep0 for , n in self.obs.Nstars.items(): AttributeError: 'NoneType' object has no attribute 'Nstars' --------------------- >> end captured logging << ---------------------

====================================================================== FAIL: Testing with first entry from Gaia DR1 TGAS table

Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_query.py", line 38, in test_queries assert tm.get_id() == b("03000819+0014074") # force byte literal b/c that's what gets returned AssertionError


Ran 34 tests in 171.488s

FAILED (errors=1, failures=1)

timothydmorton commented 3 years ago

Make sure you can import pymultinest from a python terminal-- the above looks like it's still not using pymultinest.

DavidMoiseNataf commented 3 years ago

Thank you Tim.

I think that that is not the issue. If you look at the terminal products below, I was able to import multinest, but I think that we may be able to drop it. If it's only one of 34 tests, and not a very important one, I may be able to go on without it. What do you think?

$ pwd /Users/davidnataf $ python Python 3.6.13 | packaged by conda-forge | (default, Feb 19 2021, 05:36:16) [GCC Clang 11.0.1] on darwin Type "help", "copyright", "credits" or "license" for more information.

import pymultinest exit() $ conda activate isochrones (isochrones) $ nosetests isochrones /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_fits.py:6: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead. from pandas.util.testing import assert_frame_equal ........E...../Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/numpy/core/_asarray.py:171: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return array(a, dtype, copy=False, order=order, subok=True) ........../Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/priors.py:89: RuntimeWarning: divide by zero encountered in true_divide sigma = 1.0 / np.sqrt(hn) ..F.......

ERROR: isochrones.tests.test_fits.test_starfit

Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_fits.py", line 46, in test_starfit mod.samples File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 1045, in samples raise AttributeError("Must run MCMC (or load from file) " + "before accessing samples") AttributeError: Must run MCMC (or load from file) before accessing samples -------------------- >> begin captured stdout << --------------------- Fitting /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1 single starfit... kwarg RA=299.268036 ignored! single starfit calculation failed for /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1. Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starfit.py", line 96, in starfit mod.fit(verbose=verbose, overwrite=overwrite, kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 669, in fit return self.fit_mcmc(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc return self.fit_mcmc_old(**kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old p0 = self.emcee_p0(nwalkers) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 859, in emceep0 for , n in self.obs.Nstars.items(): AttributeError: 'NoneType' object has no attribute 'Nstars'

--------------------- >> end captured stdout << ---------------------- -------------------- >> begin captured logging << -------------------- isochrones: INFO: Testing starfit function with emcee... isochrones: WARNING: kwarg RA=299.268036 ignored! isochrones: ERROR: single starfit calculation failed for /Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/star1. Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starfit.py", line 96, in starfit mod.fit(verbose=verbose, overwrite=overwrite, kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 669, in fit return self.fit_mcmc(kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc return self.fit_mcmc_old(**kwargs) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old p0 = self.emcee_p0(nwalkers) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/starmodel.py", line 859, in emceep0 for , n in self.obs.Nstars.items(): AttributeError: 'NoneType' object has no attribute 'Nstars' --------------------- >> end captured logging << ---------------------

====================================================================== FAIL: Testing with first entry from Gaia DR1 TGAS table

Traceback (most recent call last): File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/davidnataf/anaconda/envs/isochrones/lib/python3.9/site-packages/isochrones/tests/test_query.py", line 38, in test_queries assert tm.get_id() == b("03000819+0014074") # force byte literal b/c that's what gets returned AssertionError


Ran 34 tests in 140.316s

FAILED (errors=1, failures=1) (isochrones) $

timothydmorton commented 3 years ago

That test (test_query) is marked as skipped in the latest master branch. Make sure your local code is updated, but yes, that test is fine to skip.