timothydmorton / isochrones

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

Output properties in Binary and Triple fitting mode #22

Closed Sleekery closed 8 years ago

Sleekery commented 8 years ago

The current output of the Binary and Triple fitting (the parameters in model.samples.columns) is a bit of a mishmash of notation and missing some information about the B and C components. The most important issue is that there is no output for the B and C components of logL, logg, and Teff.

The first notation issue deals with the mass. While the unlabeled physical values all stand for the A component, like 'radius' and 'logg', the A component of mass is explicitly 'mass_A' and not 'mass' like the rest of the physical values.

The second notation issue is that (it appears) that the convention of "an unlabeled parameter means it's the A component" doesn't apply to the magnitudes. Rather, the unlabeled magnitudes are (it appears) the sum of the listed A, B, and C component magnitudes.

The first one is really the only important one, but the other two are just a bit of an issue with consistency.

(And great code, by the way. Really pretty easy to use.)

timothydmorton commented 8 years ago

Thanks! Just pushed a fix to the logL, logg, and Teff samples for the Binary and Triple models. You're right about the inconsistency b/w 'mass' and the magnitudes, but I'll probably leave that as is, rather than adding duplicate columns or risking breaking something.

Sleekery commented 8 years ago

As a follow up to this, is there a way to input B (or C) components for, say, mass as the starting parameters in the same way I can for the A component? I realize that, at this point, I'm basically using Isochrones to fit a binary set of stars where my inputs are already pretty much what I need (mass, radius, Teff, logg). Something like:

model=BinaryStarModel(dar,mass=mass, mass_B=mass_B, radius=radius, feh=feh, Teff=Teff, logg=logg)

where I can specifically ask for it to work within a mass_B range?

timothydmorton commented 8 years ago

So it should work now to give mass_B and mass_C as constrained properties of the star just like anything else; I just pushed a simple change that should enable this, but haven't tested it myself, so let me know if it behaves as expected.

Sleekery commented 8 years ago

I'm getting this error:

Sampling finished. Exiting MultiNest Traceback (most recent call last): File "fitstars.py", line 109, in model.fit_multinest(basename='./'+chainname+'/'+epic+'/',overwrite=True,verbose=True) File "/Users/Otter/anaconda/lib/python2.7/site-packages/isochrones-0.9.0-py2.7.egg/isochrones/starmodel.py", line 1724, in fit_multinest super(TripleStarModel, self).fit_multinest(basename=basename, **kwargs)
File "/Users/Otter/anaconda/lib/python2.7/site-packages/isochrones-0.9.0-py2.7.egg/isochrones/starmodel.py", line 550, in fit_multinest self._make_samples() File "/Users/Otter/anaconda/lib/python2.7/site-packages/isochrones-0.9.0-py2.7.egg/isochrones/starmodel.py", line 1891, in _make_samples df['logl_B'] = df_B['logl'] File "/Users/Otter/anaconda/lib/python2.7/site-packages/pandas/core/frame.py", line 1678, in getitem return self._getitem_column(key) File "/Users/Otter/anaconda/lib/python2.7/site-packages/pandas/core/frame.py", line 1685, in _getitem_column return self._get_item_cache(key) File "/Users/Otter/anaconda/lib/python2.7/site-packages/pandas/core/generic.py", line 1052, in _get_item_cache values = self._data.get(item) File "/Users/Otter/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 2565, in get loc = self.items.get_loc(item) File "/Users/Otter/anaconda/lib/python2.7/site-packages/pandas/core/index.py", line 1181, in get_loc return self._engine.get_loc(_values_from_object(key)) File "index.pyx", line 129, in pandas.index.IndexEngine.get_loc (pandas/index.c:3656) File "index.pyx", line 149, in pandas.index.IndexEngine.get_loc (pandas/index.c:3534) File "hashtable.pyx", line 696, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11911) File "hashtable.pyx", line 704, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11864) KeyError: 'logl'

Not really sure if it's on my end or not. I'm not really that familiar with git stuff, but I've tried it a bunch of times different ways, and it keeps coming down to this error. Looks like it's from the last fix prior to the mass constraints. I'm thinking maybe I didn't properly update it after the last fix, so this error is from the logl_B stuff rather than the new mass_B constraints?

timothydmorton commented 8 years ago

OK, sorry about that--- looks like it should have been 'logL' rather than 'logl'; my mistake. Try it again. If you've already cloned the repository, go back into the repository directory, run git pull; python setup.py install and you should get all the most recent changes.

If you haven't cloned the repository:

git clone https://github.com/timothydmorton/isochrones
cd isochrones
python setup.py install
Sleekery commented 8 years ago

Everything is good here now. Thanks, Tim.