Changeset 0b127025 in sasview for sanscalculator/src/sans/calculator
- Timestamp:
- Aug 16, 2011 6:50:56 PM (13 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- aaeae3a0
- Parents:
- d66196a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sanscalculator/src/sans/calculator/resolution_calculator.py
rbcfc969 r0b127025 39 39 # resolutions 40 40 # lamda in r-direction 41 self.sigma_lamd a= 041 self.sigma_lamd = 0 42 42 # x-dir (no lamda) 43 43 self.sigma_1 = 0 … … 61 61 self.qymin_limit = 0 62 62 self.qymax_limit = 0 63 # set sigmas 64 self.sigma_1 = 0 65 self.sigma_lamd = 0 66 self.sigma_2 = 0 67 self.sigma_1d = 0 63 68 64 # plots 69 65 self.plot = None … … 114 110 intens = self.setup_tof(lam, dlam) 115 111 intens_list.append(intens) 116 # save q min max117 #qx_min = 0118 #qx_max = 0119 #qy_min = 0120 #qy_max = 0112 # cehck if tof 113 if num_lamda > 1: 114 tof = True 115 else: 116 tof = False 121 117 # compute 2d resolution 122 118 _, _, sigma_1, sigma_2, sigma_r, sigma1d = \ 123 self.compute(lam, dlam, qx_value, qy_value, coord)119 self.compute(lam, dlam, qx_value, qy_value, coord, tof) 124 120 # make image 125 121 image = self.get_image(qx_value, qy_value, sigma_1, sigma_2, … … 222 218 223 219 def compute(self, wavelength, wavelength_spread, qx_value, qy_value, 224 coord = 'cartesian' ):220 coord = 'cartesian', tof=False): 225 221 """ 226 222 Compute the Q resoltuion in || and + direction of 2D … … 231 227 lamb = wavelength 232 228 lamb_spread = wavelength_spread 233 229 # the shape of wavelength distribution 230 if tof: 231 # rectangular 232 tof_factor = 2 233 else: 234 # triangular 235 tof_factor = 1 234 236 # Find polar values 235 237 qr_value, phi = self._get_polar_value(qx_value, qy_value) … … 288 290 phi, 'radial', 'on') 289 291 # for 1d 290 variance_1d_1 = sigma_1/2 + sigma_wave_1 292 variance_1d_1 = sigma_1/2 + sigma_wave_1 / tof_factor 291 293 # normalize 292 294 variance_1d_1 = knot * knot * variance_1d_1 / 12 … … 296 298 # normalize 297 299 sigma_1 = knot*sqrt(sigma_1 / 12) 298 sigma_r = knot*sqrt(sigma_wave_1 / 12)300 sigma_r = knot*sqrt(sigma_wave_1 / (tof_factor *12)) 299 301 # sigma in the phi/y direction 300 302 # for source apperture … … 317 319 phi, 'phi', 'on') 318 320 # for 1d 319 variance_1d_2 = sigma_2 /2 +sigma_wave_2321 variance_1d_2 = sigma_2 / 2 + sigma_wave_2 / tof_factor 320 322 # normalize 321 323 variance_1d_2 = knot*knot*variance_1d_2 / 12 … … 878 880 phi_i = numpy.arctan2(y_val, x_val) 879 881 882 phi_i = numpy.arctan2(y_val, x_val) 880 883 sin_phi = numpy.sin(phi_i) 881 884 cos_phi = numpy.cos(phi_i) … … 1110 1113 plane_dist = dx_size 1111 1114 # full scattering angle on the x-axis 1112 theta = math.atan(plane_dist / det_dist)1113 qx_value = (2.0 * pi / wavelength) * math.sin(theta)1115 theta = numpy.arctan(plane_dist / det_dist) 1116 qx_value = (2.0 * pi / wavelength) * numpy.sin(theta) 1114 1117 return qx_value 1115 1118 … … 1162 1165 delta_y = 0.5 1163 1166 delta_y *= _GRAVITY 1164 delta_y *= self.sample2detector_distance[0] 1167 sampletodetector = self.sample2detector_distance[0] - \ 1168 self.sample2sample_distance[0] 1169 delta_y *= sampletodetector 1165 1170 delta_y *= (self.source2sample_distance[0] + self.sample2detector_distance[0]) 1166 1171 delta_y /= (velocity * velocity)
Note: See TracChangeset
for help on using the changeset viewer.