Skip to content

Commit

Permalink
Added support for coolTLUSTY Y dwarf spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstolker committed May 7, 2024
1 parent d0c97c6 commit d258d3b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 117 deletions.
1 change: 1 addition & 0 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following data and models are currently supported:
- `BT-NextGen <https://phoenix.ens-lyon.fr/Grids/BT-NextGen/SPECTRA/>`_
- `BT-Settl <http://svo2.cab.inta-csic.es/svo/theory/newov2/index.php?models=bt-settl>`_
- `BT-Settl-CIFIST <http://svo2.cab.inta-csic.es/svo/theory/newov2/index.php?models=bt-settl-cifist>`_
- `coolTLUSTY Y dwarf <https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract>`_
- `DRIFT-PHOENIX <http://svo2.cab.inta-csic.es/theory/newov2/index.php?models=drift>`_
- `Exo-REM <https://ui.adsabs.harvard.edu/abs/2018ApJ...854..172C/abstract>`_
- `Morley et al. (2012) T/Y dwarf spectra <https://ui.adsabs.harvard.edu/abs/2012ApJ...756..172M/abstract>`_
Expand Down
60 changes: 60 additions & 0 deletions species/data/model_data/model_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,66 @@
"reference": "Koester (2010)",
"url": "https://ui.adsabs.harvard.edu/abs/2010MmSAI..81..921K"
},
"lacy2023-clear-eq": {
"parameters": ["teff", "logg", "feh"],
"name": "coolTLUSTY clear EQ",
"file size": "136 MB",
"wavelength range": [0.45, 299.5],
"lambda/d_lambda": 4000,
"teff range": [200, 600],
"reference": "Lacy & Burrows (2023)",
"url": "https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract"
},
"lacy2023-clear-neq": {
"parameters": ["teff", "logg", "feh"],
"name": "coolTLUSTY clear NEQ",
"file size": "136 MB",
"wavelength range": [0.45, 299.5],
"lambda/d_lambda": 4000,
"teff range": [200, 600],
"reference": "Lacy & Burrows (2023)",
"url": "https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract"
},
"lacy2023-cloudy-thin-eq": {
"parameters": ["teff", "logg", "feh"],
"name": "coolTLUSTY thin clouds EQ",
"file size": "75 MB",
"wavelength range": [0.45, 299.5],
"lambda/d_lambda": 4000,
"teff range": [200, 450],
"reference": "Lacy & Burrows (2023)",
"url": "https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract"
},
"lacy2023-cloudy-thin-neq": {
"parameters": ["teff", "logg", "feh"],
"name": "coolTLUSTY thin clouds NEQ",
"file size": "67 MB",
"wavelength range": [0.45, 299.5],
"lambda/d_lambda": 4000,
"teff range": [200, 450],
"reference": "Lacy & Burrows (2023)",
"url": "https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract"
},
"lacy2023-cloudy-thick-eq": {
"parameters": ["teff", "logg", "feh"],
"name": "coolTLUSTY thick clouds EQ",
"file size": "73 MB",
"wavelength range": [0.45, 299.5],
"lambda/d_lambda": 4000,
"teff range": [200, 450],
"reference": "Lacy & Burrows (2023)",
"url": "https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract"
},
"lacy2023-cloudy-thick-neq": {
"parameters": ["teff", "logg", "feh"],
"name": "coolTLUSTY thick clouds NEQ",
"file size": "67 MB",
"wavelength range": [0.45, 299.5],
"lambda/d_lambda": 4000,
"teff range": [200, 450],
"reference": "Lacy & Burrows (2023)",
"url": "https://ui.adsabs.harvard.edu/abs/2023ApJ...950....8L/abstract"
},
"morley-2012": {
"parameters": ["teff", "logg", "fsed"],
"name": "Morley et al. (2012)",
Expand Down
17 changes: 5 additions & 12 deletions species/data/model_data/model_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import json
import os
import pathlib
import tarfile
import warnings

from pathlib import Path
from typing import Optional, Tuple

import h5py
Expand Down Expand Up @@ -80,7 +80,7 @@ def add_model_grid(
print(f"Database tag: {model_tag}")
print(f"Model name: {model_name}")

data_file = pathlib.Path(__file__).parent.resolve() / "model_data.json"
data_file = Path(__file__).parent.resolve() / "model_data.json"

with open(data_file, "r", encoding="utf-8") as json_file:
model_data = json.load(json_file)
Expand All @@ -90,16 +90,9 @@ def add_model_grid(

else:
raise ValueError(
f"The '{model_tag}' atmospheric model is not available. "
"Please choose one of the following models: "
"'ames-cond', 'ames-dusty', 'atmo', 'bt-settl', "
"'bt-nextgen', 'drift-phoexnix', 'petitcode-cool-clear', "
"'petitcode-cool-cloudy', 'petitcode-hot-clear', "
"'petitcode-hot-cloudy', 'exo-rem', 'bt-settl-cifist', "
"'bt-cond', 'bt-cond-feh', 'blackbody', 'sonora-cholla', "
"'sonora-bobcat', 'sonora-bobcat-co', 'koester-wd', "
"'saumon2008-clear', 'saumon2008-cloudy', 'petrus2023', "
"'sphinx'"
f"The '{model_tag}' atmospheric model is "
"not available. Please choose one of the "
f"following models: {list(model_data.keys())}"
)

if model_tag == "bt-settl":
Expand Down
114 changes: 9 additions & 105 deletions species/util/model_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
Utility functions for model spectra.
"""

import json
import warnings

from pathlib import Path
from typing import Dict, Tuple, Union

import numpy as np
Expand All @@ -30,113 +32,15 @@ def convert_model_name(in_name: str) -> str:
Updated model name for plots.
"""

if in_name == "drift-phoenix":
out_name = "DRIFT-PHOENIX"

elif in_name == "ames-cond":
out_name = "AMES-Cond"

elif in_name == "ames-dusty":
out_name = "AMES-Dusty"

elif in_name == "atmo":
out_name = "ATMO"

elif in_name == "atmo-ceq":
out_name = "ATMO CEQ"

elif in_name == "atmo-neq-weak":
out_name = "ATMO NEQ weak"

elif in_name == "atmo-neq-strong":
out_name = "ATMO NEQ strong"

elif in_name == "petrus2023":
out_name = "ATMO (Petrus et al. 2023)"

elif in_name == "atmo-petrus2023":
out_name = "ATMO (Petrus et al. 2023)"

elif in_name == "bt-cond":
out_name = "BT-Cond"

elif in_name == "bt-cond-feh":
out_name = "BT-Cond"

elif in_name == "bt-settl":
out_name = "BT-Settl"

elif in_name == "bt-settl-cifist":
out_name = "BT-Settl"

elif in_name == "bt-nextgen":
out_name = "BT-NextGen"

elif in_name == "bt-nextgen-subsolar":
out_name = "BT-NextGen"

elif in_name == "koester-wd":
out_name = "Koester (2010)"

elif in_name == "petitcode-cool-clear":
out_name = "petitCODE clear"

elif in_name == "petitcode-cool-cloudy":
out_name = "petitCODE cloudy"

elif in_name == "petitcode-hot-clear":
out_name = "petitCODE clear"

elif in_name == "petitcode-hot-cloudy":
out_name = "petitCODE cloudy"

elif in_name == "petitcode-linder2019-clear":
out_name = "petitCODE clear (Linder et al. 2019)"

elif in_name == "petitcode-linder2019-cloudy":
out_name = "petitCODE cloudy (Linder et al. 2019)"

elif in_name == "exo-rem":
out_name = "Exo-REM"

elif in_name == "exo-rem-highres":
out_name = "Exo-REM"

elif in_name in ["planck", "blackbody"]:
out_name = "Blackbody"

elif in_name == "zhu2015":
out_name = "Zhu (2015)"

elif in_name == "saumon2008-clear":
out_name = "Saumon & Marley (2008)"

elif in_name == "saumon2008-cloudy":
out_name = "Saumon & Marley (2008)"

elif in_name == "sonora-cholla":
out_name = "Sonora Cholla"

elif in_name == "sonora-bobcat":
out_name = "Sonora Bobcat"

elif in_name == "sonora-bobcat-co":
out_name = "Sonora Bobcat C/O"

elif in_name == "sonora-elfowl-l":
out_name = "Sonora Elf Owl"

elif in_name == "sonora-elfowl-t":
out_name = "Sonora Elf Owl"

elif in_name == "sonora-elfowl-y":
out_name = "Sonora Elf Owl"
data_file = (
Path(__file__).parent.resolve().parents[0] / "data/model_data/model_data.json"
)

elif in_name == "sphinx":
out_name = "SPHINX"
with open(data_file, "r", encoding="utf-8") as json_file:
model_data = json.load(json_file)

elif in_name == "petitradtrans":
out_name = "petitRADTRANS"
if in_name in model_data.keys():
out_name = model_data[in_name]["name"]

else:
out_name = in_name
Expand Down

1 comment on commit d258d3b

@gabrielastro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additions! About species/data/model_data/model_data.json: to reduce the file size 😉, it would be good to drop the /abstract part of the URL.

Please sign in to comment.