def generate_flatmap(self, phase, a=None, b=None, c=None): """generates flatmap with a certain phase for this speckle""" # s_amp = DM.amplitudemodel(self.intensity, self.krad, a=a, b=b, c=c) # with the new attributes of speckle2 class object s_amp = DM.amplitudemodel(self.amplitude, self.kmod, a=a, b=b, c=c) # print 's_amp: ', s_amp, 'self.kmod: ', self.krad, 'phase: ', phase #return DM.make_speckle_kxy(self.kvecx, self.kvecy, s_amp, phase) return DM.make_speckle_kxy(self.kx, self.ky, s_amp, phase)
def generate_flatmap(self, speck_phase): """generates flatmap with a certain phase for this speckle""" # print 'intensity', self.intensity # ans = raw_input('press enter') s_amp = DM.amplitudemodel(self.intensity, self.krad, **self.abc) # print 'self.intensity:', self.intensity, 's_amp: ', s_amp, 'speck_phase: ', speck_phase#, 'x', self.xcentroid, 'y', self.ycentroid, 'kx', self.kvecx, 'ky', self.kvecy, 'self.krad: ', self.krad, self.s_amp = s_amp # print s_amp if np.isnan(self.s_amp): print('commented this out. needs checking') exit() # ipdb.set_trace() # phase = phase - 1.9378 # got this offset by measuring phase (with quicklook_wf) when input phase is 0 dm_phase = speck_phase + 1.9377 if dm_phase >= np.pi: dm_phase = dm_phase - (2 * np.pi) return DM.make_speckle_kxy(self.kvecx, self.kvecy, s_amp, dm_phase)
def generate_flatmap(self, phase): """generates flatmap with a certain phase for this speckle""" s_amp = DM.amplitudemodel(self.intensity, self.krad, **self.abc) print 's_amp: ', s_amp, 'self.krad: ', self.krad, 'phase: ', phase return DM.make_speckle_kxy(self.kvecx, self.kvecy, s_amp, phase)
dummy4 = speckleobjects[1].none dummy5 = speckleobjects[2].none dummy6 = speckleobjects[3].none dummy7 = speckleobjects[4].none zoom = im*dummy3*controlregion_tmp # 2*dummy*im*controlregion_tmp + im plt.imshow(dummy3+controlregion_tmp+dummy4+dummy5+dummy6+dummy7) plt.show() #ipdb.set_trace() #intensities = np.zeros((len(speckleobjects), len(phases))) #intensities[:, 0] = np.array([x.intensity for x in speckleobjects]) #figures out the initial amplitude to match to the speckle intensity # equiv_amps = np.array([DM.amplitudemodel(a.intensity, a.krad, **abc) for a in speckleobjects]) # with the new attributes of speckle2 class object equiv_amps = np.array([DM.amplitudemodel(a.amplitude, a.kmod, **abc) for a in speckleobjects]) for idx, phase in enumerate(phases): print "Taking image" flatmap_perturb = 0 for speck in speckleobjects: # Generates the sine waves corresponding to all speckles and add them up flatmap_perturb = flatmap_perturb + speck.generate_flatmap(phase, **abc) #plt.figure(1) #plt.imshow(flatmap_perturb) #plt.show() print phase superposition = initial_flatmap + flatmap_perturb #plt.plot(initial_flatmap[:,33], 'b') #plt.plot(flatmap_perturb[:,33], 'r--')
dummy4 = speckleobjects[1].none dummy5 = speckleobjects[2].none dummy7 = speckleobjects[3].none dummy7 = speckleobjects[4].none zoom = im * dummy3 * controlregion_tmp # 2*dummy*im*controlregion_tmp + im plt.imshow(dummy3 + controlregion_tmp + dummy4 + dummy5 + dummy6 + dummy7) plt.show() #ipdb.set_trace() #intensities = np.zeros((len(speckleobjects), len(phases))) #intensities[:, 0] = np.array([x.intensity for x in speckleobjects]) #figures out the initial amplitude to match to the speckle intensity # equiv_amps = np.array([DM.amplitudemodel(a.intensity, a.krad, **abc) for a in speckleobjects]) # with the new attributes of speckle2 class object equiv_amps = np.array([ DM.amplitudemodel(a.amplitude, a.kmod, **abc) for a in speckleobjects ]) for idx, phase in enumerate(phases): print "Taking image" flatmap_perturb = 0 for speck in speckleobjects: # Generates the sine waves corresponding to all speckles and add them up flatmap_perturb = flatmap_perturb + speck.generate_flatmap( phase, **abc) #plt.figure(1) #plt.imshow(flatmap_perturb) #plt.show() print phase superposition = initial_flatmap + flatmap_perturb