import warnings
warnings.filterwarnings("ignore")

from astropy.io import ascii

import pandas as pd

"""
Explanation: ApJdataFrames Liu et al. 2010
Title: Discovery of a Highly Unequal-mass Binary T Dwarf with Keck Laser Guide Star Adaptive Optics: A Coevality Test of Substellar Theoretical Models and Effective Temperatures
Authors: Liu, Dupuy, Leggett
Data is from this paper:
http://iopscience.iop.org/article/10.1088/0004-637X/722/1/311/
End of explanation
"""


#! mkdir ../data/Liu2010
#! curl http://iopscience.iop.org/0004-637X/722/1/311/suppdata/apj336343t6_ascii.txt > ../data/Liu2010/apj336343t6_ascii.txt

tbl6 = pd.read_csv("../data/Liu2010/apj336343t6_ascii.txt",
                   sep="\t", na_values=" ... ", skiprows=[0,1,2], skipfooter=1, usecols=range(9))
tbl6.head()

"""
Explanation: Table 1 - Target Information for Ophiuchus Sources
End of explanation
"""


J_s = tbl6.loc[0]

coeffs = J_s[["c_"+str(i) for i in range(6, -1, -1)]].values

func = np.poly1d(coeffs)

print(func)

"""
Explanation: We want the J-Band coefficients, in order of highest order coefficient to lowest order coefficient.
End of explanation
"""


