Example #1
0
    def generate_amplitude_map(self, x_array, y_array, x_offset=0, y_offset=0, max_val=None):
        "Given an x and y array will produce an amplitude map of the beam as defined. x/y offsets will displace the beam in the respective axis."

        if self.spatial == "gauss":
            import pykat.optics.gaussian_beams as gb
            q = gb.BeamParam(w0=self.w0, z=self.z)
            HG00 = gb.HG_mode(q,n=0, m=0)
            u00 = np.sqrt(self.power)*HG00.Unm(y_array-y_offset, x_array-x_offset)
            self.amplitude_map = u00
            return u00
        
        elif self.spatial == "user":
            #applies user array to custimize beam shape
            name = input(print("Please enter file path to numpy beam array: ")) #allow .jpeg? 
            pixel_pitch = 6.9e-6
            array = np.load(name)
            xx, yy = np.meshgrid(x_array,y_array)
            ampIntArr = np.zeros(np.shape(yy))#(ROWS, COLUMNS)
            
            if array.shape != (xx.shape): #numpy array is (ROWS, COLUMNS) #need to generalize, why doesnt xx work
                print('Entered array is not the correct size. Please enter an array with ' 
                    + str(np.shape(yy)) + ' Rows and Columns.')
            else: 
                Inten = self.power / (array.size * pixel_pitch**2) 
                ampIntArr = np.sqrt( array * Inten / np.sum(array))
                return ampIntArr

        else:
            xx, yy = np.meshgrid(x_array,y_array)
            tophat = np.zeros(np.shape(xx))
            r = 1e-3
            mask = xx**2 + yy**2 < r**2
            tophat[mask] = np.sqrt(self.power)/(np.sqrt(np.pi)*r)
            self.amplitude_map = tophat
            return tophat
Example #2
0
def HG_mode_content(w0, z, beam_data, x, y, n, m):
    
    import pykat.optics.gaussian_beams as gb
    q = gb.gauss_param(w0=w0, z=z)
    
    for i in range(0, n+1):
        for j in range(0, m+1):
            HG_mode = gb.HG_mode(q, n=i, m=j)
            HG_field = HG_mode.Unm(X,Y)
            k_nm = np.vdot(beam_data, HG_field)*np.diff(X)[0]*np.diff(Y)[0]
            print('%i%i: %.20F   %.20F' % (i, j, np.real(k_nm), np.imag(k_nm)))
Example #3
0
def gauss_amp(x_array, y_array, w0, z, x_offset, y_offset):
    import pykat.optics.gaussian_beams as gb
    q = gb.BeamParam(w0=w0, z=z)
    HG00 = gb.HG_mode(q,n=0, m=0)
    u00 = HG00.Unm(y_array-y_offset, x_array-x_offset)
    return u00