Changes in src/sas/sascalc/calculator/resolution_calculator.py [9a5097c:463e7ffc] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/resolution_calculator.py
r9a5097c r463e7ffc 12 12 from math import sqrt 13 13 import math 14 import numpy as np14 import numpy 15 15 import sys 16 16 import logging 17 18 logger = logging.getLogger(__name__) 17 19 18 20 #Plank's constant in cgs unit … … 393 395 dx_size = (self.qx_max - self.qx_min) / (1000 - 1) 394 396 dy_size = (self.qy_max - self.qy_min) / (1000 - 1) 395 x_val = n p.arange(self.qx_min, self.qx_max, dx_size)396 y_val = n p.arange(self.qy_max, self.qy_min, -dy_size)397 q_1, q_2 = n p.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) 398 400 #q_phi = numpy.arctan(q_1,q_2) 399 401 # check whether polar or cartesian … … 887 889 x_value = x_val - x0_val 888 890 y_value = y_val - y0_val 889 phi_i = n p.arctan2(y_val, x_val)891 phi_i = numpy.arctan2(y_val, x_val) 890 892 891 893 # phi correction due to the gravity shift (in phi) … … 893 895 phi_i = phi_i - phi_0 + self.gravity_phi 894 896 895 sin_phi = n p.sin(self.gravity_phi)896 cos_phi = n p.cos(self.gravity_phi)897 sin_phi = numpy.sin(self.gravity_phi) 898 cos_phi = numpy.cos(self.gravity_phi) 897 899 898 900 x_p = x_value * cos_phi + y_value * sin_phi … … 908 910 nu_value = -0.5 * (new_x * new_x + new_y * new_y) 909 911 910 gaussian = n p.exp(nu_value)912 gaussian = numpy.exp(nu_value) 911 913 # normalizing factor correction 912 914 gaussian /= gaussian.sum() … … 954 956 nu_value *= nu_value 955 957 nu_value *= -0.5 956 gaussian *= n p.exp(nu_value)958 gaussian *= numpy.exp(nu_value) 957 959 gaussian /= sigma 958 960 # normalize … … 1006 1008 detector_offset = self.sample2detector_distance[1] 1007 1009 except: 1008 logg ing.error(sys.exc_value)1010 logger.error(sys.exc_value) 1009 1011 1010 1012 # detector size in [no of pix_x,no of pix_y] … … 1026 1028 offset_x, offset_y) 1027 1029 # distance [cm] from the beam center on detector plane 1028 detector_ind_x = n p.arange(detector_pix_nums_x)1029 detector_ind_y = n p.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) 1030 1032 1031 1033 # shif 0.5 pixel so that pix position is at the center of the pixel … … 1041 1043 detector_ind_y = detector_ind_y * pix_y_size 1042 1044 1043 qx_value = n p.zeros(len(detector_ind_x))1044 qy_value = n p.zeros(len(detector_ind_y))1045 qx_value = numpy.zeros(len(detector_ind_x)) 1046 qy_value = numpy.zeros(len(detector_ind_y)) 1045 1047 i = 0 1046 1048 … … 1061 1063 1062 1064 # p min and max values among the center of pixels 1063 self.qx_min = n p.min(qx_value)1064 self.qx_max = n p.max(qx_value)1065 self.qy_min = n p.min(qy_value)1066 self.qy_max = n p.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) 1067 1069 1068 1070 # Appr. min and max values of the detector display limits … … 1088 1090 from sas.sascalc.dataloader.data_info import Data2D 1089 1091 output = Data2D() 1090 inten = n p.zeros_like(qx_value)1092 inten = numpy.zeros_like(qx_value) 1091 1093 output.data = inten 1092 1094 output.qx_data = qx_value 1093 1095 output.qy_data = qy_value 1094 1096 except: 1095 logg ing.error(sys.exc_value)1097 logger.error(sys.exc_value) 1096 1098 1097 1099 return output … … 1107 1109 plane_dist = dx_size 1108 1110 # full scattering angle on the x-axis 1109 theta = n p.arctan(plane_dist / det_dist)1110 qx_value = (2.0 * pi / wavelength) * n p.sin(theta)1111 theta = numpy.arctan(plane_dist / det_dist) 1112 qx_value = (2.0 * pi / wavelength) * numpy.sin(theta) 1111 1113 return qx_value 1112 1114
Note: See TracChangeset
for help on using the changeset viewer.