def print_BIC():
    bv_m, fits = readData.read_calcium(fromFile=False,
                                       saveToFile=False,
                                       fit_degree=0)
    dof = len(bv_m)  #1 parameter for each cluster
    BIC1 = my_fits.get_fit_BIC(bv_m, fits, dof)
    print("BIC constant fits = ", BIC1)

    dof = 2 * len(bv_m)  # 2 for each cluster
    bv_m, fits = readData.read_calcium(fromFile=False,
                                       saveToFile=False,
                                       fit_degree=1)
    BIC2 = my_fits.get_fit_BIC(bv_m, fits, dof)
    print("BIC linear fits = ", BIC2)
    #for i in range(len(bv_m)):
    #    plt.scatter(bv_m[i][0],bv_m[i][1])
    #    plt.plot(bv_m[i][0],fits[i][0](bv_m[i][0]))
    #    plt.show()
    print("Delta BIC = ", BIC2 - BIC1)
def metal_vs_bv():
    #Metal vs B-V
    name = join('plots', METAL + '_metal_vs_bv.pdf')
    pp = PdfPages(name)
    ##clusters = [0,4,6,7]
    my_plot.metal_vs_bv(bv_m, fits, METAL, pp, showPlots=False,
                        legend=False)  #,specific_clusters = clusters)

    bv_m_linear, fits_linear = readData.read_calcium(fromFile=False,
                                                     saveToFile=False,
                                                     fit_degree=1)
    my_plot.metal_vs_bv(bv_m_linear, fits_linear, METAL, pp,
                        showPlots=False)  #,specific_clusters = clusters)
    printName(name)
    pp.close()
Exemple #3
0
def main():
    date = datetime.datetime.now().strftime("%m%d%y")
    bv_m,fits = readData.read_calcium(fromFile=False,saveToFile=True)
    baf = baffles.age_estimator('calcium',default_grids=False,load_pdf_fit=False)
    baf.make_grids(bv_m,fits,medianSavefile=join('grids','median_rhk_'+date),\
                    setAsDefaults=True)    
    
    _,res_arr = my_fits.get_fit_residuals(bv_m,fits,'calcium',None,li_range=None,
                linSpace=False,scale_by_std= False,vs_age_fit=True,zero_center=True)
    my_fits.fit_histogram('calcium',residual_arr=res_arr,fromFile=False,saveToFile=True)
    
    
        
    const = utils.init_constants('lithium')    
    bv_m, upper_lim, fits = readData.read_lithium(fromFile=False,saveToFile=True)
    baf2 = baffles.age_estimator('lithium',default_grids=False,load_pdf_fit=False)
    baf2.make_grids(bv_m,fits,upper_lim,join('grids','median_li_'+date),setAsDefaults=True)
    
    my_fits.MIST_primordial_li(ngc2264_fit=fits[const.CLUSTER_NAMES.index('NGC2264')][0],
                                fromFile=False, saveToFile=True)
    _,res_arr= my_fits.get_fit_residuals(bv_m,fits,'lithium',upper_lim,li_range=None,linSpace=False,
                                        vs_age_fit=True,zero_center=True)
    my_fits.fit_histogram('lithium',residual_arr=res_arr,fromFile=False,saveToFile=True)
Exemple #4
0
def main():
    bv_m, fits = readData.read_calcium(fromFile=False, saveToFile=True)
    _, res_arr = my_fits.get_fit_residuals(bv_m,
                                           fits,
                                           'calcium',
                                           None,
                                           li_range=None,
                                           linSpace=False,
                                           scale_by_std=False,
                                           vs_age_fit=True,
                                           zero_center=True)
    my_fits.fit_histogram('calcium',
                          residual_arr=res_arr,
                          fromFile=False,
                          saveToFile=True)

    const = utils.init_constants('lithium')
    bv_m, upper_lim, fits = readData.read_lithium(fromFile=False,
                                                  saveToFile=True)

    my_fits.MIST_primordial_li(
        ngc2264_fit=fits[const.CLUSTER_NAMES.index('NGC2264')][0],
        fromFile=False,
        saveToFile=True)
    _, res_arr = my_fits.get_fit_residuals(bv_m,
                                           fits,
                                           'lithium',
                                           upper_lim,
                                           li_range=None,
                                           linSpace=False,
                                           vs_age_fit=True,
                                           zero_center=True)
    my_fits.fit_histogram('lithium',
                          residual_arr=res_arr,
                          fromFile=False,
                          saveToFile=True)
import matplotlib.cm as cm
import fitting as my_fits
import probability as prob
import baffles
import ca_constants as const
import plotting as my_plot
import readData
import utils
from os.path import join
import os
if not os.path.exists('plots'):
    os.mkdir('plots')

METAL = "calcium"
upper_lim = None
bv_m, fits = readData.read_calcium(
)  #fromFile=False,saveToFile=False,fit_degree=0)
print("Num Calcium Stars= ", [len(x[0]) for x in bv_m])


def main():
    #metal_vs_bv()
    #metal_vs_age()
    #scatter_vs_age()
    #fit_hist()
    #baffles_vs_mamajek()
    #combined_validation_subplots()

    #---------Not in Paper-----------
    #plot_fits()
    #combined_validation()
    #posteriors()
import probability as prob
import baffles
import li_constants as const
import plotting as my_plot
import readData
import fitting as my_fits
import utils
import bisect
from os.path import join
import os
if not os.path.exists('plots'):
    os.mkdir('plots')

METAL = "lithium"
bv_m, upper_lim, fits = readData.read_lithium()#fromFile=False,saveToFile=False)
bv_ca, ca_fits = readData.read_calcium()#fromFile=False,saveToFile=False)
print("Number of Li Stars= ",[len(x[0]) for x in bv_m])

def printName(n):
    print(" \n")

  
def main():
    #metal_vs_bv()
    #metal_vs_age()
    #metal_vs_age_subplots()
    #bldb()
    fit_hist()
    combined_validation_subplots()
    #moving_group()
    #notable_stars()