diff --git a/docs/overview.rst b/docs/overview.rst index c55ddd9..6f39cc2 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -25,6 +25,7 @@ The following data and models are currently supported: - `BT-NextGen `_ - `BT-Settl `_ - `BT-Settl-CIFIST `_ +- `coolTLUSTY Y dwarf `_ - `DRIFT-PHOENIX `_ - `Exo-REM `_ - `Morley et al. (2012) T/Y dwarf spectra `_ diff --git a/species/data/model_data/model_data.json b/species/data/model_data/model_data.json index 7b5ddf1..1412f78 100644 --- a/species/data/model_data/model_data.json +++ b/species/data/model_data/model_data.json @@ -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)", diff --git a/species/data/model_data/model_spectra.py b/species/data/model_data/model_spectra.py index eb39579..3cdb88e 100644 --- a/species/data/model_data/model_spectra.py +++ b/species/data/model_data/model_spectra.py @@ -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 @@ -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) @@ -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": diff --git a/species/util/model_util.py b/species/util/model_util.py index 189816c..5e17751 100644 --- a/species/util/model_util.py +++ b/species/util/model_util.py @@ -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 @@ -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