예제 #1
0
# Apply flatfield
img1 = flat.ImgNormalize(image, Method="mean", source="image")
#img1 = flat.ImgNormalize(img1, Method="mean", source="image")
img2 = sm.colmeansub(image)

# Find stars
centers = centroid.findstars(img1, zreject=3, zthresh=3.0, zpeakthresh=4, min_pix_per_star=6, max_pix_per_star=60, oblongness=5,debug=False)


C = centroid.imgcentroid(image,centers)



#img3 = sm.colmeansub(img2)
#img4 = sm.colmeansub(image2)

#img3 = np.delete(img3, np.r_[1080:1080+32], 0)

#imgutil.dispimg(image,1)
#imgutil.dispimg(img1,1)
#imgutil.dispimg(img2,6)

#imgutil.dispimg(sm.bgsub(img1), 6)
#imgutil.dispimg(sm.colmeansub(img1), 6)

imgutil.circstars(sm.colmeansub(img1), C, viewfactor=3)



예제 #2
0
print 'Opening: ' + fname
image = imgutil.loadimg(fname, from_database=True)

tic = time.clock()
# Clean-up the image:
#image = flatfield.NormalizeColumnGains(image,Plot=0,Wiener=0)
image = flatfield.ImgNormalize(image, Method="mean")
toc = time.clock()

# Find star centroids:
centroids = []
(centers) = centroid.findstars(image,
                               zreject=3,
                               zthresh=3.0,
                               zpeakthresh=4,
                               min_pix_per_star=6,
                               max_pix_per_star=60,
                               oblongness=2,
                               debug=True)
centroids = centroid.imgcentroid(image, centers)

# Display image with stars circled:
vf = 3
if centroids:
    imgutil.circstars(image, centroids, 20, viewfactor=vf)
else:
    print 'Oopsies... we found ZERO centroids. Now how do you feel?'
    imgutil.dispimg(image, viewfactor=vf)

print 'Total time: ', toc - tic, ' s'
###################################################################################
# Load the image:
db = database.Connect()
fnames = db.select('select raw_fn from rawdata where burst_num = 185 limit 2').raw_fn.tolist()
fnames.sort()
fname = fnames[0]
print 'Opening: ' + fname
image = imgutil.loadimg(fname,from_database=True)

tic = time.clock()
# Clean-up the image:
#image = flatfield.NormalizeColumnGains(image,Plot=0,Wiener=0)
image = flatfield.ImgNormalize(image, Method="mean")
toc = time.clock()

# Find star centroids:
centroids = []
(centers) = centroid.findstars(image,zreject=3, zthresh=3.0, zpeakthresh=4, min_pix_per_star=6, max_pix_per_star=60, oblongness=2,debug=True)
centroids = centroid.imgcentroid(image,centers)

        
# Display image with stars circled:
vf = 3
if centroids:
    imgutil.circstars(image,centroids,20,viewfactor=vf)
else:
    print 'Oopsies... we found ZERO centroids. Now how do you feel?'
    imgutil.dispimg(image,viewfactor=vf)

print 'Total time: ',toc - tic,' s'