GithubHelp home page GithubHelp logo

timothydmorton / isochrones Goto Github PK

View Code? Open in Web Editor NEW
117.0 12.0 63.0 129.88 MB

Pythonic stellar model grid access; easy MCMC fitting of stellar properties

Home Page: http://isochrones.readthedocs.org

License: MIT License

Python 0.93% Jupyter Notebook 99.07% Shell 0.01%

isochrones's Introduction

isochrones

https://travis-ci.com/timothydmorton/isochrones.svg?branch=master

Provides simple interface for interacting with stellar model grids.

https://isochrones.readthedocs.io

Basic Usage

For simplest out-of-the-box usage after installation, make a file called star.ini that looks something like this:

Teff = 5770, 100
feh = 0.0, 0.15
logg = 4.5, 0.1
V = 10.0, 0.05

Any combination of spectroscopic or [supported] photometric properties, as well as parallax, can go as properties into this file.

Once you've made this file, type starfit at the command line. Or if you want to be organized, you can put star.ini in a folder called mystar [or whatever] and run starfit mystar from the command line. The starfit script will create an HDF5 file containing the saved StarModel, which you can load from python using StarModel.load_hdf, as well as triangle plots illustrating the fit.

Attribution

If you use isochrones in your research, please cite this ASCL reference.

isochrones's People

Contributors

adrn avatar atw5179 avatar benmontet avatar dfm avatar sam-2727 avatar segasai avatar simonrw avatar smoh avatar stuartlittlefair avatar syrte avatar timothydmorton avatar tomwagg avatar vedantchandra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

isochrones's Issues

Explore tri-cubic interpolation

Would be great to be able to implement tri-cubic interpolation if it could be of comparable efficiency as the current NDLinearInterpolator implementation.

Maybe adapting this?

Some MIST_Isochrone.isochrone() cause ZeroDivisionError

The following results in ZeroDivisionError. This seems to happen for feh values which lie exactly on the MIST grids, but not for all ages. For example, age=9.0 works fine.

mist = MIST_Isochrone()
iso3 = mist.isochrone(8.0, feh=0.0)

Can't install 1.0: AttributeError: 'module' object has no attribute '_base'

Not sure why the installation is failing. I downloaded the data files by hand and moved them to ~/.isochrones, and for good measure uninstalled the older (0.9.1) version of isochrones that came bundled earlier using:

pip uninstall isochrones
pip install isochrones

But the module doesn't load into python:


Python 2.7.12 |Anaconda 2.2.0 (x86_64)| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

import isochrones
Traceback (most recent call last):
File "", line 1, in
File "//anaconda/lib/python2.7/site-packages/isochrones/init.py", line 10, in
from .isochrone import Isochrone, get_ichrone
File "//anaconda/lib/python2.7/site-packages/isochrones/isochrone.py", line 2, in
import pandas as pd
File "//anaconda/lib/python2.7/site-packages/pandas/init.py", line 53, in
from pandas.io.api import *
File "//anaconda/lib/python2.7/site-packages/pandas/io/api.py", line 10, in
from pandas.io.html import read_html
File "//anaconda/lib/python2.7/site-packages/pandas/io/html.py", line 25, in
import bs4
File "//anaconda/lib/python2.7/site-packages/bs4/init.py", line 30, in
from .builder import builder_registry, ParserRejectedMarkup
File "//anaconda/lib/python2.7/site-packages/bs4/builder/init.py", line 311, in
from . import _html5lib
File "//anaconda/lib/python2.7/site-packages/bs4/builder/_html5lib.py", line 57, in
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'

MIST hangs forever when NaNs included

For example, running this on Jupyter notebook (py3.6):

