Exemplo n.º 1
0
def main(file_path):

    darklist = functions.find_objname(file_path,functions.read_config_file("BIAS_HEADER"))
    master_dark = average_darks(darklist)
    try:
        functions.save_fits(master_dark,file_path+"temp/master_dark.fits")
    except IOError:
        os.system("mkdir "+file_path+"temp/")
        functions.save_fits(master_dark,file_path+"temp/master_dark.fits")
Exemplo n.º 2
0
def fistar(fits):
    ### Use this command to automatically identify stars within an image
    ### to create a catalogue for matching

    ### first apply median filter to image
    data = pyfits.getdata(fits)
    data = ndimage.filters.median_filter(data,10)
    functions.save_fits(data,"temp.fits")
    
    command = "fistar "
    #command += "-i "+fits+" "
    command += "-i temp.fits "
    command += "-o "+fits+".fistar "
    command += "-t 100 "
    #command += "-f 1000 "
    command += "-M badpix.fits "
    command += "-F id,cx,cy,fwhm"
    
    os.system(command)

    ### Now plot image
    image = pyfits.getdata(fits)

    coords = loadtxt(fits+".fistar")

    mask = coords[:,3] > 3.
    
    mask *= coords[:,1] > 10 
    mask *= coords[:,1] < len(image[0])-10
    mask *= coords[:,2] > 10 
    mask *= coords[:,2] < len(image[0])-10
    coords = coords[mask]


    savetxt(fits+".fistar",coords,fmt="%.5f")

    #sigma = 0.01
    #stdev = std(image)
    lim = 500
    med = median(image)

    plt.clf()
    plt.imshow(image,cmap="gray",origin="lower",vmin=med-0.5*lim,vmax=med+lim,interpolation="nearest")

    plt.scatter(coords[:,1],coords[:,2],marker="o",facecolor="None",edgecolor="r",s=200)
    plt.savefig(fits+".png")
    #plt.show()
    plt.close()


    return coords
Exemplo n.º 3
0
def main(file_path):

    darklist = functions.find_objname(file_path,functions.read_config_file("FLAT_HEADER"))

    if len(darklist) == 0:
        print "Error: no flats found"
        raise IOError

    master_dark = average_darks(darklist,file_path+"temp/master_dark.fits")
    
    try:
        functions.save_fits(master_dark,file_path+"temp/master_flat.fits")
    except IOError:
        os.system("mkdir "+file_path+"temp/")
        functions.save_fits(master_dark,file_path+"temp/master_flat.fits")