ApJdataFrames
Harvey 2010Title
: A SPITZER SEARCH FOR PLANETARY-MASS BROWN DWARFS WITH CIRCUMSTELLAR DISKS: CANDIDATE SELECTION
Authors
: Paul M. Harvey1, Daniel T. Jaffe1, Katelyn Allers2, and Michael Liu3
Data is from this paper:
http://iopscience.iop.org/0004-637X/720/2/1374/article
In [1]:
%pylab inline
import seaborn as sns
In [2]:
import warnings
warnings.filterwarnings("ignore")
In [3]:
import pandas as pd
In [4]:
names = ['Position','I','J','H','K_s','[3.6]','[4.5]','[5.8]','[8.0]','A_v','Luminosity']
link = 'http://iopscience.iop.org/0004-637X/720/2/1374/suppdata/apj363663t2_ascii.txt'
harvey2010_raw = pd.read_csv(link, sep='\t', names=names, skiprows=5, na_values=' sdotsdotsdot ')
Data cleaning.
In [5]:
harvey2010_raw.dropna(how='all', inplace=True)
Split [value +or- error] into separate columns: [value], [error]
In [6]:
fv = lambda a: a.split(' +or- ')[0] if a == a else np.NaN
fe = lambda a: a.split(' +or- ')[-1] if a == a else np.NaN #awesome little hack here!
In [7]:
bands = ['I','J','H','K_s','[3.6]','[4.5]','[5.8]','[8.0]']
harvey2010_tbl2 = harvey2010_raw.drop(bands, axis=1)
for band in bands:
harvey2010_tbl2[band]=harvey2010_raw[band].apply(fv)
harvey2010_tbl2[band+'_e']=harvey2010_raw[band].apply(fe)
Split the position into RA and DEC.
In [8]:
harvey2010_tbl2.insert(0, 'RA', harvey2010_tbl2.Position.str.slice(0, 11).copy())
harvey2010_tbl2.insert(1, 'DEC', harvey2010_tbl2.Position.str.slice(12).copy())
In [9]:
harvey2010_tbl2.drop('Position', axis=1, inplace=True)
!!mkdir ../data/Harvey2010
In [10]:
harvey2010_tbl2.to_csv('../data/Harvey2010/tbl2.csv')
The end.