Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/resolution_calculator.py

    r9a5097c r463e7ffc  
    1212from math import sqrt 
    1313import math 
    14 import numpy as np 
     14import numpy 
    1515import sys 
    1616import logging 
     17 
     18logger = logging.getLogger(__name__) 
    1719 
    1820#Plank's constant in cgs unit 
     
    393395        dx_size = (self.qx_max - self.qx_min) / (1000 - 1) 
    394396        dy_size = (self.qy_max - self.qy_min) / (1000 - 1) 
    395         x_val = np.arange(self.qx_min, self.qx_max, dx_size) 
    396         y_val = np.arange(self.qy_max, self.qy_min, -dy_size) 
    397         q_1, q_2 = np.meshgrid(x_val, y_val) 
     397        x_val = numpy.arange(self.qx_min, self.qx_max, dx_size) 
     398        y_val = numpy.arange(self.qy_max, self.qy_min, -dy_size) 
     399        q_1, q_2 = numpy.meshgrid(x_val, y_val) 
    398400        #q_phi = numpy.arctan(q_1,q_2) 
    399401        # check whether polar or cartesian 
     
    887889        x_value = x_val - x0_val 
    888890        y_value = y_val - y0_val 
    889         phi_i = np.arctan2(y_val, x_val) 
     891        phi_i = numpy.arctan2(y_val, x_val) 
    890892 
    891893        # phi correction due to the gravity shift (in phi) 
     
    893895        phi_i = phi_i - phi_0 + self.gravity_phi 
    894896 
    895         sin_phi = np.sin(self.gravity_phi) 
    896         cos_phi = np.cos(self.gravity_phi) 
     897        sin_phi = numpy.sin(self.gravity_phi) 
     898        cos_phi = numpy.cos(self.gravity_phi) 
    897899 
    898900        x_p = x_value * cos_phi + y_value * sin_phi 
     
    908910        nu_value = -0.5 * (new_x * new_x + new_y * new_y) 
    909911 
    910         gaussian = np.exp(nu_value) 
     912        gaussian = numpy.exp(nu_value) 
    911913        # normalizing factor correction 
    912914        gaussian /= gaussian.sum() 
     
    954956            nu_value *= nu_value 
    955957            nu_value *= -0.5 
    956             gaussian *= np.exp(nu_value) 
     958            gaussian *= numpy.exp(nu_value) 
    957959            gaussian /= sigma 
    958960            # normalize 
     
    10061008            detector_offset = self.sample2detector_distance[1] 
    10071009        except: 
    1008             logging.error(sys.exc_value) 
     1010            logger.error(sys.exc_value) 
    10091011 
    10101012        # detector size in [no of pix_x,no of pix_y] 
     
    10261028                                                           offset_x, offset_y) 
    10271029        # distance [cm] from the beam center on detector plane 
    1028         detector_ind_x = np.arange(detector_pix_nums_x) 
    1029         detector_ind_y = np.arange(detector_pix_nums_y) 
     1030        detector_ind_x = numpy.arange(detector_pix_nums_x) 
     1031        detector_ind_y = numpy.arange(detector_pix_nums_y) 
    10301032 
    10311033        # shif 0.5 pixel so that pix position is at the center of the pixel 
     
    10411043        detector_ind_y = detector_ind_y * pix_y_size 
    10421044 
    1043         qx_value = np.zeros(len(detector_ind_x)) 
    1044         qy_value = np.zeros(len(detector_ind_y)) 
     1045        qx_value = numpy.zeros(len(detector_ind_x)) 
     1046        qy_value = numpy.zeros(len(detector_ind_y)) 
    10451047        i = 0 
    10461048 
     
    10611063 
    10621064        # p min and max values among the center of pixels 
    1063         self.qx_min = np.min(qx_value) 
    1064         self.qx_max = np.max(qx_value) 
    1065         self.qy_min = np.min(qy_value) 
    1066         self.qy_max = np.max(qy_value) 
     1065        self.qx_min = numpy.min(qx_value) 
     1066        self.qx_max = numpy.max(qx_value) 
     1067        self.qy_min = numpy.min(qy_value) 
     1068        self.qy_max = numpy.max(qy_value) 
    10671069 
    10681070        # Appr. min and max values of the detector display limits 
     
    10881090            from sas.sascalc.dataloader.data_info import Data2D 
    10891091            output = Data2D() 
    1090             inten = np.zeros_like(qx_value) 
     1092            inten = numpy.zeros_like(qx_value) 
    10911093            output.data = inten 
    10921094            output.qx_data = qx_value 
    10931095            output.qy_data = qy_value 
    10941096        except: 
    1095             logging.error(sys.exc_value) 
     1097            logger.error(sys.exc_value) 
    10961098 
    10971099        return output 
     
    11071109        plane_dist = dx_size 
    11081110        # full scattering angle on the x-axis 
    1109         theta = np.arctan(plane_dist / det_dist) 
    1110         qx_value = (2.0 * pi / wavelength) * np.sin(theta) 
     1111        theta = numpy.arctan(plane_dist / det_dist) 
     1112        qx_value = (2.0 * pi / wavelength) * numpy.sin(theta) 
    11111113        return qx_value 
    11121114 
Note: See TracChangeset for help on using the changeset viewer.