def make_flat(path=None,band='gp',bias=None,dark=None):

    """
    Make master flat from raw data files in specified band
    """
    if not path:
        path = set_path()

    if length(bias) == 1:
        bias = make_bias(path=path)

    if length(dark) == 1:
        dark = make_dark(path=path, bias=bias)
        
    flats,ct   = tp.get_files(dir=path, tag='SkyFlat.'+band)
    masterflat = tp.master_flat(flats, bias=bias, dark=dark, outdir='./', suffix=band)

    return masterflat
plt.figure(1)
plt.plot([x0],[y0],'y+',markersize=30)
plt.xlim(0,2048)
plt.ylim(0,2048)


darks,dct = tp.get_files(tag='Dark')
biases,bct = tp.get_files(tag='Bias')
flats,fct = tp.get_files(tag='SkyFlat')
targetfiles,tct = tp.get_files(tag='KIC10935310')

bias = tp.master_bias(biases,outdir='./Photometry/',readnoise=False)

dark = tp.master_dark(darks,bias=bias,outdir='./Photometry/')

flat = tp.master_flat(flats,bias=bias,dark=dark,outdir='./Photometry/')

cal = (image - dark - bias)/flat
qi.display_image(cal,siglo=2,sighi=2)
plt.plot([x0],[y0],'y+',markersize=30,linewidth=1e6)
plt.xlim(0,2048)
plt.ylim(0,2048)

# define the aperture
radius,ynew,xnew,fwhm,aspect,snrmax,totflux,totap,chisq = \
    tp.optimal_aperture(x0,y0,image,skyrad=[15,20])

pref = np.array([[x0,y0],[836,1154],[645,1152], [1234,1002], [1131,1338], [377,426]])
coords0 = w.wcs_pix2world(pref,1) 
ras = coords0[:,0]
decs = coords0[:,1]