Changeset 40a87fa in sasmodels for sasmodels/details.py
- Timestamp:
- Aug 8, 2016 11:24:11 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 2472141
- Parents:
- 2d65d51
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/details.py
rbaa79c2 r40a87fa 113 113 @pd_prod.setter 114 114 def pd_prod(self, v): 115 """Total size of the pd mesh""" 115 116 self.buffer[-4] = v 116 117 … … 122 123 @pd_sum.setter 123 124 def pd_sum(self, v): 125 """Total length of all the weight vectors""" 124 126 self.buffer[-3] = v 125 127 … … 131 133 @num_active.setter 132 134 def num_active(self, v): 135 """Number of active polydispersity loops""" 133 136 self.buffer[-2] = v 134 137 … … 140 143 @theta_par.setter 141 144 def theta_par(self, v): 145 """Location of the theta parameter in the parameter vector""" 142 146 self.buffer[-1] = v 143 147 … … 185 189 pd_length = np.array([len(w) 186 190 for w in weights[2:2+model_info.parameters.npars]]) 187 num_active = np.sum(pd_length >1)191 num_active = np.sum(pd_length > 1) 188 192 max_pd = model_info.parameters.max_pd 189 193 if num_active > max_pd: … … 250 254 values, weights = zip(*pairs) 251 255 scalars = [v[0] for v in values] 252 if all(len(w) ==1 for w in weights):256 if all(len(w) == 1 for w in weights): 253 257 call_details = mono_details(kernel.info) 254 258 # Pad value array to a 32 value boundary … … 276 280 mag = values[parameters.nvalues-3*parameters.nmagnetic:parameters.nvalues] 277 281 mag = mag.reshape(-1, 3) 278 M0= mag[:,0]279 if np.any( M0):280 theta, phi = mag[:, 1]*pi/180., mag[:,2]*pi/180.282 scale = mag[:,0] 283 if np.any(scale): 284 theta, phi = mag[:, 1]*pi/180., mag[:, 2]*pi/180. 281 285 cos_theta = cos(theta) 282 mx = M0*cos_theta*cos(phi) 283 my = M0*sin(theta) 284 mz = -M0*cos_theta*sin(phi) 285 mag[:,0], mag[:,1], mag[:,2] = mx, my, mz 286 mag[:, 0] = scale*cos_theta*cos(phi) # mx 287 mag[:, 1] = scale*sin(theta) # my 288 mag[:, 2] = -scale*cos_theta*sin(phi) # mz 286 289 return True 287 290 else:
Note: See TracChangeset
for help on using the changeset viewer.