Beispiel #1
0
def ABSORPTIVE1():
    """
    
    CHANGELOG:
    - 20110912 RB: init
    """
    n = 100

    window_fxn = [
        ["none", n], 
        ["ones", n], 
        ["triangle", n], 
        ["gaussian", n], 
        ["none", n/2], 
        ["ones", n/2], 
        ["triangle", n/2], 
        ["gaussian", n/2]
    ]

    array = numpy.ones(n)
    
    plt.figure()
    
    for i in range(len(window_fxn)):    
    
        w_array = M.window_functions(array, window_fxn[i][0], window_fxn[i][1])
        
        plt.subplot(2, 4, i+1)
        
        plt.plot(w_array)
        plt.title(window_fxn[i][0] + " " + str(window_fxn[i][1]))
        plt.ylim(0,1.1)
    plt.show()
Beispiel #2
0
    def find_w1_peaks(self, verbose = False):
        
        data = self.mess.s[self.w1_peaks_y_i[0]:self.w1_peaks_y_i[1], self.w1_peaks_x_i[0]:self.w1_peaks_x_i[1]]
        # x_axis = self.mess.s_axis[2][self.w1_peaks_x_i[0]:self.w1_peaks_x_i[1]]
        y_axis = self.mess.s_axis[0][self.w1_peaks_y_i[0]:self.w1_peaks_y_i[1]]        

        y = numpy.sum(data,1)
   
        A_out = MATH.fit(y_axis, y, EQ.rb_lorentzian, self.w1_peaks_A_in)
           
        self.w1_peaks[0] = A_out[1]
Beispiel #3
0
    def fit_double_lorentzian(self, flag_plot = False, verbose = False):
        """
        For a selection of points on the w1-axis, take a cut (giving w3 vs z (intensity) plot) and fit it with a double Lorentzian. 
        """
        
        if verbose:
            print("Fit double Lorentzian for " + self.objectname)
            print("  x_min", self.dl_x_i[0], self.mess.s_axis[2][self.dl_x_i[0]])
            print("  x_max", self.dl_x_i[1], self.mess.s_axis[2][self.dl_x_i[1]])
            print("  y_min", self.dl_y_i[0], self.mess.s_axis[0][self.dl_y_i[0]])
            print("  y_max", self.dl_y_i[1], self.mess.s_axis[0][self.dl_y_i[1]])
        
        data = self.mess.s[self.dl_y_i[0]:self.dl_y_i[1], self.dl_x_i[0]:self.dl_x_i[1]]
        x_axis = self.mess.s_axis[2][self.dl_x_i[0]:self.dl_x_i[1]]
        y_axis = self.mess.s_axis[0][self.dl_y_i[0]:self.dl_y_i[1]]
    
        n_y, n_x = numpy.shape(data)
        
        y_max = numpy.zeros(n_y)
        y_min = numpy.zeros(n_y)
        
        y_out_array = numpy.zeros((n_y, 8))

        if flag_plot:
            plt.figure()
            color_array = ["b", "g", "r", "c", "m", "y", "k"]

        for i in range(n_y):
        
            y = data[i,:]

            A_out = MATH.fit(x_axis, y, EQ.rb_two_lorentzians, self.dl_A_in)        
                
            y_out_array[i,:] = A_out
    
            x_fit = numpy.arange(x_axis[0], x_axis[-1], 0.1)
            y_fit = EQ.rb_two_lorentzians(A_out, x_fit)
            
            if flag_plot:  
                plt.plot(x_fit, y_fit, c = color_array[i%len(color_array)])
                plt.plot(x_axis, y, ":", c = color_array[i%len(color_array)])
                
                        
            y_max[i] = x_fit[numpy.argmax(y_fit)]
            y_min[i] = x_fit[numpy.argmin(y_fit)]

        self.dl_ble = y_min
        self.dl_esa = y_max
        self.dl_A = y_out_array
        
        if flag_plot:
            plt.show()
Beispiel #4
0
    def fit_tilt(self, verbose = False):
        
        if verbose:
            print("Fit tilt for " + self.objectname)
            print("  x_min", self.dl_x_i[0], self.mess.s_axis[2][self.dl_x_i[0]])
            print("  x_max", self.dl_x_i[1], self.mess.s_axis[2][self.dl_x_i[1]])
            print("  y_min", self.dl_y_i[0] + self.l_i[0], self.mess.s_axis[0][self.dl_y_i[0] + self.l_i[0]])
            print("  y_max", self.dl_y_i[0] + self.l_i[1], self.mess.s_axis[0][self.dl_y_i[0] + self.l_i[1]])

        y = self.mess.s_axis[0][self.dl_y_i[0] + self.l_i[0]:self.dl_y_i[0] + self.l_i[1]]     

        x = self.dl_ble[self.l_i[0]:self.l_i[1]]
        self.l_A_ble = MATH.fit(x, y, EQ.linear, self.l_A_in)
        
        x = self.dl_esa[self.l_i[0]:self.l_i[1]]
        self.l_A_esa = MATH.fit(x, y, EQ.linear, self.l_A_in)
        
        self.l_angle_ble = 90 - numpy.arctan(self.l_A_ble[1]) * 180 / numpy.pi
        self.l_angle_esa = 90 - numpy.arctan(self.l_A_esa[1]) * 180 / numpy.pi
        
        self.l_slope_ble = 1 / self.l_A_ble[1]
        self.l_slope_esa = 1 / self.l_A_esa[1]