Changeset 844 for sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha
- Timestamp:
- Mar 6, 2012 5:40:08 PM (11 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Fit_MixedDumbbell.ipf
r843 r844 176 176 End 177 177 178 179 180 // 178 181 //Function MixTest() 179 182 // … … 182 185 // NVAR FFT_N = root:FFT_N 183 186 // NVAR FFT_SolventSLD = root:FFT_SolventSLD 187 // NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 184 188 // 185 189 // Variable rho1,rho2,rhos,radius1,radius2,ctr,separation,fill1,fill2 … … 193 197 // separation = radius1 + radius2 194 198 // 195 // FFT_SolventSLD = trunc(rhos *1e6) //spits back an integer, maybe not correct199 // FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct 196 200 // 197 201 //// generate the matrix and erase it … … 205 209 //// with the input parameters, build the structure 206 210 // ctr = trunc(FFT_N/2) 207 // fill1 = trunc(rho1 *1e6)208 // fill2 = trunc(rho2 *1e6)211 // fill1 = trunc(rho1/FFT_delRho) 212 // fill2 = trunc(rho2/FFT_delRho) 209 213 // 210 214 // FillSphereRadius(m,FFT_T,radius1,ctr,ctr,ctr,fill1) … … 212 216 // 213 217 //End 218 // 214 219 // 215 220 //Function CoreShellTest() … … 219 224 // NVAR FFT_N = root:FFT_N 220 225 // NVAR FFT_SolventSLD = root:FFT_SolventSLD 226 // NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 221 227 // 222 228 // Variable rho1,rho2,rhos,radius1,radius2,ctr,separation,fill1,fill2 … … 233 239 // ctr=50 234 240 // 235 // FFT_SolventSLD = trunc(rhos *1e6) //spits back an integer, maybe not correct241 // FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct 236 242 // 237 243 //// generate the matrix and erase it … … 245 251 //// with the input parameters, build the structure 246 252 // ctr = trunc(FFT_N/2) 247 // fill1 = trunc(rho1 *1e6)248 // fill2 = trunc(rho2 *1e6)253 // fill1 = trunc(rho1/FFT_delRho) 254 // fill2 = trunc(rho2/FFT_delRho) 249 255 // 250 256 // FillSphereRadius(m,FFT_T,radius2,ctr,ctr,ctr,fill2) … … 259 265 // NVAR FFT_N = root:FFT_N 260 266 // NVAR FFT_SolventSLD = root:FFT_SolventSLD 267 // NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 261 268 // 262 269 // Variable rcore,rhocore,thick1,rhoshel1,thick2,rhoshel2,thick3,rhoshel3,rhos,fill1,fill2,fill3,fillc,ctr … … 277 284 //// rhos += 3e-6 278 285 // 279 // FFT_SolventSLD = trunc(rhos *1e6) //spits back an integer, maybe not correct286 // FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct 280 287 // 281 288 //// generate the matrix and erase it … … 289 296 //// with the input parameters, build the structure 290 297 // ctr = trunc(FFT_N/2) 291 // fillc = trunc(rhocore *1e6)292 // fill1 = trunc(rhoshel1 *1e6)293 // fill2 = trunc(rhoshel2 *1e6)294 // fill3 = trunc(rhoshel3 *1e6)298 // fillc = trunc(rhocore/FFT_delRho) 299 // fill1 = trunc(rhoshel1/FFT_delRho) 300 // fill2 = trunc(rhoshel2/FFT_delRho) 301 // fill3 = trunc(rhoshel3/FFT_delRho) 295 302 // 296 303 // FillSphereRadius(m,FFT_T,rcore+thick1+thick2+thick3,ctr,ctr,ctr,fill3) //outer size (shell 3) -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf
r840 r844 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 2 3 // 3 4 // utility functions and procedures for displaying information 4 5 // setting the matrix, and doing the calculations … … 6 7 7 8 8 9 /////////// 10 // 11 // put the SLD multiplier on the panel somewhere - only 2 values are allowed - so use 12 // radio buttons, or just display the value of the global, make the change at the command 13 // line -- or keep the multiplier at 10^-7 and always use 2 digits (10^-7 is probably 14 // better to use, just to allow more flexibility from the start). 15 9 // 16 10 // TO DO: 17 // -- I need to change a lot of routines (most notably Gizmo) to take "10" as the default SLD11 // x- I need to change a lot of routines (most notably Gizmo) to take "10" as the default SLD 18 12 // rather than "1" 19 13 // … … 37 31 //// if it all goes blank after the log transform get rid of the INF 38 32 //dmatView = numtype(dmatView)== 0 ? dmatView : 0 33 // 39 34 //************* 40 35 … … 69 64 End 70 65 66 71 67 Proc FFT_Panel() 72 68 PauseUpdate; Silent 1 // building window... … … 91 87 Button FFTButton_4,pos={180,264},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot FFT Results" 92 88 Button FFTButton_5,pos={13,218},size={120,20},proc=FFTDrawZCylinderButtonProc,title="Draw Cylinder" 93 Button FFTButton_6,pos={134,79},size={90,20},proc=FFTEraseMatrixButtonProc,title="Erase Matrix" 89 // Button FFTButton_6,pos={134,79},size={90,20},proc=FFTEraseMatrixButtonProc,title="Erase Matrix" 90 Button FFTButton_6a,pos={160,79},size={60,20},proc=FFTSaveMatrixButtonProc,title="Save" 91 Button FFTButton_6b,pos={240,79},size={60,20},proc=FFTLoadMatrixButtonProc,title="Load" 94 92 Button FFTButton_7,pos={13,329},size={130,20},proc=FFT_BinnedSpheresButtonProc,title="Do Binned Debye" 95 93 Button FFTButton_7a,pos={180,329},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot Binned Results" … … 114 112 Button FFTButton_16,pos={14,460},size={70,20},proc=FFTHelpButton,title="Help" 115 113 EndMacro 114 115 // Save a matrix wave, plus the N, T, and solvent values in the wave note for reloading 116 Function FFTSaveMatrixButtonProc(ba) : ButtonControl 117 STRUCT WMButtonAction &ba 118 119 String win = ba.win 120 121 switch (ba.eventCode) 122 case 2: 123 // click code here 124 String fileStr="" 125 SaveMyMatrix(fileStr) 126 127 break 128 endswitch 129 130 return 0 131 End 132 133 // this will wave as Igor Binary, so be sure to use the ".ibw extension. 134 // - this could possibly be enforced, but that's maybe not necessary at this stage. 135 // 136 Function SaveMyMatrix(fileStr) 137 String fileStr 138 139 WAVE mat=root:mat 140 NVAR FFT_T = root:FFT_T 141 NVAR FFT_N = root:FFT_N 142 NVAR FFT_SolventSLD = root:FFT_SolventSLD 143 String str="" 144 sprintf str,"FFT_T=%g;FFT_N=%d;FFT_SolventSLD=%d;",FFT_T,FFT_N,FFT_SolventSLD 145 Note mat,str 146 Save/C/P=home mat as fileStr //will ask for a file name, save as Igor Binary 147 Note/K mat //kill wave note on exiting since I don't properly update this anywhere else 148 149 return(0) 150 end 151 152 153 // load in a previously saved matrix, and reset FFT_N, FFT_T and solvent 154 // from the wave note when saved 155 Function FFTLoadMatrixButtonProc(ba) : ButtonControl 156 STRUCT WMButtonAction &ba 157 158 String win = ba.win 159 160 switch (ba.eventCode) 161 case 2: 162 // click code here 163 String fileStr="" 164 ReloadMatrix(fileStr) 165 166 break 167 endswitch 168 169 return 0 170 End 171 172 173 Function ReloadMatrix(fileStr) 174 String fileStr 175 176 LoadWave/M/O/W/P=home fileStr //will ask for a file, Igor Binary format is assumed here 177 String str 178 str=note(mat) 179 NVAR FFT_T = root:FFT_T 180 NVAR FFT_N = root:FFT_N 181 NVAR FFT_SolventSLD = root:FFT_SolventSLD 182 183 FFT_T = NumberByKey("FFT_T", str, "=" ,";") 184 FFT_N = NumberByKey("FFT_N", str, "=" ,";") 185 FFT_SolventSLD = NumberByKey("FFT_SolventSLD", str, "=" ,";") 186 187 // if I got bad values, put in default values 188 if(numtype(FFT_T) != 0 ) 189 FFT_T = 5 190 endif 191 if(numtype(FFT_N) != 0 ) 192 FFT_N = DimSize(mat,0) 193 endif 194 if(numtype(FFT_SolventSLD) != 0 ) 195 FFT_SolventSLD = 0 196 endif 197 198 Execute "NumberOfPoints()" 199 200 return(0) 201 end 116 202 117 203 Function FFTHelpButton(ba) : ButtonControl … … 622 708 End 623 709 710 711 712 713 714 624 715 // The matrix is not necessarily 0|1, this reports the number of filled voxels 625 716 // - needed to estimate the time required for the AltiVec_Spheres calculation … … 629 720 Print "Fraction occupied = ",VolumeFraction_Occ(root:mat) 630 721 Print "Overall Cube Edge [A] = ",root:FFT_T * root:FFT_N 722 Print "Found values in matrix = ",ListOfValues(root:mat) 631 723 632 724 End … … 679 771 return(num) 680 772 End 773 774 // 775 // return a list of the different values of the voxels in the matrix 776 // 777 Function/S ListOfValues(m) 778 Wave m 779 780 String list="" 781 Variable done 782 783 Duplicate/O m,mz 784 785 done=0 786 do 787 WaveStats/Q/M=1 mz // NaN and Inf are not reported in V_npnts 788 if(V_max == V_min) 789 list += num2str(V_min) + ";" 790 done = 1 791 else 792 list += num2str(V_max) + ";" 793 MultiThread mz = mz[p][q] == V_max ? V_min : mz[p][q] // replace the max with min 794 endif 795 while(!done) 796 797 // Print "Found values in matrix = ",list 798 KillWaves/Z mz 799 800 return(list) 801 End 802 803 681 804 682 805 // returns estimate in seconds
Note: See TracChangeset
for help on using the changeset viewer.