Changeset 9a5097c in sasview for src/sas/sascalc/calculator/resolution_calculator.py
- Timestamp:
- Mar 26, 2017 9:33:16 PM (7 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/resolution_calculator.py
rb699768 r9a5097c 12 12 from math import sqrt 13 13 import math 14 import numpy 14 import numpy as np 15 15 import sys 16 16 import logging … … 393 393 dx_size = (self.qx_max - self.qx_min) / (1000 - 1) 394 394 dy_size = (self.qy_max - self.qy_min) / (1000 - 1) 395 x_val = n umpy.arange(self.qx_min, self.qx_max, dx_size)396 y_val = n umpy.arange(self.qy_max, self.qy_min, -dy_size)397 q_1, q_2 = n umpy.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) 398 398 #q_phi = numpy.arctan(q_1,q_2) 399 399 # check whether polar or cartesian … … 887 887 x_value = x_val - x0_val 888 888 y_value = y_val - y0_val 889 phi_i = n umpy.arctan2(y_val, x_val)889 phi_i = np.arctan2(y_val, x_val) 890 890 891 891 # phi correction due to the gravity shift (in phi) … … 893 893 phi_i = phi_i - phi_0 + self.gravity_phi 894 894 895 sin_phi = n umpy.sin(self.gravity_phi)896 cos_phi = n umpy.cos(self.gravity_phi)895 sin_phi = np.sin(self.gravity_phi) 896 cos_phi = np.cos(self.gravity_phi) 897 897 898 898 x_p = x_value * cos_phi + y_value * sin_phi … … 908 908 nu_value = -0.5 * (new_x * new_x + new_y * new_y) 909 909 910 gaussian = n umpy.exp(nu_value)910 gaussian = np.exp(nu_value) 911 911 # normalizing factor correction 912 912 gaussian /= gaussian.sum() … … 954 954 nu_value *= nu_value 955 955 nu_value *= -0.5 956 gaussian *= n umpy.exp(nu_value)956 gaussian *= np.exp(nu_value) 957 957 gaussian /= sigma 958 958 # normalize … … 1026 1026 offset_x, offset_y) 1027 1027 # distance [cm] from the beam center on detector plane 1028 detector_ind_x = n umpy.arange(detector_pix_nums_x)1029 detector_ind_y = n umpy.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) 1030 1030 1031 1031 # shif 0.5 pixel so that pix position is at the center of the pixel … … 1041 1041 detector_ind_y = detector_ind_y * pix_y_size 1042 1042 1043 qx_value = n umpy.zeros(len(detector_ind_x))1044 qy_value = n umpy.zeros(len(detector_ind_y))1043 qx_value = np.zeros(len(detector_ind_x)) 1044 qy_value = np.zeros(len(detector_ind_y)) 1045 1045 i = 0 1046 1046 … … 1061 1061 1062 1062 # p min and max values among the center of pixels 1063 self.qx_min = n umpy.min(qx_value)1064 self.qx_max = n umpy.max(qx_value)1065 self.qy_min = n umpy.min(qy_value)1066 self.qy_max = n umpy.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) 1067 1067 1068 1068 # Appr. min and max values of the detector display limits … … 1088 1088 from sas.sascalc.dataloader.data_info import Data2D 1089 1089 output = Data2D() 1090 inten = n umpy.zeros_like(qx_value)1090 inten = np.zeros_like(qx_value) 1091 1091 output.data = inten 1092 1092 output.qx_data = qx_value … … 1107 1107 plane_dist = dx_size 1108 1108 # full scattering angle on the x-axis 1109 theta = n umpy.arctan(plane_dist / det_dist)1110 qx_value = (2.0 * pi / wavelength) * n umpy.sin(theta)1109 theta = np.arctan(plane_dist / det_dist) 1110 qx_value = (2.0 * pi / wavelength) * np.sin(theta) 1111 1111 return qx_value 1112 1112
Note: See TracChangeset
for help on using the changeset viewer.