Esempio n. 1
0
def read_kdwarfs(catalogdir, cps_list):
    """Read in K-Dwarf catalog"""
    kdwarfs = pd.read_csv(os.path.join(catalogdir, KDWARF_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in kdwarfs.iterrows():
        query_result = cpsutils.find_spectra(row['name'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['teff_derived']
            new_row['u_Teff'] = row['e_teff_derived']
            new_row['feh'] = row['fe']
            new_row['u_feh'] = 0.1
            new_row['radius'] = row['radius']
            new_row['u_radius'] = row['e_radius']
            new_row['source'] = 'Gaidos'
            new_row['source_name'] = row['name']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['name']
            new_row['source'] = 'Gaidos'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_kdwarfs(catalogdir, cps_list):
    """Read in K-Dwarf catalog"""
    kdwarfs = pd.read_csv(os.path.join(catalogdir, KDWARF_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in kdwarfs.iterrows():
        query_result = cpsutils.find_spectra(row['name'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['teff_derived']
            new_row['u_Teff'] = row['e_teff_derived']
            new_row['feh'] = row['fe']
            new_row['u_feh'] = 0.1
            new_row['radius'] = row['radius']
            new_row['u_radius'] = row['e_radius']
            new_row['source'] = 'Gaidos'
            new_row['source_name'] = row['name']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['name']
            new_row['source'] = 'Gaidos'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 3
0
def read_mann(catalogdir, cps_list):
    """Read in Mann (2015) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    mann_data = ascii.read(os.path.join(catalogdir, MANN_FILENAME),
                           readme=os.path.join(catalogdir, MANN_README))

    mann_data = mann_data[~mann_data['CNS3'].mask]

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in mann_data:
        query_result = cpsutils.find_spectra(row['CNS3'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['e_Teff']
            new_row['radius'] = row['R']
            new_row['u_radius'] = row['e_R']
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = row['e_[Fe/H]']
            new_row['mass'] = row['M']
            new_row['u_mass'] = row['e_M']
            new_row['source'] = 'Mann'
            new_row['source_name'] = row['CNS3']
            # Calculate logg from radius and mass
            logg, u_logg = utils.calc_logg(row['R'], row['e_R'],
                                           row['M'], row['e_M'])
            new_row['logg'] = logg
            new_row['u_logg'] = u_logg

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['CNS3']
            new_row['source'] = 'Mann'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_mann(catalogdir, cps_list):
    """Read in Mann (2015) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    mann_data = ascii.read(os.path.join(catalogdir, MANN_FILENAME),
                           readme=os.path.join(catalogdir, MANN_README))

    mann_data = mann_data[~mann_data['CNS3'].mask]

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in mann_data:
        query_result = cpsutils.find_spectra(row['CNS3'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['e_Teff']
            new_row['radius'] = row['R']
            new_row['u_radius'] = row['e_R']
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = row['e_[Fe/H]']
            new_row['mass'] = row['M']
            new_row['u_mass'] = row['e_M']
            new_row['source'] = 'Mann'
            new_row['source_name'] = row['CNS3']
            # Calculate logg from radius and mass
            logg, u_logg = utils.calc_logg(row['R'], row['e_R'], row['M'],
                                           row['e_M'])
            new_row['logg'] = logg
            new_row['u_logg'] = u_logg

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['CNS3']
            new_row['source'] = 'Mann'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 5
0
def read_huber(catalogdir, cps_list):
    """Read in Huber (2013) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    huber_data = ascii.read(os.path.join(catalogdir, HUBER_FILENAME),
                            readme=os.path.join(catalogdir, HUBER_README))
    huber_data = huber_data[huber_data['f_KOI'] != '*']

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in huber_data:
        query_result = cpsutils.find_spectra('KOI'+str(row['KOI']), cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['e_Teff']
            new_row['radius'] = float(row['Rad'])
            new_row['u_radius'] = row['e_Rad']
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = row['e_[Fe/H]']
            new_row['mass'] = row['Mass']
            new_row['u_mass'] = row['e_Mass']
            new_row['source'] = 'Huber'
            new_row['source_name'] = 'KOI'+str(row['KOI'])
            # Calculate logg from radius and mass
            logg, u_logg = utils.calc_logg(row['Rad'], row['e_Rad'],
                                           row['Mass'], row['e_Mass'])
            new_row['logg'] = logg
            new_row['u_logg'] = u_logg

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = 'KOI'+str(row['KOI'])
            new_row['source'] = 'Huber'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_huber(catalogdir, cps_list):
    """Read in Huber (2013) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    huber_data = ascii.read(os.path.join(catalogdir, HUBER_FILENAME),
                            readme=os.path.join(catalogdir, HUBER_README))
    huber_data = huber_data[huber_data['f_KOI'] != '*']

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in huber_data:
        query_result = cpsutils.find_spectra('KOI' + str(row['KOI']), cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['e_Teff']
            new_row['radius'] = float(row['Rad'])
            new_row['u_radius'] = row['e_Rad']
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = row['e_[Fe/H]']
            new_row['mass'] = row['Mass']
            new_row['u_mass'] = row['e_Mass']
            new_row['source'] = 'Huber'
            new_row['source_name'] = 'KOI' + str(row['KOI'])
            # Calculate logg from radius and mass
            logg, u_logg = utils.calc_logg(row['Rad'], row['e_Rad'],
                                           row['Mass'], row['e_Mass'])
            new_row['logg'] = logg
            new_row['u_logg'] = u_logg

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = 'KOI' + str(row['KOI'])
            new_row['source'] = 'Huber'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 7
0
def read_casagrande(catalogdir, cps_list):
    """Read in Casagrande (2006) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    c_data = pd.read_csv(os.path.join(catalogdir, CASAGRANDE_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in c_data.iterrows():
        query_result = cpsutils.find_spectra(row['Name'], cps_list)
        if not query_result.empty:
            # Calculate stellar radius from angular diameter and parallax
            radius, u_radius = utils.calc_radius(row['Plx'], row['e_Plx'],
                                                 row['Diam'], row['e_Diam'])
            # Exclude stars with u_Teff > 100 or u_R/R > 0.07
            if row['e_Teff'] > 100 or u_radius/radius > 0.07:
                continue
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['e_Teff']
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = 0.15
            new_row['radius'] = radius
            new_row['u_radius'] = u_radius
            new_row['source'] = 'Casagrande'
            new_row['source_name'] = row['Name']
            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['Name']
            new_row['source'] = 'Casagrande'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_casagrande(catalogdir, cps_list):
    """Read in Casagrande (2006) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    c_data = pd.read_csv(os.path.join(catalogdir, CASAGRANDE_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in c_data.iterrows():
        query_result = cpsutils.find_spectra(row['Name'], cps_list)
        if not query_result.empty:
            # Calculate stellar radius from angular diameter and parallax
            radius, u_radius = utils.calc_radius(row['Plx'], row['e_Plx'],
                                                 row['Diam'], row['e_Diam'])
            # Exclude stars with u_Teff > 100 or u_R/R > 0.07
            if row['e_Teff'] > 100 or u_radius / radius > 0.07:
                continue
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['e_Teff']
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = 0.15
            new_row['radius'] = radius
            new_row['u_radius'] = u_radius
            new_row['source'] = 'Casagrande'
            new_row['source_name'] = row['Name']
            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['Name']
            new_row['source'] = 'Casagrande'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 9
0
def read_brewer(catalogdir, cps_list):
    """Read in Brewer (2016) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    # brewer_data = ascii.read(os.path.join(catalogdir, BREWER_FILENAME))
    brewer_data = pd.read_csv(os.path.join(catalogdir, BREWER_FILENAME),
                              index_col=0)

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in brewer_data.iterrows():
        query_result = cpsutils.find_spectra(row['NAME'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['TEFF']
            new_row['u_Teff'] = 25
            new_row['logg'] = row['LOGG']
            new_row['u_logg'] = 0.028
            new_row['feh'] = row['FEH']
            new_row['u_feh'] = 0.010
            new_row['vsini'] = row['VSINI']
            new_row['source'] = 'Brewer'
            new_row['source_name'] = row['NAME']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['NAME']
            new_row['source'] = 'Brewer'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_brewer(catalogdir, cps_list):
    """Read in Brewer (2016) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    # brewer_data = ascii.read(os.path.join(catalogdir, BREWER_FILENAME))
    brewer_data = pd.read_csv(os.path.join(catalogdir, BREWER_FILENAME),
                              index_col=0)

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in brewer_data.iterrows():
        query_result = cpsutils.find_spectra(row['NAME'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['TEFF']
            new_row['u_Teff'] = 25
            new_row['logg'] = row['LOGG']
            new_row['u_logg'] = 0.028
            new_row['feh'] = row['FEH']
            new_row['u_feh'] = 0.010
            new_row['vsini'] = row['VSINI']
            new_row['source'] = 'Brewer'
            new_row['source_name'] = row['NAME']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['NAME']
            new_row['source'] = 'Brewer'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 11
0
def read_bruntt(catalogdir, cps_list):
    """Read in Bruntt (2012) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    b_data = ascii.read(os.path.join(catalogdir, BRUNTT_FILENAME),
                        readme=os.path.join(catalogdir, BRUNTT_README))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in b_data:
        query_result = cpsutils.find_spectra('KIC'+str(row['KIC']), cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = 60
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = 0.06
            new_row['logg'] = row['logg']
            new_row['u_logg'] = 0.03
            new_row['vsini'] = row['vsini']
            new_row['source'] = 'Bruntt'
            new_row['source_name'] = 'KIC'+str(row['KIC'])

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = 'KIC'+str(row['KIC'])
            new_row['source'] = 'Bruntt'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_bruntt(catalogdir, cps_list):
    """Read in Bruntt (2012) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    b_data = ascii.read(os.path.join(catalogdir, BRUNTT_FILENAME),
                        readme=os.path.join(catalogdir, BRUNTT_README))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in b_data:
        query_result = cpsutils.find_spectra('KIC' + str(row['KIC']), cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = 60
            new_row['feh'] = row['[Fe/H]']
            new_row['u_feh'] = 0.06
            new_row['logg'] = row['logg']
            new_row['u_logg'] = 0.03
            new_row['vsini'] = row['vsini']
            new_row['source'] = 'Bruntt'
            new_row['source_name'] = 'KIC' + str(row['KIC'])

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = 'KIC' + str(row['KIC'])
            new_row['source'] = 'Bruntt'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 13
0
def read_vonbraun(catalogdir, cps_list):
    """Read in Von Braun (2013) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    vb_data = ascii.read(os.path.join(catalogdir, VONBRAUN_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in vb_data:
        query_result = cpsutils.find_spectra(row['Star'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['eTeff']
            new_row['radius'] = row['Radius']
            new_row['u_radius'] = row['eRadius']
            new_row['feh'] = row['FeH']
            new_row['u_feh'] = 0.10
            new_row['source'] = 'Von Braun'
            new_row['source_name'] = row['Star']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['Star']
            new_row['source'] = 'Von Braun'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_vonbraun(catalogdir, cps_list):
    """Read in Von Braun (2013) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    vb_data = ascii.read(os.path.join(catalogdir, VONBRAUN_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for row in vb_data:
        query_result = cpsutils.find_spectra(row['Star'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['snr'] = query_result.iloc[0]['snr']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['eTeff']
            new_row['radius'] = row['Radius']
            new_row['u_radius'] = row['eRadius']
            new_row['feh'] = row['FeH']
            new_row['u_feh'] = 0.10
            new_row['source'] = 'Von Braun'
            new_row['source_name'] = row['Star']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['Star']
            new_row['source'] = 'Von Braun'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
Esempio n. 15
0
def read_ramirez(catalogdir, cps_list):
    """Read in Ramirez (2005) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    ramirez_data = pd.read_csv(os.path.join(catalogdir, RAMIREZ_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in ramirez_data.iterrows():
        query_result = cpsutils.find_spectra(row['name'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['u_Teff']
            new_row['logg'] = row['logg']
            new_row['u_logg'] = row['u_logg']
            new_row['feh'] = row['feh']
            new_row['u_feh'] = row['u_feh']
            new_row['source'] = 'Ramirez'
            new_row['source_name'] = row['name']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['name']
            new_row['source'] = 'Ramirez'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra
def read_ramirez(catalogdir, cps_list):
    """Read in Ramirez (2005) catalog

    Args:
        catalogdir (str): Path of catalog directory.
        cps_list (pd.DataFrame): Dataframe containing list of CPS spectra.

    Returns:
        stars (pd.DataFrame): Stars in source which have CPS spectra
        nospec (pd.DataFrame): Stars in source which don't have CPS spectra
    """
    ramirez_data = pd.read_csv(os.path.join(catalogdir, RAMIREZ_FILENAME))

    stars = pd.DataFrame(columns=Library.LIB_COLS)
    nospectra = pd.DataFrame(columns=NOSPECTRA_COLS)

    for idx, row in ramirez_data.iterrows():
        query_result = cpsutils.find_spectra(row['name'], cps_list)
        if not query_result.empty:
            new_row = {}
            new_row['cps_name'] = str(query_result.iloc[0]['name'])
            new_row['lib_obs'] = query_result.iloc[0]['obs']
            new_row['Teff'] = row['Teff']
            new_row['u_Teff'] = row['u_Teff']
            new_row['logg'] = row['logg']
            new_row['u_logg'] = row['u_logg']
            new_row['feh'] = row['feh']
            new_row['u_feh'] = row['u_feh']
            new_row['source'] = 'Ramirez'
            new_row['source_name'] = row['name']

            stars = stars.append(pd.Series(new_row), ignore_index=True)
        else:
            new_row = {}
            new_row['name'] = row['name']
            new_row['source'] = 'Ramirez'
            nospectra = nospectra.append(pd.Series(new_row), ignore_index=True)

    return stars, nospectra