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

Starfit breaks because 'obs' is None #158

Open martindevora opened 3 years ago

martindevora commented 3 years ago

star.ini content:

Teff = 3446.0, 344.6
logg = 4.897069999999999, 0.00280431
[first]
J = 11.47, 0.018000000000000002
H = 10.89, 0.015
K = 10.673, 0.016

isochrones version: 2.1

Fit mode: emcee

Description: It seems to me that there is something wrong in the code because this simple example doesn't end well. When debugging I can see the observation being loaded as an observationTree. Despite, its values are not persisted within the StarModel and therefore trying accessing the observation from there when calculating the p0 for the emcee run breaks the execution.

Stacktrace:

single starfit...
single starfit calculation failed for /home/martin/git_repositories/sherlockpipe/sherlockpipe/TIC198485881_all/validation_15/vespa/.
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starfit.py", line 96, in starfit
    mod.fit(verbose=verbose, overwrite=overwrite, **kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 669, in fit
    return self.fit_mcmc(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc
    return self.fit_mcmc_old(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old
    p0 = self.emcee_p0(nwalkers)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 859, in emcee_p0
    for _, n in self.obs.Nstars.items():
AttributeError: 'NoneType' object has no attribute 'Nstars'
single starfit calculation failed for /home/martin/git_repositories/sherlockpipe/sherlockpipe/TIC198485881_all/validation_15/vespa/.
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starfit.py", line 96, in starfit
    mod.fit(verbose=verbose, overwrite=overwrite, **kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 669, in fit
    return self.fit_mcmc(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc
    return self.fit_mcmc_old(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old
    p0 = self.emcee_p0(nwalkers)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 859, in emcee_p0
    for _, n in self.obs.Nstars.items():
AttributeError: 'NoneType' object has no attribute 'Nstars'
binary starfit...
binary starfit calculation failed for /home/martin/git_repositories/sherlockpipe/sherlockpipe/TIC198485881_all/validation_15/vespa/.
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starfit.py", line 96, in starfit
    mod.fit(verbose=verbose, overwrite=overwrite, **kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 669, in fit
    return self.fit_mcmc(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc
    return self.fit_mcmc_old(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old
    p0 = self.emcee_p0(nwalkers)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 859, in emcee_p0
    for _, n in self.obs.Nstars.items():
AttributeError: 'NoneType' object has no attribute 'Nstars'
binary starfit calculation failed for /home/martin/git_repositories/sherlockpipe/sherlockpipe/TIC198485881_all/validation_15/vespa/.
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starfit.py", line 96, in starfit
    mod.fit(verbose=verbose, overwrite=overwrite, **kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 669, in fit
    return self.fit_mcmc(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc
    return self.fit_mcmc_old(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old
    p0 = self.emcee_p0(nwalkers)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 859, in emcee_p0
    for _, n in self.obs.Nstars.items():
AttributeError: 'NoneType' object has no attribute 'Nstars'
triple starfit...
triple starfit calculation failed for /home/martin/git_repositories/sherlockpipe/sherlockpipe/TIC198485881_all/validation_15/vespa/.
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starfit.py", line 96, in starfit
    mod.fit(verbose=verbose, overwrite=overwrite, **kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 669, in fit
    return self.fit_mcmc(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc
    return self.fit_mcmc_old(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old
    p0 = self.emcee_p0(nwalkers)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 859, in emcee_p0
    for _, n in self.obs.Nstars.items():
AttributeError: 'NoneType' object has no attribute 'Nstars'
triple starfit calculation failed for /home/martin/git_repositories/sherlockpipe/sherlockpipe/TIC198485881_all/validation_15/vespa/.
Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starfit.py", line 96, in starfit
    mod.fit(verbose=verbose, overwrite=overwrite, **kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 669, in fit
    return self.fit_mcmc(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 887, in fit_mcmc
    return self.fit_mcmc_old(**kwargs)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 950, in fit_mcmc_old
    p0 = self.emcee_p0(nwalkers)
  File "/home/martin/.local/lib/python3.8/site-packages/isochrones/starmodel.py", line 859, in emcee_p0
    for _, n in self.obs.Nstars.items():
AttributeError: 'NoneType' object has no attribute 'Nstars'

Kind regards.