ApJdataFrames
Slesnick2006Title
: A LARGE-AREA SEARCH FOR LOW-MASS OBJECTS IN UPPER SCORPIUS. I. THE PHOTOMETRIC CAMPAIGN AND NEW BROWN DWARFS
Authors
: CATHERINE L. SLESNICK, JOHN M. CARPENTER, AND LYNNE A. HILLENBRAND
Data is from this paper: http://iopscience.iop.org/1538-3881/131/6/3016/fulltext/205148.html
In [1]:
%matplotlib inline
%config InlineBackend.figure_format='retina'
In [2]:
import warnings
warnings.filterwarnings("ignore")
In [3]:
import pandas as pd
In [4]:
names = ["ID","R","I","J","H","KS","TiO_7140","TiO_8465","NaI_8189","Spectral Type","EW_Ha","Gravity"]
tbl1 = pd.read_csv("http://iopscience.iop.org/1538-3881/131/6/3016/fulltext/205148.tb1.txt",
sep='\t', names=names, skip_blank_lines=True, na_values='\ldots')
tbl1.head()
Out[4]:
In [5]:
names = ["ID","MJ","AV","log_Teff","log_L_bol"]
tbl2 = pd.read_csv("http://iopscience.iop.org/1538-3881/131/6/3016/fulltext/205148.tb2.txt",
sep='\t', names=names, skip_blank_lines=True, na_values='\ldots')
tbl2.head()
Out[5]:
mkdir ../data/Slesnick2006
In [6]:
tbl1.to_csv("../data/Slesnick2006/tbl1.csv", sep="\t", index=False)
tbl2.to_csv("../data/Slesnick2006/tbl2.csv", sep="\t", index=False)
In [7]:
%matplotlib inline
import seaborn as sns
import matplotlib.pyplot as plt
In [8]:
import gully_custom
In [9]:
SpT, _, _, _ = gully_custom.specTypePlus(tbl1["Spectral Type"])
Turn the ratio into an equivalent width:
$EW = (1 - \frac{F_{\lambda_{8189}}}{F_{\lambda_{8150}}})\Delta \lambda$
In [10]:
EW_NaI_8189 = (1.0 - tbl1.NaI_8189.values)*30.0
In [11]:
c = 'Dwarf'
i = tbl1.Gravity.values == c
plt.plot(SpT[i], EW_NaI_8189[i], '.', label = c)
c = 'USco'
i = tbl1.Gravity.values == c
plt.plot(SpT[i], EW_NaI_8189[i], '.', label = c)
c = 'Int'
i = tbl1.Gravity.values == c
plt.plot(SpT[i], EW_NaI_8189[i], '.', label = c)
plt.legend(loc='best')
plt.xlim(0, 15)
plt.ylim(-5, 8.5)
Out[11]:
In [12]:
EW_NaI_8189[tbl1.Gravity.values == 'USco']
Out[12]:
In [13]:
from astroquery.simbad import Simbad
import astropy.coordinates as coord
import astropy.units as u
In [20]:
customSimbad.list_votable_fields()
In [47]:
bands = ['U','B','V','R','I','J','H','K','u','g','r','i','z']
fluxes = ['fluxdata({})'.format(band) for band in bands]
flux_cols = sum([['FLUX_{}'.format(band), 'FLUX_ERROR_{}'.format(band)] for band in bands], [])
In [30]:
customSimbad = Simbad()
customSimbad.add_votable_fields('otype', 'id', 'sptype', 'flux(U)','flux_error(U)''flux(B)','flux_error(B)''flux(V)','flux_error(V)''flux(R)','flux_error(R)''flux(I)','flux_error(I)''flux(J)','flux_error(J)''flux(H)','flux_error(H)''flux(K)','flux_error(K)''flux(u)','flux_error(u)''flux(g)','flux_error(g)''flux(r)','flux_error(r)''flux(i)','flux_error(i)''flux(z)','flux_error(z)')
SCH is a non-standard input for Simbad. Need to put in the 2MASS coordinates.
In [31]:
input_to_simbad = "[SCH2006] J"+tbl2.ID.str.strip("SCH ")
In [32]:
result = customSimbad.query_objects(input_to_simbad, verbose=True)
In [34]:
result.columns
Out[34]:
In [50]:
result[flux_cols][0:5]
Out[50]:
In [51]:
print "There were {} sources queried, and {} sources found.".format(len(input_to_simbad), len(result))
if len(input_to_simbad) == len(result):
print "Hooray! Everything matched"
else:
print "Which ones were not found?"
In [19]:
tbl2["Simbad_name"] = input_to_simbad
result["Simbad_name"] = input_to_simbad
simbad_df = result.to_pandas()
del simbad_df["ID"]
In [20]:
tbl2_simbad = pd.merge(tbl2, simbad_df, on="Simbad_name")
tbl2_simbad.columns
Out[20]:
In [21]:
tbl2_simbad[[u'MAIN_ID', u'ID', u'RA', u'DEC', u'MJ', u'AV', u'log_Teff', u'log_L_bol',u'OTYPE',
u'SP_TYPE', u'SP_BIBCODE']].head()
Out[21]:
In [22]:
tbl2_simbad.to_csv("../data/Slesnick2006/tbl2_plusSimbad.csv", index=False)
The end.