mist = MIST_Isochrone()
#masses, logages, FeHs:
m,a,f=np.random.normal(1.0,0.1,1000),np.random.normal(8.5,0.1,1000),np.random.normal(0.0,0.1,1000)
rads0=mist.radius(m,a,f) #this works fine
#Adding some NaNs in the logage
chx=np.random.random(1000)
a[chx>0.45]=np.tile(np.nan,(chx>0.45).sum())
#Running
rads=mist.radius(m,a,f)

The code just hangs infinitely, and I have to manually kill the kernel (interrupting doesn't work) and run everything else in my ipynb again.

I could definitely just put some code to catch them and return NaNs instead of running mist.radius, but equally I feel like this could be put in the function itself, and certainly any infinite loops should be caught and excepted!

Make StarModel compatible with stellar companions that may be detected in differing filters

Currently, the following star.ini file is incompatible with StarModel because the companion stars were not all detected in the same filters.

maxAV = 0.162
RA = 287.69800
dec = 42.338718
Teff = 5465, 109
feh = 0.020, 0.150
logg = 4.449, 0.085

[twomass]
J = 11.252, 0.021
H = 10.910, 0.019
K = 10.871, 0.013

[Lick]
resolution = 0.5
separation_1 = 3.842
PA_1 = 53.056
H_1 = 4.343, 0.010000000000000231
K_1 = 4.105, 0.054999999999999716
separation_2 = 12.073
PA_2 = 256.378
H_2 = 7.488, 0.010000000000000231

Those companions that have detections in filters where others were not detected have useful color information that should be included, but currently cannot be. This would be a useful adjustment to the StarModel class.

ValueError when trying to use mod.corner_physical();

I'm getting this error when trying to use mod.corner_physical, my star.ini file is set up just like the one in Input[40] of the demo notebook and the mod.fit() ran fine.

WARNING:root:Use Tim's version of corner to plot priors.
Traceback (most recent call last):

File "<ipython-input-1-bc545b48eeb0>", line 1, in <module>
    runfile('/Users/Austin/star_ini_test.py', wdir='/Users/Austin')

File "/Users/Austin/anaconda/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)

File "/Users/Austin/anaconda/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

File "/Users/Austin/star_ini_test.py", line 20, in <module>
    mod5.corner_physical();

File "/Users/Austin/anaconda/lib/python3.6/site-packages/isochrones-1.0-py3.6.egg/isochrones/starmodel.py", line 951, in corner_physical
    return self.corner(props, range=rng, **kwargs)

File "/Users/Austin/anaconda/lib/python3.6/site-packages/isochrones-1.0-py3.6.egg/isochrones/starmodel.py", line 927, in corner
    fig = corner.corner(df[params], labels=params, **kwargs)

File "/Users/Austin/anaconda/lib/python3.6/site-packages/corner-2.0.1-py3.6.egg/corner/corner.py", line 240, in corner
    range=np.sort(range[i]), **hist_kwargs)

File "/Users/Austin/anaconda/lib/python3.6/site-packages/matplotlib/__init__.py", line 1898, in inner
    return func(ax, *args, **kwargs)

File "/Users/Austin/anaconda/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 6195, in hist
    m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)

File "/Users/Austin/anaconda/lib/python3.6/site-packages/numpy/lib/function_base.py", line 669, in histogram
'range parameter must be finite.')

