DifferentialPhotometry_functions_student.py
def target_list(memberlist, ra_all, dec_all):
    ''' finds the index, ra, dec of target star(s) from another catalogue (e.g. DAOstarfinder) either from inputted tuple or region file. '''
    #checks to see if memberlist is a tuple or region file
    if isinstance(memberlist, tuple):
        ra_mem = [memberlist[0]]
        dec_mem = [memberlist[1]]
    elif isinstance(memberlist, str):
        try:
            regions = read_ds9(memberlist)
            ra_mem = [i.center.ra.deg for i in regions]
            dec_mem = [i.center.dec.deg for i in regions]
        except:
            print('memberlist must be a region file or tuple')
        
    else:
        ValueError('memberlist must be region file or tuple')
    
    print('number of targets: {}'.format(len(ra_mem)))
    
    #finds your target star index in the catalog found with DAOStarFinder
    c = SkyCoord(ra=ra_mem*u.degree, dec=dec_mem*u.degree)  
    catalog = SkyCoord(ra=ra_all*u.degree, dec=dec_all*u.degree)  
    
    #finds matches within 20" of the target
    max_sep = 20.0 * u.arcsec 
    ind, d2d, d3d = c.match_to_catalog_3d(catalog) 
    sep_constraint = d2d < max_sep 
    
    idx = ind[sep_constraint]
    
    return idx, ra_all[idx], dec_all[idx]
 finds the index, ra, dec of target star(s) from another catalogue (e.g. DAOstarfinder) either from inputted tuple or region file. 
finds the index, ra, dec of target star(s) from another catalogue  either from inputted tuple or region file.
finds the index ra dec of target star ( s ) from another catalogue either from inputted tuple or region file .
def target_list(memberlist, ra_all, dec_all):
    if isinstance(memberlist, tuple):
        ra_mem = [memberlist[0]]
        dec_mem = [memberlist[1]]
    elif isinstance(memberlist, str):
        try:
            regions = read_ds9(memberlist)
            ra_mem = [i.center.ra.deg for i in regions]
            dec_mem = [i.center.dec.deg for i in regions]
        except:
            print('memberlist must be a region file or tuple')
    else:
        ValueError('memberlist must be region file or tuple')
    print('number of targets: {}'.format(len(ra_mem)))
    c = SkyCoord(ra=ra_mem*u.degree, dec=dec_mem*u.degree)  
    catalog = SkyCoord(ra=ra_all*u.degree, dec=dec_all*u.degree)  
    max_sep = 20.0 * u.arcsec 
    ind, d2d, d3d = c.match_to_catalog_3d(catalog) 
    sep_constraint = d2d < max_sep 
    idx = ind[sep_constraint]
    return idx, ra_all[idx], dec_all[idx]
def target_list ( memberlist , ra_all , dec_all ) : if isinstance ( memberlist , tuple ) : ra_mem = [ memberlist [ 0 ] ] dec_mem = [ memberlist [ 1 ] ] elif isinstance ( memberlist , str ) : try : regions = read_ds9 ( memberlist ) ra_mem = [ i . center . ra . deg for i in regions ] dec_mem = [ i . center . dec . deg for i in regions ] except : print ( 'memberlist must be a region file or tuple' ) else : ValueError ( 'memberlist must be region file or tuple' ) print ( 'number of targets: {}' . format ( len ( ra_mem ) ) ) c = SkyCoord ( ra = ra_mem * u . degree , dec = dec_mem * u . degree ) catalog = SkyCoord ( ra = ra_all * u . degree , dec = dec_all * u . degree ) max_sep = 20.0 * u . arcsec ind , d2d , d3d = c . match_to_catalog_3d ( catalog ) sep_constraint = d2d < max_sep idx = ind [ sep_constraint ] return idx , ra_all [ idx ] , dec_all [ idx ]
finds the index, ra, dec of target star(s) from another catalogue (e.g.
finds the index ra dec of target star ( s ) from another catalogue ( e . g .
''' finds the index, ra, dec of target star(s) from another catalogue (e.g. DAOstarfinder) either from inputted tuple or region file. ''' #checks to see if memberlist is a tuple or region file #finds your target star index in the catalog found with DAOStarFinder #finds matches within 20" of the target
memberlist
ra_all
dec_all