Changeset 3080527 in sasview for sansmodels/src/sans/models/BaseComponent.py
- Timestamp:
- Mar 12, 2010 1:08:42 PM (15 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:
- e575db9
- Parents:
- 7e99f5c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/BaseComponent.py
rf9bf661 r3080527 68 68 69 69 70 * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime]. 71 72 For the following matrix of q_values [qx,qy], we will have: 73 +--------+--------+--------+ 74 qy[2] | | | | 75 +--------+--------+--------+ 76 qy[1] | | | | 77 +--------+--------+--------+ 78 qy[0] | | | | 79 +--------+--------+--------+ 80 qx[0] qx[1] qx[2] 81 82 83 The q-values must be stored in numpy arrays. 84 The qxprime and qyprime are 2D arrays. From the two lists of q-values 85 above, numpy arrays must be created the following way: 86 87 qx_prime = numpy.reshape(qx, [1,3]) 88 qy_prime = numpy.reshape(qy, [3,1]) 70 * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime], 71 where 1D arrays, 72 73 qx_prime = [ qx[0], qx[1], qx[2], ....] 74 and 75 qy_prime = [ qy[0], qy[1], qy[2], ....] 89 76 90 77 The method is then called the following way: … … 92 79 evalDistribution([qx_prime, qy_prime]) 93 80 94 @param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 2D ndarrays81 @param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays 95 82 """ 96 83 if qdist.__class__.__name__ == 'list': … … 106 93 107 94 # Create output array 108 iq_array = numpy.zeros([qx.shape[1], qy.shape[0]]) 109 110 for j in range(qy.shape[0]): 111 for i in range(qx.shape[1]): 112 iq_array[j][i] = self.runXY([qx[0][i],qy[j][0]]) 95 iq_array = numpy.zeros((len(qx))) 96 97 for i in range(len(qx)): 98 iq_array[i] = self.runXY([qx[i],qy[i]]) 113 99 return iq_array 114 100
Note: See TracChangeset
for help on using the changeset viewer.