예제 #1
0
파일: MAIN.py 프로젝트: lbusoni/MEDIS
    def __init__(self, image, pos, imparams):
	
	cx=imparams['centerx']
	cy=imparams['centery']
	fwhm = int(imparams['lambdaoverd'])
        angle = imparams['angle']
        speckle_rad = fwhm * 2.5 *3.
        # !!!!! remove factor * 2.5 * 3. for a full aperture !!!!!!!
        aperture_mask = detect_speckles.create_speckle_mask(image, pos, cx, cy, speckle_rad)
	
	# modified attribute
	self.none  = aperture_mask
        
	self.speckleim=np.zeros(image.shape)
        self.moments = cv2.moments(image*aperture_mask)
        self.intensity = self.moments['m00']
        self.intensity_scan = np.zeros(4)
        self.xcentroid = self.moments['m10']/self.intensity
        self.ycentroid = self.moments['m01']/self.intensity
        self.kvec      = DM.convert_pixels_kvecs(self.xcentroid,
                                                 self.ycentroid,
                                                 **imparams)
        self.kvecx     = -self.kvec[0]
        self.kvecy     = self.kvec[1]
        self.krad      = np.linalg.norm((self.kvecx, self.kvecy))

	# new attributes
	self.amplitude = detect_speckles.get_speckle_photometry(image, aperture_mask)
	#self.kxy = detect_speckles.get_speckle_spatial_freq(image, pos, cx, cy, fwhm, angle)
	self.kxy = DM.convert_pixels_kvecs(pos[1],pos[0],**imparams)
        self.kx = -self.kxy[0]
	self.ky = self.kxy[1]
	self.kmod = np.linalg.norm((self.kx, self.ky))
예제 #2
0
 def __init__(self, image, xp, yp, config):
     self.imparams = config['IM_PARAMS']
     self.abc = config['INTENSITY_CAL']['abc']
     self.xcentroid = xp
     self.ycentroid = yp
     self.kvec = DM.convert_pixels_kvecs(self.xcentroid, self.ycentroid,
                                         **self.imparams)
     self.kvecx = self.kvec[0]
     self.kvecy = self.kvec[1]
     self.krad = np.linalg.norm((self.kvecx, self.kvecy))
     self.aperture = detect_speckles.create_speckle_aperture(
         image, self.xcentroid, self.ycentroid,
         config['INTENSITY_CAL']['aperture_radius'])
     #Edit to take into account aperture on other side
     #self.aperture = self.aperture + detect_speckles.create_speckle_aperture(
     #        image, 2*self.imparams['centerx']-self.xcentroid,
     #               2*self.imparams['centery']-self.ycentroid,
     #               config['INTENSITY_CAL']['aperture_radius'])
     #Edit to take into account aperture on other side
     self.exclusionzone = detect_speckles.create_speckle_aperture(
         image, self.xcentroid, self.ycentroid,
         1.5 * config['INTENSITY_CAL']['aperture_radius'])
     #self.exclusionzone  = self.exclusionzone + detect_speckles.create_speckle_aperture(
     #        image, 2*self.imparams['centerx']-self.xcentroid,
     #               2*self.imparams['centery']-self.ycentroid,
     #               1.5*config['INTENSITY_CAL']['aperture_radius'])
     self.intensity = detect_speckles.get_speckle_photometry(
         image, self.aperture)
     self.phase_intensities = [None, None, None, None]
     self.phases = config['NULLING']['phases']
     self.null_phase = None
예제 #3
0
파일: test.py 프로젝트: lbusoni/MEDIS
 def __init__(self, image,xp, yp, config):
     self.imparams = config['IM_PARAMS']
     self.abc       = config['INTENSITY_CAL']['abc']
     self.xcentroid = xp 
     self.ycentroid = yp 
     self.kvec      = DM.convert_pixels_kvecs(self.xcentroid,
                                              self.ycentroid,
                                              **self.imparams)
     self.kvecx     = self.kvec[0]
     self.kvecy     = self.kvec[1]
     self.krad      = np.linalg.norm((self.kvecx, self.kvecy))
     self.aperture  = detect_speckles.create_speckle_aperture(
             image, self.xcentroid, self.ycentroid, config['INTENSITY_CAL']['aperture_radius'])
     self.intensity = detect_speckles.get_speckle_photometry(image, self.aperture)
     self.intensities = [None, None, None, None]
예제 #4
0
 def recompute_intensity(self, phaseimage):
     return detect_speckles.get_speckle_photometry(phaseimage,
                                                   self.aperture)
예제 #5
0
            subim = pre.subimage(im, xy, window=10)
            subx = pre.subimage(ximcoords, xy, window=10)
            suby = pre.subimage(yimcoords, xy, window=10)
            gauss_params = snm.fitgaussian((subx, suby), subim)
            spotx, spoty = gauss_params[1], gauss_params[2]
            #convert pixels returns an xy pair.
            # in theory all the kvecs should be (x, 0) or (0, y)
            # in which case the norm will be equal to x or y
            kvec = np.linalg.norm(
                DM.convert_pixels_kvecs(spotx, spoty, **im_params))
            print "Gaussian centroid", spotx, spoty
            print "corr. k-vector", kvec
            meankvec = (meankvec * float(idx) / float(idx + 1) +
                        kvec / float(idx + 1))
            aperture = create_speckle_aperture(im, spotx, spoty, ap_rad)
            photometry = get_speckle_photometry(im, aperture)

            w1.set_data(np.log(np.abs(im * aperture)))
            plt.draw()
            plt.pause(0.01)
            w1.set_data(np.log(np.abs(im)))
            plt.draw()
            plt.pause(0.01)
            #w1.autoscale_view()
            meanphotom = (meanphotom * float(idx) / float(idx + 1) +
                          photometry / float(idx + 1))

        print("\nIntended radial k-vector: " + str(kvecr) +
              "\nMean k-vector: " + str(meankvec))

        intensity_array.append(meanphotom)