Ignore:
Timestamp:
Mar 26, 2017 9:33:16 PM (7 years ago)
Author:
andyfaff
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
ed2276f
Parents:
9146ed9
Message:

MAINT: import numpy as np

File:
1 edited

Legend:

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

    rb699768 r9a5097c  
    1212from math import sqrt 
    1313import math 
    14 import numpy 
     14import numpy as np 
    1515import sys 
    1616import logging 
     
    393393        dx_size = (self.qx_max - self.qx_min) / (1000 - 1) 
    394394        dy_size = (self.qy_max - self.qy_min) / (1000 - 1) 
    395         x_val = numpy.arange(self.qx_min, self.qx_max, dx_size) 
    396         y_val = numpy.arange(self.qy_max, self.qy_min, -dy_size) 
    397         q_1, q_2 = numpy.meshgrid(x_val, y_val) 
     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) 
    398398        #q_phi = numpy.arctan(q_1,q_2) 
    399399        # check whether polar or cartesian 
     
    887887        x_value = x_val - x0_val 
    888888        y_value = y_val - y0_val 
    889         phi_i = numpy.arctan2(y_val, x_val) 
     889        phi_i = np.arctan2(y_val, x_val) 
    890890 
    891891        # phi correction due to the gravity shift (in phi) 
     
    893893        phi_i = phi_i - phi_0 + self.gravity_phi 
    894894 
    895         sin_phi = numpy.sin(self.gravity_phi) 
    896         cos_phi = numpy.cos(self.gravity_phi) 
     895        sin_phi = np.sin(self.gravity_phi) 
     896        cos_phi = np.cos(self.gravity_phi) 
    897897 
    898898        x_p = x_value * cos_phi + y_value * sin_phi 
     
    908908        nu_value = -0.5 * (new_x * new_x + new_y * new_y) 
    909909 
    910         gaussian = numpy.exp(nu_value) 
     910        gaussian = np.exp(nu_value) 
    911911        # normalizing factor correction 
    912912        gaussian /= gaussian.sum() 
     
    954954            nu_value *= nu_value 
    955955            nu_value *= -0.5 
    956             gaussian *= numpy.exp(nu_value) 
     956            gaussian *= np.exp(nu_value) 
    957957            gaussian /= sigma 
    958958            # normalize 
     
    10261026                                                           offset_x, offset_y) 
    10271027        # distance [cm] from the beam center on detector plane 
    1028         detector_ind_x = numpy.arange(detector_pix_nums_x) 
    1029         detector_ind_y = numpy.arange(detector_pix_nums_y) 
     1028        detector_ind_x = np.arange(detector_pix_nums_x) 
     1029        detector_ind_y = np.arange(detector_pix_nums_y) 
    10301030 
    10311031        # shif 0.5 pixel so that pix position is at the center of the pixel 
     
    10411041        detector_ind_y = detector_ind_y * pix_y_size 
    10421042 
    1043         qx_value = numpy.zeros(len(detector_ind_x)) 
    1044         qy_value = numpy.zeros(len(detector_ind_y)) 
     1043        qx_value = np.zeros(len(detector_ind_x)) 
     1044        qy_value = np.zeros(len(detector_ind_y)) 
    10451045        i = 0 
    10461046 
     
    10611061 
    10621062        # p min and max values among the center of pixels 
    1063         self.qx_min = numpy.min(qx_value) 
    1064         self.qx_max = numpy.max(qx_value) 
    1065         self.qy_min = numpy.min(qy_value) 
    1066         self.qy_max = numpy.max(qy_value) 
     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) 
    10671067 
    10681068        # Appr. min and max values of the detector display limits 
     
    10881088            from sas.sascalc.dataloader.data_info import Data2D 
    10891089            output = Data2D() 
    1090             inten = numpy.zeros_like(qx_value) 
     1090            inten = np.zeros_like(qx_value) 
    10911091            output.data = inten 
    10921092            output.qx_data = qx_value 
     
    11071107        plane_dist = dx_size 
    11081108        # full scattering angle on the x-axis 
    1109         theta = numpy.arctan(plane_dist / det_dist) 
    1110         qx_value = (2.0 * pi / wavelength) * numpy.sin(theta) 
     1109        theta = np.arctan(plane_dist / det_dist) 
     1110        qx_value = (2.0 * pi / wavelength) * np.sin(theta) 
    11111111        return qx_value 
    11121112 
Note: See TracChangeset for help on using the changeset viewer.