DifferentialPhotometry_functions_student.py
def findComparisonStars(Photometry, cPhotometry, plot=True, comp_num=6): #0.025
    '''
    findComparisonStars*
    
    finds stars that are similar over the various nights to use as comparison stars
    
    inputs
    --------
    Photometry: list - photometric values taken from detrend() function. 
    cPhotometry: list - detrended photometric values from detrend() function
    plot: boolean - True/False plot various stars and highlight comparison stars
    comp_num: float - (default=5)  minimum number of comparison stars to use

    outputs
    --------
    LeastVariable[best_key]: list - list of indices of the locations in Photometry which have the best stars to use as comparisons
    '''

    BinStars,LeastVariable = CaliforniaCoast(Photometry,cPhotometry,comp_num=comp_num)

    star_err = ma.std(cPhotometry, axis=0)

    if plot:
        xvals = np.log10(ma.median(Photometry,axis=0))
        yvals = np.log10(ma.std(cPhotometry, axis=0))

        plt.figure()
        plt.scatter(xvals,yvals,color='black',s=1.)
        plt.xlabel('log Median Flux per star')
        plt.ylabel('log De-trended Standard Deviation')
        plt.text(np.nanmin(np.log10(ma.median(Photometry,axis=0))),np.nanmin(np.log10(star_err[star_err>0.])),\
            'Less Variable',color='red',ha='left',va='bottom')
        plt.text(np.nanmax(np.log10(ma.median(Photometry,axis=0))),np.nanmax(np.log10(star_err[star_err>0.])),\
            'More Variable',color='red',ha='right',va='top')

        for k in LeastVariable.keys():
            plt.scatter(xvals[LeastVariable[k]],yvals[LeastVariable[k]],color='red')


    # this is the middle key for safety
    middle_key = np.array(list(LeastVariable.keys()))[len(LeastVariable.keys())//2]

    # but now let's select the brightest one
    best_key = np.array(list(LeastVariable.keys()))[-1]
    
    print('Number of good & bright comparison stars: {}'.format(len(LeastVariable[best_key])))
    return LeastVariable[best_key]

    findComparisonStars*
    
    finds stars that are similar over the various nights to use as comparison stars
    
    inputs
    --------
    Photometry: list - photometric values taken from detrend() function. 
    cPhotometry: list - detrended photometric values from detrend() function
    plot: boolean - True/False plot various stars and highlight comparison stars
    comp_num: float - (default=5)  minimum number of comparison stars to use

    outputs
    --------
    LeastVariable[best_key]: list - list of indices of the locations in Photometry which have the best stars to use as comparisons
    
findComparisonStars
finds stars that are similar over the various nights to use as comparison stars

inputs

photometric values taken from detrend() function.
cPhotometry: list - detrended photometric values from detrend() function
plot: boolean - True/False plot various stars and highlight comparison stars
comp_num: float - (default=5)  minimum number of comparison stars to use

outputs

LeastVariable[best_key]: list - list of indices of the locations in Photometry which have the best stars to use as comparisons
findComparisonStars finds stars that are similar over the various nights to use as comparison stars inputs photometric values taken from detrend () function . cPhotometry : list - detrended photometric values from detrend () function plot : boolean - True / False plot various stars and highlight comparison stars comp_num : float - ( default = 5 ) minimum number of comparison stars to use outputs LeastVariable [ best_key ] : list - list of indices of the locations in Photometry which have the best stars to use as comparisons
def findComparisonStars(Photometry, cPhotometry, plot=True, comp_num=6): 
    BinStars,LeastVariable = CaliforniaCoast(Photometry,cPhotometry,comp_num=comp_num)
    star_err = ma.std(cPhotometry, axis=0)
    if plot:
        xvals = np.log10(ma.median(Photometry,axis=0))
        yvals = np.log10(ma.std(cPhotometry, axis=0))
        plt.figure()
        plt.scatter(xvals,yvals,color='black',s=1.)
        plt.xlabel('log Median Flux per star')
        plt.ylabel('log De-trended Standard Deviation')
        plt.text(np.nanmin(np.log10(ma.median(Photometry,axis=0))),np.nanmin(np.log10(star_err[star_err>0.])),\
            'Less Variable',color='red',ha='left',va='bottom')
        plt.text(np.nanmax(np.log10(ma.median(Photometry,axis=0))),np.nanmax(np.log10(star_err[star_err>0.])),\
            'More Variable',color='red',ha='right',va='top')
        for k in LeastVariable.keys():
            plt.scatter(xvals[LeastVariable[k]],yvals[LeastVariable[k]],color='red')
    middle_key = np.array(list(LeastVariable.keys()))[len(LeastVariable.keys())//2]
    best_key = np.array(list(LeastVariable.keys()))[-1]
    print('Number of good & bright comparison stars: {}'.format(len(LeastVariable[best_key])))
    return LeastVariable[best_key]
def findComparisonStars ( Photometry , cPhotometry , plot = True , comp_num = 6 ) : BinStars , LeastVariable = CaliforniaCoast ( Photometry , cPhotometry , comp_num = comp_num ) star_err = ma . std ( cPhotometry , axis = 0 ) if plot : xvals = np . log10 ( ma . median ( Photometry , axis = 0 ) ) yvals = np . log10 ( ma . std ( cPhotometry , axis = 0 ) ) plt . figure ( ) plt . scatter ( xvals , yvals , color = 'black' , s = 1. ) plt . xlabel ( 'log Median Flux per star' ) plt . ylabel ( 'log De-trended Standard Deviation' ) plt . text ( np . nanmin ( np . log10 ( ma . median ( Photometry , axis = 0 ) ) ) , np . nanmin ( np . log10 ( star_err [ star_err > 0. ] ) ) , 'Less Variable' , color = 'red' , ha = 'left' , va = 'bottom' ) plt . text ( np . nanmax ( np . log10 ( ma . median ( Photometry , axis = 0 ) ) ) , np . nanmax ( np . log10 ( star_err [ star_err > 0. ] ) ) , 'More Variable' , color = 'red' , ha = 'right' , va = 'top' ) for k in LeastVariable . keys ( ) : plt . scatter ( xvals [ LeastVariable [ k ] ] , yvals [ LeastVariable [ k ] ] , color = 'red' ) middle_key = np . array ( list ( LeastVariable . keys ( ) ) ) [ len ( LeastVariable . keys ( ) ) // 2 ] best_key = np . array ( list ( LeastVariable . keys ( ) ) ) [ - 1 ] print ( 'Number of good & bright comparison stars: {}' . format ( len ( LeastVariable [ best_key ] ) ) ) return LeastVariable [ best_key ]
findComparisonStars
finds stars that are similar over the various nights to use as comparison stars
findComparisonStars finds stars that are similar over the various nights to use as comparison stars
#0.025 '''
    findComparisonStars*
    
    finds stars that are similar over the various nights to use as comparison stars
    
    inputs
    --------
    Photometry: list - photometric values taken from detrend() function. 
    cPhotometry: list - detrended photometric values from detrend() function
    plot: boolean - True/False plot various stars and highlight comparison stars
    comp_num: float - (default=5)  minimum number of comparison stars to use

    outputs
    --------
    LeastVariable[best_key]: list - list of indices of the locations in Photometry which have the best stars to use as comparisons
    ''' # this is the middle key for safety # but now let's select the brightest one
Photometry
cPhotometry
plot
comp_num