Skip to content

Commit

Permalink
Isochrone example, read model spectra in magnitudes, resample a calib…
Browse files Browse the repository at this point in the history
…ration spectrum, and several small improvements
  • Loading branch information
Tomas Stolker committed Aug 21, 2019
1 parent 8945339 commit d5d237a
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 107 deletions.
Binary file added docs/_images/isochrone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,3 +379,102 @@ In this example we fit the available photometry of beta Pic b with the DRIFT-PHO
.. image:: _images/betapic.png
:width: 100%
:align: center

Isochrone data
--------------

When creating a color-magnitude diagram, various data can be combined such as photometry of isolated brown dwarfs, synthetic photometry of spectra, individual objects, and isochrone data from evolutionary models. Isochrones from the |phoenix| website can be imported into the database after which the related atmospheric models can be used to calculate synthetic photometry for a given age and a range of masses. Alternatively, it is also possible to interpolate the magnitudes of the isochrone data directly. The example below reads and interpolates the AMES-Cond and AMES-Dusty isochrones at 20 Myr, uses these evolutionary data for the computation of synthetic photometry, and plots the isochrones in a color-magnitude diagram together with photometry of field dwarfs and directly imaged companions.

.. code-block:: python
import species
import numpy as np
mass = np.logspace(-1., 4., 100) # [Mjup]
species.SpeciesInit('./')
database = species.Database()
# Add the relevant data to the database
database.add_companion(name=None)
database.add_photometry(library='vlm-plx')
database.add_photometry(library='leggett')
database.add_model(model='ames-cond',
wavelength=(0.5, 10.),
teff=(100., 4000.),
specres=1000.)
database.add_model(model='ames-dusty',
wavelength=(0.5, 10.),
teff=(100., 4000.),
specres=1000.)
database.add_isochrones(filename='/path/to/model.AMES-dusty.M-0.0.MKO.Vega',
tag='iso_dusty')
database.add_isochrones(filename='/path/to/model.AMES-Cond-2000.M-0.0.MKO.Vega',
tag='iso_cond')
# Create synthetic photometry for isochrones
readiso1 = species.ReadIsochrone(tag='iso_cond')
readiso2 = species.ReadIsochrone(tag='iso_dusty')
modelcolor1 = readiso1.get_color_magnitude(age=20.,
mass=mass,
model='ames-cond',
filters_color=('MKO/NSFCam.H', 'MKO/NSFCam.Lp'),
filter_mag='MKO/NSFCam.Lp')
modelcolor2 = readiso2.get_color_magnitude(age=20.,
mass=mass,
model='ames-dusty',
filters_color=('MKO/NSFCam.H', 'MKO/NSFCam.Lp'),
filter_mag='MKO/NSFCam.Lp')
# Directly imaged companions
objects = (('beta Pic b', 'Paranal/NACO.H', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('HIP 65426 b', 'Paranal/SPHERE.IRDIS_D_H23_2', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('PZ Tel B', 'Paranal/NACO.H', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('HD 206893 B', 'Paranal/SPHERE.IRDIS_B_H', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('51 Eri b', 'MKO/NSFCam.H', 'Keck/NIRC2.Lp', 'Keck/NIRC2.Lp'),
('HR 8799 b', 'Keck/NIRC2.H', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('HR 8799 c', 'Keck/NIRC2.H', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('HR 8799 d', 'Keck/NIRC2.H', 'Paranal/NACO.Lp', 'Paranal/NACO.Lp'),
('GSC 06214 B', 'MKO/NSFCam.H', 'MKO/NSFCam.Lp', 'MKO/NSFCam.Lp'),
('ROXs 42 Bb', 'Keck/NIRC2.H', 'Keck/NIRC2.Lp', 'Keck/NIRC2.Lp'))
# Field dwarfs from photometric libraries
colormag = species.ReadColorMagnitude(library=('vlm-plx', 'leggett'),
filters_color=('MKO/NSFCam.H', 'MKO/NSFCam.Lp'),
filter_mag='MKO/NSFCam.Lp')
colorbox = colormag.get_color_magnitude(object_type='field')
# Make color-magnitude diagram
species.plot_color_magnitude(colorbox=colorbox,
objects=objects,
isochrones=None,
models=(modelcolor1, modelcolor2),
label_x='H - L$^\prime$ [mag]',
label_y='M$_\mathregular{L\prime}$ [mag]',
xlim=(-0, 5),
ylim=(15.65, 4),
offset=(-0.07, -0.1),
legend='upper right',
output='isochrones.pdf')
.. image:: _images/isochrone.png
:width: 60%
:align: center

.. |phoenix| raw:: html

<a href="https://phoenix.ens-lyon.fr/Grids/" target="_blank">PHOENIX</a>
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ corner ~= 2.0
emcee ~= 2.2
h5py ~= 2.9
matplotlib ~= 3.0
numpy ~= 1.16
numpy ~= 1.17
pandas ~= 0.24
progress ~= 1.5
scipy ~= 1.3
Expand Down
2 changes: 2 additions & 0 deletions species/core/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def create_box(boxtype,
box.wavelength = kwargs['wavelength']
box.flux = kwargs['flux']
box.parameters = kwargs['parameters']
box.quantity = kwargs['quantity']

elif boxtype == 'object':
box = ObjectBox()
Expand Down Expand Up @@ -205,6 +206,7 @@ def __init__(self):
self.wavelength = None
self.flux = None
self.parameters = None
self.quantity = None


class ObjectBox(Box):
Expand Down
65 changes: 33 additions & 32 deletions species/data/companions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@ def get_data():
-------
dict
Dictionary with the distances and apparent magnitudes of directly imaged companions.
Distances are from GAIA DR2 unless indicated as comment.
"""

data = {'beta Pic b': {'distance': 19.75,
data = {'beta Pic b': {'distance': (19.75, 0.13),
'app_mag': {'Paranal/NACO.J': (14.11, 0.21), # Currie et al. 2013
'Gemini/NICI.ED286': (13.18, 0.15), # Males et al. (2014)
'Paranal/NACO.H': (13.32, 0.14), # Currie et al. 2013
'Paranal/NACO.Ks': (12.64, 0.11), # Bonnefoy et al. (2011)
'Paranal/NACO.NB374': (11.24, 0.15), # Stolker et al. in prep.
'Paranal/NACO.NB374': (11.25, 0.12), # Stolker et al. in prep.
'Paranal/NACO.Lp': (11.30, 0.06), # Stolker et al. (2019)
'Paranal/NACO.NB405': (11.03, 0.06), # Stolker et al. in prep.
'Paranal/NACO.NB405': (11.02, 0.04), # Stolker et al. in prep.
'Paranal/NACO.Mp': (11.10, 0.12)}}, # Stolker et al. (2019)

'HIP 65426 b': {'distance': 109.21,
'HIP 65426 b': {'distance': (109.21, 0.75),
'app_mag': {'Paranal/SPHERE.IRDIS_D_H23_2': (17.94, 0.05), # Chauvin et al. 2017
'Paranal/SPHERE.IRDIS_D_H23_3': (17.58, 0.06), # Chauvin et al. 2017
'Paranal/SPHERE.IRDIS_D_K12_1': (17.01, 0.09), # Chauvin et al. 2017
'Paranal/SPHERE.IRDIS_D_K12_2': (16.79, 0.09), # Chauvin et al. 2017
'Paranal/NACO.Lp': (15.34, 0.16), # Stolker et al. in prep.
'Paranal/NACO.NB405': (15.41, 0.30), # Stolker et al. in prep.
'Paranal/NACO.Mp': (14.82, 0.35)}}, # Stolker et al. in prep.
'Paranal/NACO.Lp': (15.29, 0.11), # Stolker et al. in prep.
'Paranal/NACO.NB405': (15.27, 0.19), # Stolker et al. in prep.
'Paranal/NACO.Mp': (14.66, 0.22)}}, # Stolker et al. in prep.

'51 Eri b': {'distance': 29.78,
'51 Eri b': {'distance': (29.78, 0.12),
'app_mag': {'MKO/NSFCam.J': (19.04, 0.40), # Rajan et al. 2017
'MKO/NSFCam.H': (18.99, 0.21), # Rajan et al. 2017
'MKO/NSFCam.K': (18.67, 0.19), # Rajan et al. 2017
Expand All @@ -39,7 +40,7 @@ def get_data():
'Keck/NIRC2.Lp': (16.20, 0.11), # Rajan et al. 2017
'Keck/NIRC2.Ms': (16.1, 0.5)}}, # Rajan et al. 2017

'HR 8799 b': {'distance': 41.29,
'HR 8799 b': {'distance': (41.29, 0.15),
'app_mag': {'Subaru/CIAO.z': (21.22, 0.29), # Currie et al. 2011
'Paranal/SPHERE.IRDIS_B_J': (19.78, 0.09), # Zurlo et al. 2016
'Keck/NIRC2.H': (18.05, 0.09), # Currie et al. 2012
Expand All @@ -52,7 +53,7 @@ def get_data():
'Paranal/NACO.NB405': (14.82, 0.18), # Currie et al. 2014
'Keck/NIRC2.Ms': (16.05, 0.30)}}, # Galicher et al. 2011

'HR 8799 c': {'distance': 41.29,
'HR 8799 c': {'distance': (41.29, 0.15),
'app_mag': {'Paranal/SPHERE.IRDIS_B_J': (18.60, 0.13), # Zurlo et al. 2016
'Keck/NIRC2.H': (17.06, 0.13), # Currie et al. 2012
'Paranal/SPHERE.IRDIS_D_H23_2': (17.09, 0.12), # Zurlo et al. 2016
Expand All @@ -64,7 +65,7 @@ def get_data():
'Paranal/NACO.NB405': (13.97, 0.11), # Currie et al. 2014
'Keck/NIRC2.Ms': (15.03, 0.14)}}, # Galicher et al. 2011

'HR 8799 d': {'distance': 41.29,
'HR 8799 d': {'distance': (41.29, 0.15),
'app_mag': {'Paranal/SPHERE.IRDIS_B_J': (18.59, 0.37), # Zurlo et al. 2016
'Keck/NIRC2.H': (16.71, 0.24), # Currie et al. 2012
'Paranal/SPHERE.IRDIS_D_H23_2': (17.02, 0.17), # Zurlo et al. 2016
Expand All @@ -76,7 +77,7 @@ def get_data():
'Paranal/NACO.NB405': (13.87, 0.15), # Currie et al. 2014
'Keck/NIRC2.Ms': (14.65, 0.35)}}, # Galicher et al. 2011

'HR 8799 e': {'distance': 41.29,
'HR 8799 e': {'distance': (41.29, 0.15),
'app_mag': {'Paranal/SPHERE.IRDIS_B_J': (18.40, 0.21), # Zurlo et al. 2016
'Paranal/SPHERE.IRDIS_D_H23_2': (16.91, 0.20), # Zurlo et al. 2016
'Paranal/SPHERE.IRDIS_D_H23_3': (16.68, 0.21), # Zurlo et al. 2016
Expand All @@ -86,19 +87,19 @@ def get_data():
'Paranal/NACO.Lp': (14.49, 0.21), # Currie et al. 2014
'Paranal/NACO.NB405': (13.72, 0.20)}}, # Currie et al. 2014

'HD 95086 b': {'distance': 86.44,
'HD 95086 b': {'distance': (86.44, 0.24),
'app_mag': {'Gemini/GPI.H': (20.51, 0.25), # De Rosa et al. 2016
'Gemini/GPI.K1': (18.99, 0.20), # De Rosa et al. 2016
'Paranal/NACO.Lp': (16.27, 0.19)}}, # De Rosa et al. 2016

'PDS 70 b': {'distance': 113.43,
'PDS 70 b': {'distance': (113.43, 0.52),
'app_mag': {'Paranal/SPHERE.IRDIS_D_H23_2': (17.94, 0.24), # Keppler et al. 2018
'Paranal/SPHERE.IRDIS_D_H23_3': (17.95, 0.17), # Keppler et al. 2018
'Paranal/SPHERE.IRDIS_D_K12_1': (16.65, 0.06), # Müller et al. 2018
'Paranal/SPHERE.IRDIS_D_K12_2': (16.44, 0.05), # Müller et al. 2018
'Paranal/NACO.Lp': (14.75, 0.62)}}, # Keppler et al. 2018

'2M1207 b': {'distance': 64.42,
'2M1207 b': {'distance': (64.42, 0.65),
'app_mag': {'HST/NICMOS1.F090M': (22.58, 0.35), # Song et al. 2006
'HST/NICMOS1.F110M': (20.61, 0.15), # Song et al. 2006
'HST/NICMOS1.F145M': (19.05, 0.03), # Song et al. 2006
Expand All @@ -108,20 +109,20 @@ def get_data():
'Paranal/NACO.Ks': (16.93, 0.11), # Chauvin et al. 2004
'Paranal/NACO.Lp': (15.28, 0.14)}}, # Chauvin et al. 2004

'AB Pic B': {'distance': 50.12,
'AB Pic B': {'distance': (50.12, 0.07),
'app_mag': {'Paranal/NACO.J': (16.18, 0.10), # Chauvin et al. 2005
'Paranal/NACO.H': (14.69, 0.10), # Chauvin et al. 2005
'Paranal/NACO.Ks': (14.14, 0.08)}}, # Chauvin et al. 2005

'HD 206893 B': {'distance': 40.81,
'HD 206893 B': {'distance': (40.81, 0.11),
'app_mag': {'Paranal/SPHERE.IRDIS_B_H': (16.79, 0.06), # Milli et al. 2016
'Paranal/SPHERE.IRDIS_D_K12_1': (15.2, 0.10), # Delorme et al. 2017
'Paranal/SPHERE.IRDIS_D_K12_2': (14.88, 0.09), # Delorme et al. 2017
'Paranal/NACO.NB405': (12.79, 0.59), # Stolker et al. in prep.
'Paranal/NACO.Lp': (14.01, 0.30), # Stolker et al. in prep.
'Paranal/NACO.Mp': (13.60, 0.54)}}, # Stolker et al. in prep.
'Paranal/NACO.Lp': (13.99, 0.32), # Stolker et al. in prep.
'Paranal/NACO.NB405': (12.85, 0.30), # Stolker et al. in prep.
'Paranal/NACO.Mp': (13.62, 0.36)}}, # Stolker et al. in prep.

'GQ Lup B': {'distance': 151.82,
'GQ Lup B': {'distance': (151.82, 1.10),
'app_mag': {'HST/WFPC2.f606w': (19.19, 0.07), # Marois et al. 2006
'HST/WFPC2.f814w': (17.67, 0.05), # Marois et al. 2006
'HST/NICMOS2.F171M': (13.84, 0.13), # Marois et al. 2006
Expand All @@ -131,7 +132,7 @@ def get_data():
'Subaru/CIAO.K': (13.37, 0.12), # Marois et al. 2006
'Subaru/CIAO.Lp': (12.44, 0.22)}}, # Marois et al. 2006

'PZ Tel B': {'distance': 47.13,
'PZ Tel B': {'distance': (47.13, 0.13),
'app_mag': {'Paranal/SPHERE.ZIMPOL_R_PRIM': (17.84, 0.31), # Maire et al. 2015
'Paranal/SPHERE.ZIMPOL_I_PRIM': (15.16, 0.12), # Maire et al. 2015
'Paranal/SPHERE.IRDIS_D_H23_2': (11.78, 0.19), # Maire et al. 2015
Expand All @@ -141,29 +142,29 @@ def get_data():
'Paranal/NACO.J': (12.47, 0.20), # Biller et al. 2010
'Paranal/NACO.H': (11.93, 0.14), # Biller et al. 2010
'Paranal/NACO.Ks': (11.53, 0.07), # Biller et al. 2010
'Paranal/NACO.NB405': (10.94, 0.07), # Stolker et al. in prep.
'Paranal/NACO.Lp': (11.27, 0.13), # Stolker et al. in prep
'Paranal/NACO.Mp': (11.08, 0.03), # Stolker et al. in prep.
'Paranal/NACO.Lp': (11.10, 0.14), # Stolker et al. in prep
'Paranal/NACO.NB405': (10.86, 0.08), # Stolker et al. in prep.
'Paranal/NACO.Mp': (10.96, 0.02), # Stolker et al. in prep.
'Gemini/NICI.ED286': (11.68, 0.14), # Biller et al. 2010
'Gemini/NIRI.H2S1v2-1-G0220': (11.39, 0.14)}}, # Biller et al. 2010

'kappa And b': {'distance': 50.06,
'kappa And b': {'distance': (50.06, 0.87),
'app_mag': {'Subaru/CIAO.J': (15.86, 0.21), # Bonnefoy et al. 2014
'Subaru/CIAO.H': (14.95, 0.13), # Bonnefoy et al. 2014
'Subaru/CIAO.Ks': (14.32, 0.09), # Bonnefoy et al. 2014
'Keck/NIRC2.Lp': (13.12, 0.1), # Bonnefoy et al. 2014
'Keck/NIRC2.NB_4.05': (13.0, 0.2), # Bonnefoy et al. 2014
'LBT/LMIRCam.M_77K': (13.3, 0.3)}}, # Bonnefoy et al. 2014

'ROXs 42 Bb': {'distance': 144.16,
'ROXs 42 Bb': {'distance': (144.16, 1.54),
'app_mag': {'Keck/NIRC2.J': (16.91, 0.11), # Daemgen et al. 2017
'Keck/NIRC2.H': (15.88, 0.05), # Daemgen et al. 2017
'Keck/NIRC2.Ks': (15.01, 0.06), # Daemgen et al. 2017
'Keck/NIRC2.Lp': (13.97, 0.06), # Daemgen et al. 2017
'Keck/NIRC2.NB_4.05': (13.90, 0.08), # Daemgen et al. 2017
'Keck/NIRC2.Ms': (14.01, 0.23)}}, # Daemgen et al. 2017

'GJ 504 b': {'distance': 17.54,
'GJ 504 b': {'distance': (17.54, 0.08),
'app_mag': {'Paranal/SPHERE.IRDIS_D_Y23_2': (20.98, 0.20), # Bonnefoy et al. 2018
'Paranal/SPHERE.IRDIS_D_Y23_3': (20.14, 0.09), # Bonnefoy et al. 2018
'Paranal/SPHERE.IRDIS_D_J23_3': (19.01, 0.17), # Bonnefoy et al. 2018
Expand All @@ -176,7 +177,7 @@ def get_data():
'Subaru/CIAO.CH4s': (19.58, 0.13), # Janson et al. 2013
'Subaru/IRCS.Lp': (16.70, 0.17)}}, # Kuzuhara et al. 2013

'GU Psc b': {'distance': 47.61,
'GU Psc b': {'distance': (47.61, 0.16),
'app_mag': {'Gemini/GMOS-S.z': (21.75, 0.07), # Naud et al. 2014
'CFHT/Wircam.Y': (19.4, 0.05), # Naud et al. 2014
'CFHT/Wircam.J': (18.12, 0.03), # Naud et al. 2014
Expand All @@ -185,19 +186,19 @@ def get_data():
'WISE/WISE.W1': (17.17, 0.33), # Naud et al. 2014
'WISE/WISE.W2': (15.41, 0.22)}}, # Naud et al. 2014

'2M0103 ABb': {'distance': 47.2,
'2M0103 ABb': {'distance': (47.2, 3.1), # Delorme et al. 2013
'app_mag': {'Paranal/NACO.J': (15.47, 0.30), # Delorme et al. 2013
'Paranal/NACO.H': (14.27, 0.20), # Delorme et al. 2013
'Paranal/NACO.Ks': (13.67, 0.20), # Delorme et al. 2013
'Paranal/NACO.Lp': (12.67, 0.10)}}, # Delorme et al. 2013

'1RXS 1609 B': {'distance': 139.67,
'1RXS 1609 B': {'distance': (139.67, 1.33),
'app_mag': {'Gemini/NIRI.J-G0202w': (17.90, 0.12), # Lafreniere et al. 2008
'Gemini/NIRI.H-G0203w': (16.87, 0.07), # Lafreniere et al. 2008
'Gemini/NIRI.K-G0204w': (16.17, 0.18), # Lafreniere et al. 2008
'Gemini/NIRI.Lprime-G0207w': (14.8, 0.3)}}, # Lafreniere et al. 2010

'GSC 06214 B': {'distance': 108.84,
'GSC 06214 B': {'distance': (108.84, 0.51),
'app_mag': {'MKO/NSFCam.J': (16.24, 0.04), # Ireland et al. 2011
'MKO/NSFCam.H': (15.55, 0.04), # Ireland et al. 2011
'MKO/NSFCam.Kp': (14.95, 0.05), # Ireland et al. 2011
Expand Down
Loading

0 comments on commit d5d237a

Please sign in to comment.