Changeset 9c0f3c17 in sasview for src/sas/sascalc/calculator/resolution_calculator.py
- Timestamp:
- Apr 4, 2017 12:50:04 PM (8 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:
- f2940c4
- Parents:
- 463e7ffc (diff), 1779e72 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/resolution_calculator.py
r463e7ffc r9c0f3c17 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 … … 395 395 dx_size = (self.qx_max - self.qx_min) / (1000 - 1) 396 396 dy_size = (self.qy_max - self.qy_min) / (1000 - 1) 397 x_val = n umpy.arange(self.qx_min, self.qx_max, dx_size)398 y_val = n umpy.arange(self.qy_max, self.qy_min, -dy_size)399 q_1, q_2 = n umpy.meshgrid(x_val, y_val)397 x_val = np.arange(self.qx_min, self.qx_max, dx_size) 398 y_val = np.arange(self.qy_max, self.qy_min, -dy_size) 399 q_1, q_2 = np.meshgrid(x_val, y_val) 400 400 #q_phi = numpy.arctan(q_1,q_2) 401 401 # check whether polar or cartesian … … 889 889 x_value = x_val - x0_val 890 890 y_value = y_val - y0_val 891 phi_i = n umpy.arctan2(y_val, x_val)891 phi_i = np.arctan2(y_val, x_val) 892 892 893 893 # phi correction due to the gravity shift (in phi) … … 895 895 phi_i = phi_i - phi_0 + self.gravity_phi 896 896 897 sin_phi = n umpy.sin(self.gravity_phi)898 cos_phi = n umpy.cos(self.gravity_phi)897 sin_phi = np.sin(self.gravity_phi) 898 cos_phi = np.cos(self.gravity_phi) 899 899 900 900 x_p = x_value * cos_phi + y_value * sin_phi … … 910 910 nu_value = -0.5 * (new_x * new_x + new_y * new_y) 911 911 912 gaussian = n umpy.exp(nu_value)912 gaussian = np.exp(nu_value) 913 913 # normalizing factor correction 914 914 gaussian /= gaussian.sum() … … 956 956 nu_value *= nu_value 957 957 nu_value *= -0.5 958 gaussian *= n umpy.exp(nu_value)958 gaussian *= np.exp(nu_value) 959 959 gaussian /= sigma 960 960 # normalize … … 1028 1028 offset_x, offset_y) 1029 1029 # distance [cm] from the beam center on detector plane 1030 detector_ind_x = n umpy.arange(detector_pix_nums_x)1031 detector_ind_y = n umpy.arange(detector_pix_nums_y)1030 detector_ind_x = np.arange(detector_pix_nums_x) 1031 detector_ind_y = np.arange(detector_pix_nums_y) 1032 1032 1033 1033 # shif 0.5 pixel so that pix position is at the center of the pixel … … 1043 1043 detector_ind_y = detector_ind_y * pix_y_size 1044 1044 1045 qx_value = n umpy.zeros(len(detector_ind_x))1046 qy_value = n umpy.zeros(len(detector_ind_y))1045 qx_value = np.zeros(len(detector_ind_x)) 1046 qy_value = np.zeros(len(detector_ind_y)) 1047 1047 i = 0 1048 1048 … … 1063 1063 1064 1064 # p min and max values among the center of pixels 1065 self.qx_min = n umpy.min(qx_value)1066 self.qx_max = n umpy.max(qx_value)1067 self.qy_min = n umpy.min(qy_value)1068 self.qy_max = n umpy.max(qy_value)1065 self.qx_min = np.min(qx_value) 1066 self.qx_max = np.max(qx_value) 1067 self.qy_min = np.min(qy_value) 1068 self.qy_max = np.max(qy_value) 1069 1069 1070 1070 # Appr. min and max values of the detector display limits … … 1090 1090 from sas.sascalc.dataloader.data_info import Data2D 1091 1091 output = Data2D() 1092 inten = n umpy.zeros_like(qx_value)1092 inten = np.zeros_like(qx_value) 1093 1093 output.data = inten 1094 1094 output.qx_data = qx_value … … 1109 1109 plane_dist = dx_size 1110 1110 # full scattering angle on the x-axis 1111 theta = n umpy.arctan(plane_dist / det_dist)1112 qx_value = (2.0 * pi / wavelength) * n umpy.sin(theta)1111 theta = np.arctan(plane_dist / det_dist) 1112 qx_value = (2.0 * pi / wavelength) * np.sin(theta) 1113 1113 return qx_value 1114 1114
Note: See TracChangeset
for help on using the changeset viewer.