Changeset 836 for sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha
- Timestamp:
- Feb 17, 2012 12:04:13 PM (11 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_ConcentratedSpheres.ipf
r798 r836 2 2 3 3 4 4 // in this procedure file there are a few testing proceudres that are good 5 // examples of how to script the calcualtions to automatically fill, calculate 6 // and rename output for later inspection. Very useful to survey a series of 7 // conditions or for very lengthy calculations 8 // 9 // there is also a loop to run through all of the calculation methods to 10 // get relatice timing information. 11 // 5 12 6 13 Proc concSphereLoop() … … 127 134 // will try forever to fill a sphere, but there was always that possibility before. 128 135 // 136 // 137 // nSph = number of LARGE spheres to add (not the voxel size) 138 // rad = mean radius of these large spheres 139 // pd = polydispersity (0,1) 140 // nPass = number of repeat averaging passes 141 // tagStr = extension string for the output name = "iBin"+tagStr 129 142 // 130 143 Function TestConcSpheres(nSph,rad,pd,nPass,tagStr) … … 275 288 // for testing of the timing 276 289 // type is 0 | 2 | 3 277 // 290 // 0 = FFT 291 // 2 = binned, single SLD 292 // 3 = Binned, multiple SLD (3 in this example) 278 293 Proc Timing_Method(type) 279 294 Variable type // type of calculation, not used right now -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Cubes_Includes.ipf
r828 r836 30 30 "Davg_to_Np" 31 31 end 32 Submenu "Matrix Moving" 33 "ParseMatrix 3D to XYZ" 34 "Plot XYZ" 35 "Animated Slices" 36 "Show Full Matrix" 37 end 38 Submenu "3D testing" 32 Submenu "3D Examples" 33 "Polydisperse Spheres" 39 34 "Connect Dots 3D" 40 35 "Put Random Cylinders at Points" … … 42 37 "Put X-axis Cylinders Square Grid",PutXAxisCylindersSquare() 43 38 "Put X-axis Cylinders Hexagonal Grid",PutXAxisCylindersHexagonal() 44 "Hexagonal Cylinders" 45 "Conc Sphere Loop" 46 "-" 47 "Overnight" 39 "Core-shell Cylinders Hex Grid",PutXAxisCoreShellCyl_HexGrid() 48 40 end 49 Submenu "2D testing" 50 "Test 2D" 51 "Connect Dots 2D" 52 "Erase 2D" 41 Submenu "Matrix Viewing" 42 // "ParseMatrix 3D to XYZ" 43 // "Plot XYZ" //replaced by Gizmo 44 "Animated Slices" 45 // "Show Full Matrix" 53 46 end 54 "-" 55 "Include FFT Fit Functions" 47 Submenu "Automation Examples" 48 // "Hexagonal Cylinders" 49 // "Conc Sphere Loop" 50 // "-" 51 // "Overnight" 52 end 53 // Submenu "2D testing" 54 // "Test 2D" 55 // "Connect Dots 2D" 56 // "Erase 2D" 57 // end 58 // "-" 59 // "Include FFT Fit Functions" //automatically loaded now... 56 60 End 57 61 … … 62 66 Execute/P "COMPILEPROCEDURES " 63 67 end 68 69 70 ////// examples of different structures, shapes and techniques for generating structures 71 // other examples that could be added are: 72 // -- a tetrahedron w/ 4 different colors (rotation, transformation) 73 // -- core-shell spheres 74 // -- binary (touching) spheres of different SLD (would make a simple fit function too) 75 // -- ? other 76 // -- orientation-dependent structures vs. 2D analytic 77 // -- simple automation examples 78 79 80 Proc PolydisperseSpheres(nSph,rad,pd,nPass,tagStr) 81 Variable nSph=505,rad=20,pd=0.25,nPass=10 82 String tagStr="_Poly" 83 // nSph = number of LARGE spheres to add (not the voxel size) 84 // rad = mean radius of these large spheres 85 // pd = polydispersity (0,1) 86 // nPass = number of repeat averaging passes 87 // tagStr = extension string for the output name = "iBin"+tagStr 88 TestConcSpheres(nSph,rad,pd,nPass,tagStr) 89 Display $("iBin"+tagStr) vs $("qBin"+tagStr) 90 ModifyGraph grid=1,mirror=2,log=1 91 ModifyGraph mode=4,marker=2,msize=2 92 Legend 93 End 94 95 Proc PutXAxisCoreShellCyl_HexGrid(w,rad,len,sep) 96 String w="mat" 97 Variable rad=30,len=300,sep=100 98 Prompt w,"matrix" 99 prompt rad,"radius of cylinders" 100 prompt len,"length of cylinders" 101 prompt sep,"center-to-center separation of cylinders" 102 103 $w=0 104 X_CoreShellCylinderHexGrid($w,rad,len,sep) 105 106 NumberOfPoints() 107 end 108 109 Function X_CoreShellCylinderHexGrid(mat,rad,len,sep) 110 Wave mat 111 variable rad,len //length of cylinders 112 Variable sep // EDGE separation, in same units as cylinder 113 114 115 NVAR grid=root:FFT_T 116 Variable np,spacing 117 np = DimSize(mat,0) // assumes that all dimensions are the same 118 119 // fill a 2D plane with points 120 Make/O/B/N=(np,np) plane 121 plane = 0 122 123 spacing = round(sep/grid) // so it's an integer 124 FillPlaneHexagonal(plane,spacing) 125 126 // put it in the proper plane of the matrix 127 mat[np/2][][] = plane[q][r] // in the YZ plane 128 129 ParseMatrix3D_rho(mat) 130 Wave x3d=x3d 131 Wave y3d=y3d 132 Wave z3d=z3d 133 134 Variable ii=0,num 135 num = numpnts(x3d) 136 137 for(ii=0;ii<num;ii+=1) 138 FillXCylinder(mat,grid,rad,x3d[ii],y3d[ii],z3d[ii],len,1) //cylinder 1 139 endfor 140 141 // makes a crude core-shell cylinder 142 for(ii=0;ii<num;ii+=1) 143 FillXCylinder(mat,grid,rad-20,x3d[ii],y3d[ii],z3d[ii],len,3) //cylinder 1 144 endfor 145 146 return(0) 147 End -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Cylinder_Fills.ipf
r800 r836 5 5 // most is still being worked out and verified in 2D 6 6 // 7 /// search for "crude core-shell cylinder" for an example of how this can be done 8 // -- maybe the same filling, but no mat=0 (ask) 7 9 8 10 … … 11 13 //process of calculating a series of configurations. 12 14 13 14 15 Proc ConnectDots3D(maxNumConn) 16 Variable maxNumConn=1 15 16 Proc ConnectDots3D(w,np,maxNumConn,sobol) 17 String w="mat" 18 Variable np=100,maxNumConn=2,sobol=1 19 Prompt w,"matrix" 20 Prompt np,"number of points" 21 prompt maxNumConn,"number of connections per point" 22 Prompt sobol,"1=Sobol, 0=random" 23 24 $w=0 25 26 if(sobol) 27 SobolFill3DMat($w,np) 28 else 29 RandomFill3DMat($w,np) 30 endif 31 32 ParseMatrix3DToXYZ(w) 17 33 18 34 Variable num=numpnts(x3d) -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Debye_Spheres.ipf
r816 r836 2 2 3 3 4 // all three methods are coded here 5 // - simple Debye 6 // - binned distances (1 SLD) 7 // - binned distances and multiple SLDs 8 // 9 // 4 10 // with the Debye Sphere method -- as of Jan 2011 5 11 // the discretization seems to work now, and is significantly faster than the old double sum 6 12 // 7 // now I need to XOP-it (done)8 9 13 10 14 // routines to calculate I(q) and p(r) from the 3d arrangement of spheres -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_FillMatrixShapes.ipf
r798 r836 5 5 // also contains routines to convert matrix to XYZ values for export to the calculations 6 6 // 7 // to add - more specialized visualization using CreateSlicer7 // random point fills are also here, either random or Sobol 8 8 // 9 9 -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf
r798 r836 84 84 Button FFTButton_2,pos={14,187},size={100,20},proc=FFTDrawSphereButtonProc,title="Draw Sphere" 85 85 Button FFTButton_3,pos={14,265},size={70,20},proc=DoTheFFT_ButtonProc,title="Do FFT" 86 Button FFTButton_4,pos={1 91,264},size={110,20},proc=FFT_PlotResultsButtonProc,title="Plot 1DResults"86 Button FFTButton_4,pos={180,264},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot FFT Results" 87 87 Button FFTButton_5,pos={13,218},size={120,20},proc=FFTDrawZCylinderButtonProc,title="Draw Cylinder" 88 88 Button FFTButton_6,pos={134,79},size={90,20},proc=FFTEraseMatrixButtonProc,title="Erase Matrix" 89 89 Button FFTButton_7,pos={13,329},size={130,20},proc=FFT_BinnedSpheresButtonProc,title="Do Binned Debye" 90 Button FFTButton_7a,pos={180,329},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot Binned Results" 91 90 92 Button FFTButton_8,pos={13,297},size={130,20},proc=FFT_AltiSpheresButtonProc,title="Do Debye Spheres" 93 Button FFTButton_8a,pos={180,297},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot Debye Results" 94 91 95 Button FFTButton_14,pos={13,360},size={130,20},proc=FFT_BinnedSLDButtonProc,title="Do Binned SLD" 96 Button FFTButton_14a,pos={180,360},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot SLD Results" 97 92 98 SetVariable FFTSetVar_4,pos={201,4},size={100,15},title="FFT time(s)" 93 99 SetVariable FFTSetVar_4,limits={0,0,0},value= FFT_estTime,noedit= 1,live= 1,format="%d" 94 Button FFTButton_9,pos={200, 295},size={100,20},proc=FFT_Get2DSlice,title="GetSlice"100 Button FFTButton_9,pos={200,400},size={100,20},proc=FFT_Get2DSlice,title="Get 2D Slice" 95 101 Button FFTButton_10,pos={169,156},size={130,20},proc=FFT_TransposeMat,title="Transpose Matrix" 96 102 Button FFTButton_11,pos={169,189},size={130,20},proc=FFT_RotateMat,title="Rotate Matrix" 97 103 Button FFTButton_12,pos={168,219},size={130,20},proc=FFT_AddRotatedObject,title="Add Rotated Obj" 104 Button FFTButton_12,disable=2 // hide this button 98 105 Button FFTButton_13,pos={14,109},size={120,20},proc=FFTFillSolventMatrixProc,title="Solvent Matrix" 99 SetVariable FFTSetVar_5,pos={155,111},size={1 00,15},title="Solvent SLD"106 SetVariable FFTSetVar_5,pos={155,111},size={150,15},title="Solvent SLD (10^-6)" 100 107 SetVariable FFTSetVar_5,limits={-99,99,1},value= FFT_SolventSLD,live= 1 101 Button FFTButton_15,pos={209,327},size={90,20},proc=Interp2DSliceButton,title="Interp 2D" 108 Button FFTButton_15,pos={209,430},size={90,20},proc=Interp2DSliceButton,title="Interp 2D" 109 Button FFTButton_16,pos={14,460},size={70,20},proc=FFTHelpButton,title="Help" 102 110 EndMacro 111 112 Function FFTHelpButton(ba) : ButtonControl 113 STRUCT WMButtonAction &ba 114 115 String win = ba.win 116 117 switch (ba.eventCode) 118 case 2: 119 // click code here 120 DisplayHelpTopic/Z/K=1 "Real-Space Modeling" 121 if(V_flag !=0) 122 DoAlert 0,"The Real-Space Modeling Help file could not be found" 123 endif 124 break 125 endswitch 126 127 return 0 128 End 129 103 130 104 131 Function Interp2DSliceButton(ba) : ButtonControl … … 424 451 String ctrlName 425 452 453 Variable first=0 426 454 DoWindow/F FFT_IQ 427 455 if(V_flag==0) 428 Execute "FFT_IQ()" 456 first = 1 457 Display /W=(295,44,627,302) 458 DoWindow/C FFT_IQ 429 459 Endif 430 End 431 460 461 // append the desired data, if it's not already there 462 // FFTButton_4 = FFT = iBin 463 // FFTButton_7a = binned = _XOP 464 // FFTButton_8a = Debye = _full 465 // FFTButton_14a = SLD = _SLD 466 strswitch(ctrlName) 467 case "FFTButton_4": 468 if(!isTraceOnGraph("iBin","FFT_IQ") && exists("iBin")==1) //only append if it's not already there 469 AppendToGraph /W=FFT_IQ iBin vs qBin 470 ModifyGraph mode=4,marker=19,msize=2,rgb(iBin)=(65535,0,0) 471 endif 472 break 473 case "FFTButton_7a": 474 if(!isTraceOnGraph("ival_XOP","FFT_IQ") && exists("ival_XOP")==1) //only append if it's not already there 475 AppendToGraph /W=FFT_IQ ival_XOP vs qval_XOP 476 ModifyGraph mode=4,marker=19,msize=2,rgb(ival_XOP)=(1,12815,52428) 477 endif 478 break 479 case "FFTButton_8a": 480 if(!isTraceOnGraph("ival_full","FFT_IQ") && exists("ival_full")==1) //only append if it's not already there 481 AppendToGraph /W=FFT_IQ ival_full vs qval_full 482 ModifyGraph mode=4,marker=19,msize=2,rgb(ival_full)=(0,0,0) 483 endif 484 break 485 case "FFTButton_14a": 486 if(!isTraceOnGraph("ival_SLD","FFT_IQ") && exists("ival_SLD")==1) //only append if it's not already there 487 AppendToGraph /W=FFT_IQ ival_SLD vs qval_SLD 488 ModifyGraph mode=4,marker=19,msize=2,rgb(ival_SLD)=(2,39321,1) 489 endif 490 break 491 endswitch 492 493 if(first) 494 ModifyGraph mode=4 495 ModifyGraph marker=19 496 ModifyGraph msize=2 497 ModifyGraph gaps=0 498 ModifyGraph grid=1 499 ModifyGraph log=1 500 ModifyGraph mirror=2 501 Legend 502 endif 503 504 return(0) 505 End 506 507 Function isTraceOnGraph(traceStr,winStr) 508 String traceStr,winStr 509 510 Variable isOn=0 511 String str 512 str = TraceNameList("winStr",";",1) //only normal traces 513 isOn = stringmatch(str,traceStr) //must be an exact match 514 515 return(isOn) 516 End 432 517 433 518 Function FFTEraseMatrixButtonProc(ctrlName) : ButtonControl … … 466 551 End 467 552 468 469 Proc FFT_IQ() : Graph470 PauseUpdate; Silent 1 // building window...471 Display /W=(295,44,627,302) iBin vs qBin472 DoWindow/C FFT_IQ473 ModifyGraph mode=4474 ModifyGraph marker=19475 ModifyGraph msize=2476 ModifyGraph gaps=0477 ModifyGraph grid=1478 ModifyGraph log=1479 ModifyGraph mirror=2480 Legend/N=text0/J "\\s(iBin) iBin"481 EndMacro482 553 483 554 -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Plane_Fills.ipf
r798 r836 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 2 3 3 // some very, very simple fills for lines and planes. 4 // not of much use right now, but a good example of how to 5 // index and access lines and planes in the 3D space 6 // 4 7 5 8 Function GridOfLines(m) -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_VoxelDisplay.ipf
r798 r836 75 75 End 76 76 77 //// superceded by Gizmo 78 //Proc ShowFullMatrix() 79 // 80 // 81 // CreateSurfer 82 // 83 // //get the maximum dimensions - assumes input matrix "mat" 84 // Variable xm,ym,zm 85 // xm=DimSize(mat,0) 86 // ym=DimSize(mat,1) 87 // zm=DimSize(mat,2) 88 // 89 // ModifySurfer xmin=0,ymin=0,zmin=0 90 // ModifySurfer xmax=xm,ymax=ym,zmax=zm 91 // 92 //End 77 93 78 Proc ShowFullMatrix() 79 80 //get the maximum dimensions - assumes input matrix "mat" 81 Variable xm,ym,zm 82 xm=DimSize(mat,0) 83 ym=DimSize(mat,1) 84 zm=DimSize(mat,2) 85 86 ModifySurfer xmin=0,ymin=0,zmin=0 87 ModifySurfer xmax=xm,ymax=ym,zmax=zm 94 //// superceded by Gizmo 95 ////plots each point in 3D space, does NOT autoscale to the input data 96 //// 97 //Proc PlotXYZ(xStr,yStr,zStr) 98 // String xStr="x3d",yStr="y3d",zStr="z3d" 99 // 100 // //get the maximum dimensions - assumes input matrix "mat" 101 // Variable xm,ym,zm 102 // xm=DimSize(mat,0) 103 // ym=DimSize(mat,1) 104 // zm=DimSize(mat,2) 105 // 106 // CreateSurfer 107 // MoveWindow 4,44,517,382 108 // ModifySurfer FactoryDefaults, Update=0 109 // ModifySurfer/N=Surface0 110 // ModifySurfer srcWave=($xStr,$yStr,$zStr) 111 // ModifySurfer srcType=4,plotType=5 112 // ModifySurfer setControlView=3 113 // ModifySurfer zScale=1, xStep=1, yStep=1 114 // ModifySurfer frame=895, drawFrame=1 115 // ModifySurfer xmin=0,ymin=0,zmin=0 116 // ModifySurfer xmax=xm,ymax=ym,zmax=zm 117 // ModifySurfer drawBox=1 118 // ModifySurfer drawTicks=5 119 // ModifySurfer backRGB={65535,65535,65535} 120 // ModifySurfer palette=Grays 121 // ModifySurfer markerRGB={65535,0,0} 122 // ModifySurfer grids=1 123 // ModifySurfer marker=19, markerSize=2 124 // ModifySurfer scatterDepthCue=1 125 //// ModifySurfer autoscale=1 126 // ModifySurfer Update=1 127 // 128 //End 88 129 89 End90 91 //plots each point in 3D space, does NOT autoscale to the input data92 //93 Proc PlotXYZ(xStr,yStr,zStr)94 String xStr="x3d",yStr="y3d",zStr="z3d"95 96 //get the maximum dimensions - assumes input matrix "mat"97 Variable xm,ym,zm98 xm=DimSize(mat,0)99 ym=DimSize(mat,1)100 zm=DimSize(mat,2)101 102 CreateSurfer103 MoveWindow 4,44,517,382104 ModifySurfer FactoryDefaults, Update=0105 ModifySurfer/N=Surface0106 ModifySurfer srcWave=($xStr,$yStr,$zStr)107 ModifySurfer srcType=4,plotType=5108 ModifySurfer setControlView=3109 ModifySurfer zScale=1, xStep=1, yStep=1110 ModifySurfer frame=895, drawFrame=1111 ModifySurfer xmin=0,ymin=0,zmin=0112 ModifySurfer xmax=xm,ymax=ym,zmax=zm113 ModifySurfer drawBox=1114 ModifySurfer drawTicks=5115 ModifySurfer backRGB={65535,65535,65535}116 ModifySurfer palette=Grays117 ModifySurfer markerRGB={65535,0,0}118 ModifySurfer grids=1119 ModifySurfer marker=19, markerSize=2120 ModifySurfer scatterDepthCue=1121 // ModifySurfer autoscale=1122 ModifySurfer Update=1123 124 End125
Note: See TracChangeset
for help on using the changeset viewer.