Esempio n. 1
0
                f[r,t] = smoothim(yp,xp)

        #median over all theta for every r and generate a non-discrete function
        f = np.median(f, axis=1)
        smoothf = intp.interp1d(R,f,bounds_error=False,fill_value=f[299])

        #generate the r coordinate of every point in the image
        xp, yp = np.arange(1024),np.arange(1024)
        xg, yg = np.meshgrid(xp,yp)
        rp = np.sqrt((xg-o)**2 + (yg-o)**2)

        #subtract the subtracted image and output to file
        imsub = im - smoothf(rp)
        fits.writeto('results/'+fileNames[i][:-5]+'.ringsub.fits',imsub)

        #progress bar
        percent = float(i) / n
        hashes = '#' * int(round(percent * 20))
        spaces = ' ' * (20 - len(hashes))
        sys.stdout.write("\rPercent: [{0}] {1}%".format(hashes + spaces, int(round(percent * 100))))
        sys.stdout.flush()
sys.stdout.write("\n")

#register and stack images
positions = ascii.read('starPositions.txt')
positions['x'] = np.ones(n)*512
positions['y'] = np.ones(n)*512
xref, yref = 512., 512.

iS.register(2,'results/',fileNames,'ringsub.', targets, positions, (xref,yref))
Esempio n. 2
0
from astropy.io import ascii
import sys
import imageSubs as iS


#load file names, target list and star positions
files = ascii.read('NIRC2_sci_20020_1.txt')
fileNames = np.array(files['fileNames'])
targets = np.array(files['target'])

positions = ascii.read('starPositions.txt')
#stack all images so the star is in the center
xref, yref = 512., 512.

#register, rotate and stack images
iS.register(2, 'calfits/', fileNames, '', targets, positions, (xref,yref))

##old code moved to imageSubs
#ROXs42B = np.array([])
#ROXs42Br = np.array([])
#ROXs12 = np.array([])
#ROXs12r = np.array([])
#n = np.size(targets)
#
#for i in range(n):
#    
#    im = fits.getdata('calfits/'+fileNames[i])
#    sim = intp.shift(im,[yref-positions['y'][i],xref-positions['x'][i]])
#    fits.writeto('results/'+fileNames[i][:-5]+'.reg.fits',sim)
#    hdr = fits.getheader('calfits/'+fileNames[i])
#    PA = hdr['PARANG']+hdr['ROTPPOSN']-hdr['EL']-hdr['INSTANGL']