Changeset 1266
- Timestamp:
- Mar 28, 2014 11:03:17 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimgGUI.py
r1222 r1266 418 418 except ValueError: 419 419 pass 420 waveSel.SetValue("% 6.5f" % (data['wavelength'])) #reset in case of error420 waveSel.SetValue("%7.5f" % (data['wavelength'])) #reset in case of error 421 421 422 422 def OnDetDepthRef(event): … … 437 437 wx.ALIGN_CENTER_VERTICAL) 438 438 cent = data['center'] 439 centText = wx.TextCtrl(parent=G2frame.dataDisplay,value=("% 8.3f,%8.3f" % (cent[0],cent[1])),style=wx.TE_READONLY)439 centText = wx.TextCtrl(parent=G2frame.dataDisplay,value=("%7.2f,%7.2f" % (cent[0],cent[1])),style=wx.TE_READONLY) 440 440 centText.SetBackgroundColour(VERY_LIGHT_GREY) 441 441 calibSizer.Add(centText,0,wx.ALIGN_CENTER_VERTICAL) 442 442 calibSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Wavelength'),0, 443 443 wx.ALIGN_CENTER_VERTICAL) 444 waveSel = wx.TextCtrl(parent=G2frame.dataDisplay,value=("% 6.5f" % (data['wavelength'])),444 waveSel = wx.TextCtrl(parent=G2frame.dataDisplay,value=("%7.5f" % (data['wavelength'])), 445 445 style=wx.TE_PROCESS_ENTER) 446 446 waveSel.Bind(wx.EVT_TEXT_ENTER,OnWavelength) … … 449 449 calibSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Distance'),0, 450 450 wx.ALIGN_CENTER_VERTICAL) 451 distSel = wx.TextCtrl(parent=G2frame.dataDisplay,value=("%8. 3f"%(data['distance'])),style=wx.TE_READONLY)451 distSel = wx.TextCtrl(parent=G2frame.dataDisplay,value=("%8.2f"%(data['distance'])),style=wx.TE_READONLY) 452 452 distSel.SetBackgroundColour(VERY_LIGHT_GREY) 453 453 calibSizer.Add(distSel,0,wx.ALIGN_CENTER_VERTICAL) -
trunk/GSASIIplot.py
r1264 r1266 2506 2506 polygon.append([x0,y0]) 2507 2507 G2frame.MaskKey = '' 2508 G2frame.G2plotNB.status.SetFields(['','Polygon closed - RB drag a vertex to change shape'])2508 G2frame.G2plotNB.status.SetFields(['','Polygon closed - RB vertex drag to move, LB vertex drag to insert']) 2509 2509 else: 2510 2510 G2frame.G2plotNB.status.SetFields(['','New polygon point: %.1f,%.1f'%(Xpos,Ypos)]) … … 2516 2516 frame.append([x0,y0]) 2517 2517 G2frame.MaskKey = '' 2518 G2frame.G2plotNB.status.SetFields(['','Frame closed - RB drag a vertex to change shape'])2518 G2frame.G2plotNB.status.SetFields(['','Frame closed - RB vertex drag to move, LB vertex drag to insert']) 2519 2519 else: 2520 2520 G2frame.G2plotNB.status.SetFields(['','New frame point: %.1f,%.1f'%(Xpos,Ypos)]) … … 2607 2607 else: 2608 2608 arcs[aN][1][1] = int(G2img.GetAzm(Xpos,Ypos,Data)) 2609 for poly in G2frame.polyList: #merging points problem here & how can we insert a point?2609 for poly in G2frame.polyList: #merging points problem here? 2610 2610 if Obj == poly[0]: 2611 2611 ind = G2frame.itemPicked.contains(G2frame.mousePicked)[1]['ind'][0] … … 2614 2614 for i,xy in enumerate(polygons[pN]): 2615 2615 if np.allclose(np.array([xy]),oldPos,atol=1.0): 2616 polygons[pN][i] = Xpos,Ypos 2616 if event.button == 1: 2617 polygons[pN][i] = Xpos,Ypos 2618 elif event.button == 3: 2619 polygons[pN].insert(i,[Xpos,Ypos]) 2620 break 2617 2621 if frame: 2618 2622 oldPos = np.array([G2frame.mousePicked.xdata,G2frame.mousePicked.ydata]) 2619 2623 for i,xy in enumerate(frame): 2620 2624 if np.allclose(np.array([xy]),oldPos,atol=1.0): 2621 frame[i] = Xpos,Ypos 2625 if event.button == 1: 2626 frame[i] = Xpos,Ypos 2627 elif event.button == 3: 2628 frame.insert(i,[Xpos,Ypos]) 2629 break 2622 2630 G2imG.UpdateMasks(G2frame,Masks) 2623 2631 # else: #keep for future debugging -
trunk/GSASIIsasd.py
r1263 r1266 311 311 L,T = arg[:2] 312 312 return CylinderVol(R,[L,])-CylinderVol(R-T,[L,]) 313 314 ################################################################################ 315 #### Distribution functions & their cumulative fxns 316 ################################################################################ 317 318 def LogNormalDist(x,pos,scale,shape): 319 ''' Standard LogNormal distribution - numpy friendly on x axis 320 ref: http://www.itl.nist.gov/div898/handbook/index.htm 1.3.6.6.9 321 param float x: independent axis (can be numpy array) 322 param float pos: location of distribution 323 param float scale: width of distribution (m) 324 param float shape: shape - (sigma of log(LogNormal)) 325 returns float: LogNormal distribution 326 ''' 327 return np.exp(-np.log((x-pos)/scale)**2/(2.*shape**2))/(np.sqrt(2.*np.pi)*(x-pos)*shape) 328 329 def GaussDist(x,pos,scale,shape): 330 ''' Standard Normal distribution - numpy friendly on x axis 331 param float x: independent axis (can be numpy array) 332 param float pos: location of distribution 333 param float scale: width of distribution (sigma) 334 param float shape: not used 335 returns float: Normal distribution 336 ''' 337 return (1./scale*np.sqrt(2.*np.pi))*np.exp(-(x-pos)**2/(2.*scale**2)) 338 339 def LSWDist(x,pos,scale,shape): 340 ''' Lifshitz-Slyozov-Wagner Ostwald ripening distribution - numpy friendly on x axis 341 ref: 342 param float x: independent axis (can be numpy array) 343 param float pos: location of distribution 344 param float scale: not used 345 param float shape: not used 346 returns float: LSW distribution 347 ''' 348 redX = x/pos 349 result = (81.*2**(-5/3.))*(redX**2*np.exp(-redX/(1.5-redX)))/((1.5-redX)**(11/3.)*(3.-redX)**(7/3.)) 350 return result/pos 351 352 def SchulzZimmDist(x,pos,scale,shape): 353 ''' Schulz-Zimm macromolecule distribution - numpy friendly on x axis 354 ref: http://goldbook.iupac.org/S05502.html 355 param float x: independent axis (can be numpy array) 356 param float pos: location of distribution 357 param float scale: width of distribution (sigma) 358 param float shape: not used 359 returns float: Schulz-Zimm distribution 360 ''' 361 b = (2.*pos/scale)**2 362 a = b/pos 363 if b<70: #why bother? 364 return (a**(b+1.))*x**b*np.exp(-a*x)/scsp.gamma(b+1.) 365 else: 366 return np.exp((b+1.)*np.log(a)-spsc.gammaln(b+1.)+b*np.log(x)-(a*x)) 367 368 def LogNormalCume(x,pos,scale,shape): 369 ''' Standard LogNormal cumulative distribution - numpy friendly on x axis 370 ref: http://www.itl.nist.gov/div898/handbook/index.htm 1.3.6.6.9 371 param float x: independent axis (can be numpy array) 372 param float pos: location of distribution 373 param float scale: width of distribution (sigma) 374 param float shape: shape parameter 375 returns float: LogNormal cumulative distribution 376 ''' 377 return scsp.erf(np.log((x-pos)/shape)/(np.sqrt(2.)*scale)+1.)/2. 378 379 def GaussCume(x,pos,scale,shape): 380 ''' Standard Normal cumulative distribution - numpy friendly on x axis 381 param float x: independent axis (can be numpy array) 382 param float pos: location of distribution 383 param float scale: width of distribution (sigma) 384 param float shape: not used 385 returns float: Normal cumulative distribution 386 ''' 387 return scsp.erf((x-pos)/(np.sqrt(2.)*scale)+1.)/2. 388 389 def LSWCume(x,pos,scale,shape): 390 ''' Lifshitz-Slyozov-Wagner Ostwald ripening cumulative distribution - numpy friendly on x axis 391 param float x: independent axis (can be numpy array) 392 param float pos: location of distribution 393 param float scale: not used 394 param float shape: not used 395 returns float: LSW cumulative distribution 396 ''' 397 nP = int(np.ceil(x/30+30)) 398 return [] 399 400 def SchulzZimmCume(x,pos,scale,shape): 401 ''' Schulz-Zimm cumulative distribution - numpy friendly on x axis 402 param float x: independent axis (can be numpy array) 403 param float pos: location of distribution 404 param float scale: width of distribution (sigma) 405 param float shape: not used 406 returns float: Normal distribution 407 ''' 408 return [] 409 313 410 314 411 ################################################################################ … … 804 901 def ModelFit(Profile,ProfDict,Limits,Substances,Sample,data): 805 902 print 'do model fit' 903 904 def ModelFxn(Q,G,parmDict,SQfxn,args=[]): 905 return SQfxn(Q,args) 806 906 807 907
Note: See TracChangeset
for help on using the changeset viewer.