ValueError: range parameter must be finite.`

This is what my star.ini file looks like:

maxAV = 0.217
RA = 283.23581
dec = 41.34304
Teff = 5925, 118
feh = -0.25, 0.15
logg = 4.36, 0.15

[KIC]
g = 12.172, 0
r = 11.749, 0
i = 11.666, 0
z = 11.632, 0

[twomass]
J = 10.797, 0.023
H = 10.516, 0.023
K = 10.424, 0.019

[Lick]
resolution = 0.5
separation_1 = 0.897
PA_1 = 96.871
K_1 = 0.286, 0.1
H_1 = 0.295, 0.1
separatin_2 = 5.765
PA_2 = 174.188
H_2 = 8.058, 0.1
separation_3 = 13.879
PA_3 = 316.172
H_3 = 7.682, 0.1

AttributeError: 'Delaunay' object has no attribute '_points'

Getting an error when running nosetests and when trying to execute model.fit().

File "/Users//MultiNest/build/PyMultiNest/isochrones/isochrones/isochrone.py", line 145, in init
self.mass = interpnd(self.tri,m_act)
File "scipy/interpolate/interpnd.pyx", line 243, in scipy.interpolate.interpnd.LinearNDInterpolator.init (scipy/interpolate/interpnd.c:4934)
File "scipy/interpolate/interpnd.pyx", line 71, in scipy.interpolate.interpnd.NDInterpolatorBase.init (scipy/interpolate/interpnd.c:2298)
File "scipy/spatial/qhull.pyx", line 1910, in scipy.spatial.qhull.Delaunay.points (scipy/spatial/qhull.c:18057)
AttributeError: 'Delaunay' object has no attribute '_points'

Maybe there was an update where this is no longer an attribute? Can't seem to find anything on the internet.

Bug in the demo.ipynb

Running through the demo notebook as downloaded, I get to cell 10

dar = Dartmouth_Isochrone()
dar.bands #default bands

and get the following error:


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-45bde7a2afff> in <module>()
----> 1 dar = Dartmouth_Isochrone()
      2 dar.bands #default bands

//anaconda/lib/python2.7/site-packages/isochrones/dartmouth/isochrone.pyc in __init__(self, bands, afe, y, **kwargs)
     87                            df['feh'].values,df['MMo'].values, df['LogLLo'].values,
     88                            10**df['LogTeff'].values,df['LogG'].values,mags,tri=TRI,
---> 89                            **kwargs)
     90 
     91     def agerange(self, m, feh=0.0):

//anaconda/lib/python2.7/site-packages/isochrones/isochrone.pyc in __init__(self, m_ini, age, feh, m_act, logL, Teff, logg, mags, tri, minage, maxage, ext_table)
    141         else:
    142             self.tri = tri
--> 143             self.mass = interpnd(self.tri,m_act)
    144 
    145         self._data = {'mass':m_act,

scipy/interpolate/interpnd.pyx in scipy.interpolate.interpnd.LinearNDInterpolator.__init__ (scipy/interpolate/interpnd.c:4934)()

scipy/interpolate/interpnd.pyx in scipy.interpolate.interpnd.NDInterpolatorBase.__init__ (scipy/interpolate/interpnd.c:2298)()

scipy/spatial/qhull.pyx in scipy.spatial.qhull.Delaunay.points (scipy/spatial/qhull.c:18057)()

AttributeError: 'Delaunay' object has no attribute '_points'

Python 3 failure with test_query.py

There is a failure when using python 3 caused because astroquer.vizier.Vizier returns bytes instead of strings in some columns and the assertions in test_query.py fail.

======================================================================
FAIL: Testing with first entry from Gaia DR1 TGAS table
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/miguel/Gaia/isochrones/isochrones/tests/test_query.py", line 14, in test_queries
    assert tm.get_id() == '03000819+0014074'
AssertionError: 
-------------------- >> begin captured logging << --------------------
root: WARNING: PyMultiNest not imported.  MultiNest fits will not work.
requests.packages.urllib3.connectionpool: DEBUG: Starting new HTTP connection (1): vizier.u-strasbg.fr
requests.packages.urllib3.connectionpool: DEBUG: http://vizier.u-strasbg.fr:80 "POST /viz-bin/votable HTTP/1.1" 200 3558
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 0.986s

FAILED (failures=1)

Make BinaryStarModel

In order to sample what possible multiple systems could be consistent with observable properties.

age, feh, distance, AV would be shared between primary and secondary, photometric properties would apply to the "sum" of the magnitudes of the two stars, and spectroscopic properties would apply only to the brighter component.

Segmentation fault when dowloading data

Python quits with a segmentation fault when I try to import isochrone models (e.g., import isochrones.dartmouth or from isochrones.padova import ...). This also happens after I download the data by hand and I just try to import the module, so I assume it must be because of the pd.read_hdf command (and just running pd.read_hdf confirms this). I seem to be able to open the file with h5py.

This is in IPython 2.1.0, Python 2.7.6 on Mac OS X Yosemite 10.10.2, pandas 0.16.0.

Minage/Maxage Initialization Fails for MIST But Works for Dartmouth

I can initiate a grid of Dartmouth isochrones with a minimum age with no error:

dar = Dartmouth_Isochrone(minage=(10))

But if I try the same command with MIST isochrones

mist = MIST_Isochrone(minage=(10))

I get the following error:


TypeError Traceback (most recent call last)
in ()
----> 1 mist = MIST_Isochrone(minage=(10))

TypeError: init() got an unexpected keyword argument 'minage'

WISE not in zenodo MIST

Hi Tim,

I was able to import with current master of isochrones, but was getting some tarball decompression error even after I did it manually in ~/.isochrones/mist/. I think this is because WISE is not in the current MIST model upload in zenodo, and the code keeps requiring it, trying to download and decompress the entire master tarball again.

Traceback:

> /Users/semyeong/projects/isochrones/isochrones/mist/grid.py(111)get_filenames()
    109         if not os.path.exists(d):
    110             if not os.path.exists(self.phot_tarball_file(phot, version=version)):
--> 111                 self.extract_master_tarball()
    112             self.extract_phot_tarball(phot, version=version)
    113 

ipdb> self.phot_tarball_file(phot,version=version)
'/Users/semyeong/.isochrones/mist/MIST_v1.0_WISE.tar.gz'

Just thought I'd let you know.

Improve treatment of extinction

Integrate over filters instead of relying on lookup table of effective wavelengths. This is absolutely necessary for broad bands like Gaia bands.

Test error when multinest is not installed

There is an error in test_fits when saving object data to HDF5 if multinest is not available:

======================================================================
ERROR: isochrones.tests.test_fits.test_fitting
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/miguel/Gaia/isochrones/isochrones/tests/test_fits.py", line 26, in test_fitting
    _check_saving(mod_dar)
  File "/home/miguel/Gaia/isochrones/isochrones/tests/test_fits.py", line 33, in _check_saving
    mod.save_hdf(filename)
  File "/home/miguel/Gaia/isochrones/isochrones/starmodel.py", line 1038, in save_hdf
    attrs._mnest_basename = self._mnest_basename
AttributeError: 'StarModel' object has no attribute '_mnest_basename'

Python 3.5 error: module 'urllib' has no attribute 'urlretrieve'

I am getting an error just running the first 3 lines of the example:

from isochrones.dartmouth import Dartmouth_Isochrone
dar = Dartmouth_Isochrone()
dar.radius(1.0, 9.7, 0.0) #M/Msun, log10(age), Fe/H
Below is the error message; apparently there is an issue with urlib.retrieve. I think this module is no more available with Python3.5. Not sure how to circumvent the problem, or if a fix has to be implemented to the code. Thank you!

Downloading Dartmouth stellar model data (should happen only once)...

AttributeError Traceback (most recent call last)
in ()
----> 1 from isochrones.dartmouth import Dartmouth_Isochrone
2 dar = Dartmouth_Isochrone()
3 dar.radius(1.0, 9.7, 0.0) #M/Msun, log10(age), Fe/H

//anaconda/lib/python3.5/site-packages/isochrones/dartmouth.py in ()
54
55 if not os.path.exists(MASTERFILE):
---> 56 _download_h5()
57
58 if not os.path.exists(TRI_FILE):

//anaconda/lib/python3.5/site-packages/isochrones/dartmouth.py in _download_h5()
38 if os.path.exists(MASTERFILE):
39 os.remove(MASTERFILE)
---> 40 urllib.urlretrieve(url,MASTERFILE)
41
42 def _download_tri():

AttributeError: module 'urllib' has no attribute 'urlretrieve'

small things

  • statements after return here -- must be leftover from moving it to utils.py.
  • There's no mention of units of parallax/returned distance in docstring or documentation. It looks like if I input in mas, I get distance in pc.

MIST_Isochrone.isochrone() inconsistent with MISTModelGrid.df isochrone

The code below produces two very different isochrones, where I expect them to be the same. This is true for the whole range of allowed (age, feh) which does not cause isochrone() to fail (that's another issue).

from isochrones.mist import MISTModelGrid, MIST_Isochrone
import numpy as np
from matplotlib import pyplot as plt

def test(age=9.0, feh=0.0):
    age_Gyr = 10.**age/1e9
    
    grid = MISTModelGrid(['B', 'V'])
    sel = np.isclose(grid.df.feh, feh) & np.isclose(grid.df.log10_isochrone_age_yr, age)
    iso1 = grid.df[sel]
    
    mist = MIST_Isochrone()
    iso2 = mist.isochrone(age, feh=feh)
    
    plt.figure()
    plt.plot(iso1.log_Teff, iso1.log_L, 'r-', label='grid.df')
    plt.plot(np.log10(iso2.Teff), iso2.logL, 'b-', label='mist.isochrone')
    plt.gca().invert_xaxis()
    plt.xlabel('log(Teff)')
    plt.ylabel('log(L)')
    plt.title("log(age)=%0.2f (%0.1f Gyr) [Fe/H]=%0.2f" % (age, age_Gyr, feh))
    plt.legend()
test()

isochrone_issue

Output properties in Binary and Triple fitting mode

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.)

HDFStore requires PyTables

I get the error:
ERROR: ImportError: HDFStore requires PyTables [pandas.io.pytables]
ERROR:astropy:ImportError: HDFStore requires PyTables

My guess is that the version of Pandas required in setup.py is not sufficiently high.

Bug in starmodel

Would submit a pull request but we're just about to run to lunch.

starmodel:441. "thresh_100" should be "lnprob_thresh_100". Causes failure in plotting and saving to hdf5 file.

All stars have radius of 0.98

(Well, they probably don't actually.)

But the following instructions result in essentially the same values for Teff from 3000-7000:

mist = MIST_Isochrone()
model  = StarModel(mist, Teff=(5770, 80), logg=(4.44, 0.08), feh=(0.,0.1))
model.fit()
model.samples['radius_0_0'].quantile([0.15,0.5,0.85])


0.15    0.922251
0.50    0.982562
0.85    1.064326

Add dependences list

Trying to install this package I was forced to first install numexpr and cython. Could this perhaps be added as needed dependencies so one knows and installs them in advance, to prevent the installation from halting twice?

Isochrone interpolation yields incorrect results

I have been trying to use the interpolation scheme fro the Dartmouth models, but this yield some strange results.

Tested in the following environment

1.0.0 >= scipy >= 0.12.0
numpy= 1.13.3
pandas= 0.20.3
python 2.7.3

from matplotlib import pyplot as plt
import numpy as np

from isochrones.dartmouth import Dartmouth_Isochrone, DartmouthModelGrid

dar = Dartmouth_Isochrone()
d = DartmouthModelGrid(['g', 'r']).df

g = dar.mag['g']
r = dar.mag['r']

## Original grid
plt.figure(figsize=(4,6))
j = (d['age']==9)&(d['feh']==-2.5)
plt.plot(d['g'][j]-d['r'][j], d['g'][j], 'k-', lw=2, label="1.00 Gyr")
j = (d['age']>9)&(d['age']< 9.097)&(d['feh']==-2.5)
plt.plot(d['g'][j]-d['r'][j], d['g'][j], 'b-', lw=2, label="1.25 Gyr")

## Interpolated model
mm = np.arange(0.1,3, 0.00001)
tg = g(mm, 9.05, -2.5)
tr = r(mm, 9.05, -2.5)

plt.plot(tg-tr,tg,'r-', lw=2, label='1.12Gyr (interp)')
plt.ylim(plt.ylim()[::-1])
plt.legend(loc='best')
plt.xlabel('g-r')
plt.ylabel('g')
plt.savefig('test.png')

teste
Sorry for the chopped axis label.

unsupported operand type(s) for /: 'NoneType' and 'float'

Hello Tim,

I just installed isochrones and I am running the example you provided in the documentation:

import numpy as np
from isochrones import StarModel
from isochrones.dartmouth import Dartmouth_Isochrone

#spectroscopic properties (value, uncertainty)
Teff = (5770, 80)
logg = (4.44, 0.08)
feh = (0.00, 0.10)

dar = Dartmouth_Isochrone()

model  = StarModel(dar, Teff=Teff, logg=logg, feh=feh)

Till here everything is working fine without any errors. However, when I execute the command:

model.fit()

I get the following error:

TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

Can you please tell me how to fix this error.

Age of the Sun

Hi Tim,

Maybe I'm doing something embarrasing wrong, but I'm not able to get the right age of the Sun (4.567Gyr) using Dartmouth isochrones.

import numpy as np
from isochrones.dartmouth import Dartmouth_Isochrone
dar = Dartmouth_Isochrone()
mass, feh = 1.00, 0.00
age10 = dar.agerange(mass, feh)
age10 = np.mean(age10)
age = 10**age10/1e9  # This is 3.490Gyr

Dartmouth Isochrones: support for HST/WFC3-UVIS+IR

I would like to use this program to type stars in the LMC from the Dartmouth isochrones using archival HST Wfc3 Uvis and IR data. When I use your isochrone program though this is not an option for the Dartmouth isochrones:
-->DartmouthModelGrid.phot_bands
{'LSST': ['LSST_r', 'LSST_u', 'LSST_y', 'LSST_z', 'LSST_g', 'LSST_i'],
'SDSSugriz': ['sdss_z', 'sdss_i', 'sdss_r', 'sdss_u', 'sdss_g'],
'UBVRIJHKsKp': ['B', 'I', 'H', 'J', 'Ks', 'R', 'U', 'V', 'D51', 'Kp'],
'UKIDSS': ['Y', 'H', 'K', 'J', 'Z'],
'WISE': ['W4', 'W3', 'W2', 'W1']}

. Is there anyway to include the phot bands that I need?

The Dartmouth page has a calculator at:
http://stellar.dartmouth.edu/models/isolf_new.html
and the bands I am interested in are in the "Colors" pull down menu.

Thanks!
Luke Hovey

Support for Baraffe et al. models

First, thanks for making this code open source and available.
I am curious about adding support for the Baraffe et al. (e.g. BCAH 2002, BHAC 2015) pre-main sequence evolutionary models:
http://perso.ens-lyon.fr/isabelle.baraffe/

My guess on how to get started is basically just copy from one of the existing example models:

  • Make a new BHAC_Isochrone Class that inherits from Isochrone.
  • Create, and save to HDF5, a master dataframe mimicking the structure of the existing dataframes.

This seems straighforward, but the devil is in the details. For example, one difference is that the Baraffe et al. models have fixed metallicity, so there'd be a delta function in Fe/H that could screw up parts of the code that are expecting this to be another dimension.

I'll see if this will work, but any tips or caveats are welcomed here.

Triangle plot is called corner now

I get the following warning when using the code:

from isochrones.dartmouth import Dartmouth_Isochrones

WARNING:root:Deprecation Warning: 'triangle' has been renamed to 'corner'. This shim should continue to work but you should use 'import corner' in new code. https://github.com/dfm/corner.py

I think it should just be editing line 27 here, but you might import it other places. And of course set corner as a new dependency.

Fail to read Dartmouth_Isochrone

I fail to initialize Dartmouth_Isochrone:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-33-643606627c59> in <module>()
----> 1 dar = Dartmouth_Isochrone()

~/projects/opensource/isochrones/isochrones/dartmouth/isochrone.py in __init__(self, bands, afe, y, **kwargs)
     87                            df['feh'].values,df['MMo'].values, df['LogLLo'].values,
     88                            10**df['LogTeff'].values,df['LogG'].values,mags,tri=TRI,
---> 89                            **kwargs)
     90 
     91     def agerange(self, m, feh=0.0):

~/projects/opensource/isochrones/isochrones/isochrone.py in __init__(self, m_ini, age, feh, m_act, logL, Teff, logg, mags, tri, minage, maxage, ext_table)
    143         else:
    144             self.tri = tri
--> 145             self.mass = interpnd(self.tri,m_act)
    146 
    147         self._data = {'mass':m_act,

scipy/interpolate/interpnd.pyx in scipy.interpolate.interpnd.LinearNDInterpolator.__init__ (scipy/interpolate/interpnd.c:5484)()

scipy/interpolate/interpnd.pyx in scipy.interpolate.interpnd.NDInterpolatorBase.__init__ (scipy/interpolate/interpnd.c:2621)()

scipy/spatial/qhull.pyx in scipy.spatial.qhull.Delaunay.points (scipy/spatial/qhull.c:18892)()

AttributeError: 'Delaunay' object has no attribute '_points'

https://gist.github.com/smoh/ea7505cdf227feb61b49755f71f2abe2

Do you think the picked file darthmouth.tri is outdated or something?
(I downloaded the file for the first time as you can see)

MIST B and V bands are not Tycho-2 mags

The docstring for the MIST isochrone says that the B and V mags are Tycho-2 mags:

:param bands: (optional)
    List of desired photometric bands.  Default list of bands is
    ``['G','B','V','J','H','K','W1','W2','W3','g','r','i','z','Kepler']``.
    Here ``B`` and ``V`` are Tycho-2 mags, `griz` are SDSS, and ``G`` is
    Gaia G-band.

However, I think it is actually using the Bessell B and V. The get_band function in isochrones/mist/grid.py has:

    # Default to SDSS for these
    if b in ['u','g','r','i','z']:
        phot = 'SDSS'
        band = 'SDSS_{}'.format(b)
    # elif b in ['B','V']:
    #     phot = 'UBVRIplus'
    #     band = 'Tycho_{}'.format(b)
    elif b in ['U','B','V','R','I']:
        phot = 'UBVRIplus'
        band = 'Bessell_{}'.format(b)

If I want to actually use the Tycho-2 mags, I should uncomment the above and change the effective wavelengths in data/filters.txt?

Thanks!

Not sure if model.fit() is working...

Here's what I'm running in spyder

from isochrones import StarModel
from isochrones.dartmouth import Dartmouth_Isochrone

Teff = (5770, 80)
logg = (4.44, 0.08)
feh = (0.00, 0.10)
V = (10.0,0.05)
dar = Dartmouth_Isochrone()
model = StarModel(dar, Teff=Teff, logg=logg, feh=feh)
model.fit()

Should something be happening? It's possible it's running successfully and I just don't know how to access the parameters? (Mass, radius, etc).

StarModel fails without pymultinest

When importing the library or running the nosetests i get the following error:

File /anaconda2/lib/python2.7/site-packages/isochrones/starmodel.py", line 16, in
import pymultinest
ImportError: No module named pymultinest

When going through the code I noticed that there aren't any library import checks in starmodel.py as opposed to starmodel_old.py

mnest_available = True
try:
    import pymultinest
except ImportError:
    logging.warning('PyMultiNest not available; only emcee fits will be possible.')
    pymultinest = None
    mnest_available = False

Does the new model supports computations without pymultinest being installed or should we use the old model instead?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.