- Timestamp:
- Nov 2, 2017 4:27:16 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 9d9fcbd
- Parents:
- cf8b630
- git-author:
- Paul Kienzle <pkienzle@…> (11/01/17 18:16:45)
- git-committer:
- Paul Kienzle <pkienzle@…> (11/02/17 16:27:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/jitter.py
rde71632 rff10479 162 162 163 163 PROJECTIONS = [ 164 'equirectangular', 'azimuthal_equidistance', 'sinusoidal', 'guyou', 164 # in order of PROJECTION number; do not change without updating the 165 # constants in kernel_iq.c 166 'equirectangular', 'sinusoidal', 'guyou', 'azimuthal_equidistance', 165 167 ] 166 168 def draw_mesh(ax, view, jitter, radius=1.2, n=11, dist='gaussian', … … 239 241 raise ValueError("expected dist to be gaussian, rectangle or uniform") 240 242 241 if projection == 'equirectangular': 243 if projection == 'equirectangular': #define PROJECTION 1 242 244 def rotate(theta_i, phi_j): 243 245 return Rx(phi_j)*Ry(theta_i) 244 246 def weight(theta_i, phi_j, wi, wj): 245 247 return wi*wj*abs(cos(radians(theta_i))) 246 elif projection == 'azimuthal_equidistance': 248 elif projection == 'sinusoidal': #define PROJECTION 2 249 def rotate(theta_i, phi_j): 250 latitude = theta_i 251 scale = cos(radians(latitude)) 252 longitude = phi_j/scale if abs(phi_j) < abs(scale)*180 else 0 253 #print("(%+7.2f, %+7.2f) => (%+7.2f, %+7.2f)"%(theta_i, phi_j, latitude, longitude)) 254 return Rx(longitude)*Ry(latitude) 255 def weight(theta_i, phi_j, wi, wj): 256 latitude = theta_i 257 scale = cos(radians(latitude)) 258 w = 1 if abs(phi_j) < abs(scale)*180 else 0 259 return w*wi*wj 260 elif projection == 'guyou': #define PROJECTION 3 (eventually?) 261 def rotate(theta_i, phi_j): 262 from guyou import guyou_invert 263 #latitude, longitude = guyou_invert([theta_i], [phi_j]) 264 longitude, latitude = guyou_invert([phi_j], [theta_i]) 265 return Rx(longitude[0])*Ry(latitude[0]) 266 def weight(theta_i, phi_j, wi, wj): 267 return wi*wj 268 elif projection == 'azimuthal_equidistance': # Note: Rz Ry, not Rx Ry 247 269 def rotate(theta_i, phi_j): 248 270 latitude = sqrt(theta_i**2 + phi_j**2) … … 282 304 w = sin(radians(latitude))/latitude if latitude != 0 else 1 283 305 return w*wi*wj if latitude < 180 else 0 284 elif projection == 'sinusoidal':285 def rotate(theta_i, phi_j):286 latitude = theta_i287 scale = cos(radians(latitude))288 longitude = phi_j/scale if abs(phi_j) < abs(scale)*180 else 0289 #print("(%+7.2f, %+7.2f) => (%+7.2f, %+7.2f)"%(theta_i, phi_j, latitude, longitude))290 return Rx(longitude)*Ry(latitude)291 def weight(theta_i, phi_j, wi, wj):292 latitude = theta_i293 scale = cos(radians(latitude))294 w = 1 if abs(phi_j) < abs(scale)*180 else 0295 return w*wi*wj296 306 elif projection == 'azimuthal_equal_area': 297 307 def rotate(theta_i, phi_j): … … 305 315 w = sin(radians(latitude))/latitude if latitude != 0 else 1 306 316 return w*wi*wj if latitude < 180 else 0 307 elif projection == 'guyou':308 def rotate(theta_i, phi_j):309 from guyou import guyou_invert310 #latitude, longitude = guyou_invert([theta_i], [phi_j])311 longitude, latitude = guyou_invert([phi_j], [theta_i])312 return Rx(longitude[0])*Ry(latitude[0])313 def weight(theta_i, phi_j, wi, wj):314 return wi*wj315 317 else: 316 318 raise ValueError("unknown projection %r"%projection) … … 490 492 vmin, vmax = calculator.limits 491 493 else: 492 vmin, vmax = clipped_range(Iqxy, portion=0.95, mode='top') 494 vmax = Iqxy.max() 495 vmin = vmax*10**-7 496 #vmin, vmax = clipped_range(Iqxy, portion=portion, mode='top') 493 497 #print("range",(vmin,vmax)) 494 498 #qx, qy = np.meshgrid(qx, qy) … … 605 609 *model_name* is one of the models available in :func:`select_model`. 606 610 """ 611 # projection number according to 1-order position in list, but 612 # only 1 and 2 are implemented so far. 613 from sasmodels import generate 614 generate.PROJECTION = PROJECTIONS.index(projection) + 1 615 if generate.PROJECTION > 2: 616 print("*** PROJECTION %s not implemented in scattering function ***"%projection) 617 generate.PROJECTION = 2 618 607 619 # set up calculator 608 620 calculator, size = select_calculator(model_name, n=150, size=size)
Note: See TracChangeset
for help on using the changeset viewer.