Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reddening vector in color-mag/color diagrams #11

Merged
merged 1 commit into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The following data are currently supported by *species* (support for other data
- Photometry from `Sandy Leggett <http://www.gemini.edu/staff/sleggett>`_
- Photometry of directly imaged planets and brown dwarfs (see dictionary in :class:`~species.data.companions`)
- Calibration spectrum of `Vega <http://ssb.stsci.edu/cdbs/calspec/>`_
- Optical constants compiled by `Mollière et al. (2019) <https://ui.adsabs.harvard.edu/abs/2019A%26A...627A..67M/abstract>`_ (see :func:`~species.data.database.Database.add_dust`)

Please give credit to the relevant authors when using these data in a publication. More information is available on the respective websites.

Expand Down
8 changes: 8 additions & 0 deletions docs/species.data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ species.data.drift\_phoenix module
:undoc-members:
:show-inheritance:

species.data.dust module
------------------------

.. automodule:: species.data.dust
:members:
:undoc-members:
:show-inheritance:

species.data.exo\_rem module
----------------------------

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ h5py ~= 2.10
matplotlib ~= 3.2
numpy ~= 1.18
pandas ~= 0.25
PyMieScatt ~= 1.7
pymultinest ~= 2.9
scipy ~= 1.4
spectres ~= 2.1
tqdm ~= 4.45
tqdm ~= 4.46
typeguard ~= 2.7
xlrd ~= 1.2
2 changes: 1 addition & 1 deletion species/analysis/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self,
self.filter_interp = None
self.wavel_range = None

self.vega_mag = 0.03 # [mag]
self.vega_mag = 0.03 # (mag)

config_file = os.path.join(os.getcwd(), 'species_config.ini')

Expand Down
6 changes: 3 additions & 3 deletions species/data/companions.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def get_data():
'Paranal/SPHERE.IRDIS_D_H23_3': (17.95, 0.17), # Keppler et al. 2018
'Paranal/SPHERE.IRDIS_D_K12_1': [(16.78, 0.31), (16.72, 0.05)], # Stolker et al. in prep.
'Paranal/SPHERE.IRDIS_D_K12_2': [(16.23, 0.32), (16.38, 0.06)], # Stolker et al. in prep.
# 'Paranal/NACO.Lp': (14.08, 0.33), # Stolker et al. in prep.
# 'Paranal/NACO.NB405': (13.91, 0.34), # Stolker et al. in prep.
# 'Paranal/NACO.Mp': (13.64, 0.22), # Stolker et al. in prep.
'Paranal/NACO.Lp': (14.08, 0.33), # Stolker et al. in prep.
'Paranal/NACO.NB405': (13.91, 0.34), # Stolker et al. in prep.
'Paranal/NACO.Mp': (13.64, 0.22), # Stolker et al. in prep.
'Keck/NIRC2.Lp': (14.64, 0.18)}}, # Wang et al. 2020

'PDS 70 c': {'distance': (113.43, 0.52),
Expand Down
39 changes: 38 additions & 1 deletion species/data/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from species.core import box, constants
from species.data import drift_phoenix, btnextgen, vega, irtf, spex, vlm_plx, leggett, \
companions, filters, btsettl, ames_dusty, ames_cond, \
isochrones, petitcode, exo_rem
isochrones, petitcode, exo_rem, dust
from species.read import read_model, read_calibration, read_planck
from species.util import data_util
# from species.util import data_util, retrieval_util
Expand Down Expand Up @@ -164,6 +164,43 @@ def add_companion(self,
distance=data[item]['distance'],
app_mag=data[item]['app_mag'])

@typechecked
def add_dust(self) -> None:
"""
Function for adding optical constants of MgSiO3 and Fe to the database. The optical
constants have been compiled by Mollière et al. (2019) for petitRADTRANS from the
following sources:

- MgSiO3, crystalline
- Scott & Duley (1996), ApJS, 105, 401
- Jäger et al. (1998), A&A, 339, 904

- MgSiO3, amorphous
- Jäger et al. (2003), A&A, 408, 193

- Fe, crystalline
- Henning & Stognienko (1996), A&A, 311, 291

- Fe, amorphous
- Pollack et al. (1994), ApJ, 421, 615

Returns
-------
NoneType
None
"""

h5_file = h5py.File(self.database, 'a')

if 'dust' in h5_file:
del h5_file['dust']

h5_file.create_group('dust')

dust.add_optical_constants(self.input_path, h5_file)

h5_file.close()

def add_filter(self,
filter_name,
filename=None):
Expand Down
92 changes: 92 additions & 0 deletions species/data/dust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
"""
Module for optical constants of dust grains.
"""

import os
import zipfile
import urllib.request

import h5py
import numpy as np

from typeguard import typechecked


@typechecked
def add_optical_constants(input_path: str,
database: h5py._hl.files.File) -> None:
"""
Function for adding the optical constants of crystalline and amorphous MgSiO3 and Fe to the
database.

Parameters
----------
input_path : str
Folder where the data is located.
database : h5py._hl.files.File
Database.

Returns
-------
None
NoneType
"""

if not os.path.exists(input_path):
os.makedirs(input_path)

url = 'https://people.phys.ethz.ch/~stolkert/species/optical_constants.zip'

data_file = os.path.join(input_path, 'optical_constants.zip')

if not os.path.isfile(data_file):
print('Downloading optical constants (87 kB)...', end='', flush=True)
urllib.request.urlretrieve(url, data_file)
print(' [DONE]')

print('Unpacking optical constants...', end='', flush=True)

with zipfile.ZipFile(data_file, 'r') as zip_ref:
zip_ref.extractall(input_path)

print(' [DONE]')

print('Adding optical constants of MgSiO3...', end='')

nk_file = os.path.join(input_path, 'optical_constants/mgsio3/crystalline/'
'mgsio3_jaeger_98_scott_96_axis1.dat')

data = np.loadtxt(nk_file)
database.create_dataset('dust/mgsio3/crystalline/axis_1/', data=data)

nk_file = os.path.join(input_path, 'optical_constants/mgsio3/crystalline/'
'mgsio3_jaeger_98_scott_96_axis2.dat')

data = np.loadtxt(nk_file)
database.create_dataset('dust/mgsio3/crystalline/axis_2/', data=data)

nk_file = os.path.join(input_path, 'optical_constants/mgsio3/crystalline/'
'mgsio3_jaeger_98_scott_96_axis3.dat')

data = np.loadtxt(nk_file)
database.create_dataset('dust/mgsio3/crystalline/axis_3/', data=data)

nk_file = os.path.join(input_path, 'optical_constants/mgsio3/amorphous/'
'mgsio3_jaeger_2003_reformat.dat')

data = np.loadtxt(nk_file)
database.create_dataset('dust/mgsio3/amorphous', data=data)

print(' [DONE]')

print('Adding optical constants of Fe...', end='')

nk_file = os.path.join(input_path, 'optical_constants/fe/crystalline/fe_henning_1996.dat')
data = np.loadtxt(nk_file)
database.create_dataset('dust/fe/crystalline', data=data)

nk_file = os.path.join(input_path, 'optical_constants/fe/amorphous/fe_pollack_1994.dat')
data = np.loadtxt(nk_file)
database.create_dataset('dust/fe/amorphous', data=data)

print(' [DONE]')
Loading