Skip to content

Commit

Permalink
Updated tutorial notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Stolker committed Jan 27, 2020
1 parent 95cc27d commit 3943707
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 193 deletions.
1 change: 0 additions & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ The following data are currently supported by *species* (support for other data
- All isochrone data from the `Phoenix model grids <https://phoenix.ens-lyon.fr/Grids/>`_
- Photometry from the `Database of Ultracool Parallaxes <http://www.as.utexas.edu/~tdupuy/plx/Database_of_Ultracool_Parallaxes.html>`_
- Photometry from `Sandy Leggett <http://www.gemini.edu/staff/sleggett>`_
- Photometry from `A Modern Mean Dwarf Stellar Color and Effective Temperature Sequence <http://www.pas.rochester.edu/~emamajek>`_
- 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/>`_

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

species.data.mamajek module
---------------------------

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

species.data.petitcode module
-----------------------------

Expand Down
33 changes: 9 additions & 24 deletions docs/tutorials/fitting_photometry.ipynb

Large diffs are not rendered by default.

32 changes: 9 additions & 23 deletions docs/tutorials/photometric_calibration.ipynb

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions species/data/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from species.analysis import photometry
from species.core import box
from species.data import drift_phoenix, btnextgen, vega, irtf, spex, vlm_plx, leggett, \
companions, filters, mamajek, btsettl, ames_dusty, ames_cond, \
companions, filters, btsettl, ames_dusty, ames_cond, \
isochrones, petitcode
from species.read import read_model, read_calibration, read_planck
from species.util import data_util
Expand Down Expand Up @@ -391,7 +391,7 @@ def add_photometry(self,
Parameters
----------
phot_library : str
Photometric library ('vlm-plx', 'leggett' or 'mamajek').
Photometric library ('vlm-plx' or 'leggett').
Returns
-------
Expand All @@ -413,9 +413,6 @@ def add_photometry(self,
elif phot_library[0:7] == 'leggett':
leggett.add_leggett(self.input_path, h5_file)

elif phot_library[0:7] == 'mamajek':
mamajek.add_mamajek(self.input_path, h5_file)

h5_file.close()

def add_calibration(self,
Expand Down Expand Up @@ -746,8 +743,6 @@ def get_mcmc_spectra(self,
Boxes with the randomly sampled spectra.
"""

print('Getting MCMC spectra...')

h5_file = h5py.File(self.database, 'r')
dset = h5_file[f'results/mcmc/{tag}/samples']

Expand Down Expand Up @@ -786,7 +781,7 @@ def get_mcmc_spectra(self,

boxes = []

for i in tqdm.tqdm(range(samples.shape[0])):
for i in tqdm.tqdm(range(samples.shape[0]), desc='Getting MCMC spectra'):
model_param = {}
for j in range(samples.shape[1]):
model_param[param[j]] = samples[i, j]
Expand Down Expand Up @@ -831,8 +826,6 @@ def get_mcmc_photometry(self,
Synthetic photometry (mag).
"""

print('Getting MCMC photometry...')

h5_file = h5py.File(self.database, 'r')
dset = h5_file[f'results/mcmc/{tag}/samples']

Expand Down Expand Up @@ -862,7 +855,7 @@ def get_mcmc_photometry(self,

mcmc_phot = np.zeros((samples.shape[0], 1))

for i in tqdm.tqdm(range(samples.shape[0])):
for i in tqdm.tqdm(range(samples.shape[0]), desc='Getting MCMC photometry'):
model_param = {}
for j in range(nparam):
model_param[param[j]] = samples[i, j]
Expand Down
114 changes: 0 additions & 114 deletions species/data/mamajek.py

This file was deleted.

22 changes: 11 additions & 11 deletions species/data/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@ def get_distance(target):
if not ma.is_masked(parallax):
break

if ma.is_masked(parallax):

if simbad is not None:
coord_ra = simbad['RA'][0]
coord_dec = simbad['DEC'][0]

coord = SkyCoord(ra=coord_ra, dec=coord_dec, unit=(u.hourangle, u.deg), frame='icrs')
result = Gaia.query_object(coordinate=coord, width=1.*u.arcsec, height=1.*u.arcsec)

if result:
parallax = result['parallax'][0] # [mas]
# if ma.is_masked(parallax):
#
# if simbad is not None:
# coord_ra = simbad['RA'][0]
# coord_dec = simbad['DEC'][0]
#
# coord = SkyCoord(ra=coord_ra, dec=coord_dec, unit=(u.hourangle, u.deg), frame='icrs')
# result = Gaia.query_object(coordinate=coord, width=1.*u.arcsec, height=1.*u.arcsec)
#
# if result:
# parallax = result['parallax'][0] # [mas]

if ma.is_masked(parallax) or parallax < 0.:
distance = np.nan
Expand Down
4 changes: 3 additions & 1 deletion species/data/spex.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ def add_spex(input_path, database):

simbad_id, distance = queries.get_distance('2MASS '+twomass_id.decode('utf-8')) # [pc]

if sptype[0] in ('M', 'L', 'T') and len(sptype) == 2:
print(twomass_id, simbad_id)

if sptype[0] in ['M', 'L', 'T'] and len(sptype) == 2:
sys.stdout.write('\rAdding SpeX Prism Spectral Library... '+'{:<40}'.format(name))
sys.stdout.flush()

Expand Down

0 comments on commit 3943707

Please sign in to comment.