Changeset 935
- Timestamp:
- May 8, 2020 9:33:18 AM (2 years ago)
- Location:
- trunk/User Procedures/Irena
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/User Procedures/Irena/IR1_Main.ipf
r934 r935 203 203 SubMenu "3D Models" 204 204 "Mass Fractal Aggregate", IR3A_MassFractalAggregate() 205 "Two Phase Solids", IR3T_TwoPhaseSystem()205 //"Two Phase Solids", IR3T_TwoPhaseSystem() 206 206 "Display 3D data", IR3A_Display3DData() 207 207 "Import POV or PDB", IR3P_ImportPOVPDB() … … 3241 3241 ListOfWindows += "IR3D_DataMergePanel;IRB1_PDDFInterfacePanel;IR3J_SimpleFitsPanel;IRB1_DataManipulationPanel;IR3J_LinDataDisplay;" 3242 3242 ListOfWindows += "IR3L_MultiSamplePlotPanel;IR3J_LogLogDataDisplay;IR3L_MultiSamplePlotPanel;IRB1_ImportBioSAXSASCIIData;" 3243 ListOfWindows += "IR2E_MultipleDataSelectionPnl;IR3W_WAXSPanel;" 3243 3244 3244 3245 -
trunk/User Procedures/Irena/IR2_DataMiner.ipf
r932 r935 354 354 break 355 355 endswitch 356 DoWIndow/F IR3 L_MultiSamplePlotPanel356 DoWIndow/F IR3B_MetadataBrowserPanel 357 357 return 0 358 358 End -
trunk/User Procedures/Irena/IR3_3DModels.ipf
r934 r935 764 764 //pick the parameters... 765 765 variable voxelSize = PrimarySize/10 766 variable IsoValue = 0. 5766 variable IsoValue = 0.1 767 767 variable Qmin = 0.5 * pi/AggSize 768 768 variable Qmax = 6 * pi/PrimarySize … … 770 770 variable PrimarySphereRadius = 6 //this is RADIUS of sphere in voxels, not in angstroms. 771 771 //Internally, each particle volume is made 10xx10x10, 8 seems to be value when the spheres are exactly touching in xy direction, 9 when in xyz direction. 772 Wave/Z ThreeDVoxelGram = Wave3DwithPrimary //this is voxelgram772 Wave/Z ThreeDVoxelGram = Wave3DwithPrimaryShrunk //this is voxelgram shrunk to min size 773 773 if(!WaveExists(ThreeDVoxelGram) || isInWorkFolder || recalculate3D) 774 774 //convert to voxelgram 775 775 IR3T_ConvertToVoxelGram(MassFractalAggregate, PrimarySphereRadius) 776 Wave ThreeDVoxelGram = Wave3DwithPrimary //thsi is voxelgram776 Wave ThreeDVoxelGram = Wave3DwithPrimaryShrunk //this is voxelgram shrunk to min size... 777 777 endif 778 778 … … 787 787 Wave PDFIntensityWv 788 788 IR3A_Append1DInMassFracAgg(PDFIntensityWv,PDFQWv) 789 790 Wave/Z ThreeDVoxelGram = Wave3DwithPrimary //this is voxelgram with even number of rows/columns/layers. 791 SetScale /P x, 0, VoxelSize, "A" ,ThreeDVoxelGram 792 SetScale /P y, 0, VoxelSize, "A" ,ThreeDVoxelGram 793 SetScale /P z, 0, VoxelSize, "A" ,ThreeDVoxelGram 794 IR3T_CalcAutoCorelIntensity(ThreeDVoxelGram, IsoValue, Qmin, Qmax, NumQSteps) 795 //these are autocorrelation calculated intensities... 796 Wave AutoCorIntensityWv 797 Wave AutoCorQWv 798 IR3A_Append1DInMassFracAgg(AutoCorIntensityWv,AutoCorQWv) 799 789 800 //display the intensity. 790 801 // DoWIndow IR1_LogLogPlotU -
trunk/User Procedures/Irena/IR3_3DSupportFunctions.ipf
r934 r935 284 284 KillWaves/Z RadialWaveProfile 285 285 //RadialWaveProfile[0] = 1 and at infinity is = VolumeFraction. 286 286 287 //scaling to match volume fraction needed, 287 TwoPntCorrelationsWv = VOlumeFraction * TwoPntCorrelationsWv - VOlumeFraction^2 288 TwoPntCorrelationsWv = VOlumeFraction * (TwoPntCorrelationsWv - VOlumeFraction^2) 289 290 Duplicate/O TwoPntDebyePhCorrFnct, ModelFFTAutoCorelGr 291 288 292 289 293 FindLevel/EDGE=2/Q/P TwoPntCorrelationsWv, 0 … … 377 381 //MatrixOp/Free/NTHR=0 My1DDistanceWv = My3DDistacneWv //this convert 3D wave in 1D wave. 378 382 //Sort My1DDistanceWv, My1DDistanceWv, My1DValuesWave 379 make/Free/N=( maxDist) HistogramWvIndx, HistogramWv383 make/Free/N=(10*maxDist) HistogramWvIndx, HistogramWv 380 384 Histogram /B={0,1,maxDist}/W=My3DWaveIn/Dest=HistogramWv My3DDistacneWv 381 385 //Wave W_SqrtN //this does not work with /W flag … … 565 569 IN2G_ConvertTologspacing(PDFQWv,0) //creates log-q spacing in the PDFQWv 566 570 multithread PDFIntensityWv = IR3T_CalcIntensityPDF(PDFQWv[p],PDFWave,RadiiWave) 567 KillWaves/Z PDFWave,RadiiWave 571 //KillWaves/Z PDFWave,RadiiWave 572 Duplicate/O PDFWave, PDFGrCalculatedWave 573 PDFGrCalculatedWave = PDFWave / RadiiWave^2 568 574 end 569 575 //****************************************************************************************************************************************************** … … 715 721 ImageTransform/F=0 shrinkBox Wave3DwithPrimary 716 722 Wave M_shrunkCube 717 Duplicate/O M_shrunkCube, Wave3DwithPrimary 723 Duplicate/O M_shrunkCube, Wave3DwithPrimaryShrunk 718 724 endif 719 725 print "Done with creating Voxelgram spherical structure in :"+num2str((ticks-startTicks)/60) -
trunk/User Procedures/Irena/IR3_3DTwoPhaseSolid.ipf
r934 r935 95 95 96 96 SetVariable BoxSideSize,limits={100,100000,50},value= root:Packages:TwoPhaseSolidModel:BoxSideSize, proc=IR3T_SetVarProc 97 SetVariable BoxSideSize,pos={10,265},size={200,16},title="Box size [A] ", help={"Physical size of the box for modeling in Angstroms"} 98 99 SetVariable BoxResolution,limits={10,500,50},proc=IR3T_SetVarProc, value= root:Packages:TwoPhaseSolidModel:BoxResolution 100 SetVariable BoxResolution,pos={10,290},size={200,16},title="Box divisions ", help={"How many steps per side to take"} 97 SetVariable BoxSideSize,pos={10,265},size={200,16},title="Box Physical size [A] ", help={"Physical size of the box for modeling in Angstroms"} 98 99 // SetVariable BoxResolution,limits={10,500,50},proc=IR3T_SetVarProc, value= root:Packages:TwoPhaseSolidModel:BoxResolution 100 // SetVariable BoxResolution,pos={10,290},size={200,16},title="Box divisions ", help={"How many steps per side to take"} 101 NVAR BoxResolution=root:Packages:TwoPhaseSolidModel:BoxResolution 102 PopupMenu BoxResolution,pos={20,290},size={180,21},proc=IR3T_PopupControl,title="Box divisions : ", help={"Select how many divisions per side"} 103 PopupMenu BoxResolution,mode=1,value= "64x64x64;128x128x128;256x256x256;512x512x512;" 104 BoxResolution = 64 101 105 102 106 SetVariable VoxelResolution,limits={0,inf,0},value= root:Packages:TwoPhaseSolidModel:VoxelResolution, noedit=1, frame=0 //proc=IR1A_PanelSetVarProc … … 106 110 SetVariable TotalNumberOfVoxels,pos={230,290},size={200,16},title="No of Voxels ",noproc, help={"How many voxels is in box, impacts speed!"} 107 111 108 CheckBox useSAXSMorphCode,pos={100,310},size={250,14},proc=IR3T_InputPanelCheckboxProc,title=" USAXSSAXSMorph code (slower)"112 CheckBox useSAXSMorphCode,pos={100,310},size={250,14},proc=IR3T_InputPanelCheckboxProc,title="use SAXSMorph code (slower)" 109 113 CheckBox useSAXSMorphCode,variable=root:Packages:TwoPhaseSolidModel:useSAXSMorphCode, help={"To use GRF generation using SAXSMorph method"} 110 114 … … 137 141 138 142 //these are advanced parameters. Need to move to Tab 2... 139 CheckBox RKParametersManual,pos={100,3 45},size={200,14},proc=IR3T_InputPanelCheckboxProc,title="Manual R/K parameters?"143 CheckBox RKParametersManual,pos={100,355},size={200,14},proc=IR3T_InputPanelCheckboxProc,title="Manual R/K parameters?" 140 144 CheckBox RKParametersManual,variable= root:packages:TwoPhaseSolidModel:RKParametersManual, help={"Check to select manually R/K parameetrs below. "} 141 145 SetVariable NumberofRPoints,limits={100,10000,50},value= root:Packages:TwoPhaseSolidModel:NumberofRPoints … … 199 203 200 204 //****************************************************************************************************************************************************** 205 206 Function IR3T_PopupControl(PU_Struct): PopupMenuControl 207 STRUCT WMPopupAction &PU_Struct 208 209 if(PU_Struct.eventCode==2) 210 NVAR BoxResolution = root:Packages:TwoPhaseSolidModel:BoxResolution 211 NVAR VoxelResolution = root:Packages:TwoPhaseSolidModel:VoxelResolution 212 NVAR BoxSideSize = root:Packages:TwoPhaseSolidModel:BoxSideSize 213 NVAR Voxels=root:Packages:TwoPhaseSolidModel:TotalNumberOfVoxels 214 //"64x64x64;128x128x128;256x256x256;512x512x512;" 215 BoxResolution=str2num(PU_Struct.popStr) 216 Voxels = BoxResolution^3 217 VoxelResolution = BoxSideSize / BoxResolution 218 endif 219 220 end 221 201 222 //****************************************************************************************************************************************************** 202 223 ///****************************************************************************************** … … 378 399 //This thing does not work - we always get scattering from the box size, not from internal strucutre. So this is probably not realistic to do... 379 400 //IR3T_CreatePDF(TwoPhaseSolidMatrix,VoxelSize, NumStepsToUse, 0.5, oversample, 0.001, 0.5, 200) 380 IR3T_AppendModelIntToGraph()401 //IR3T_AppendModelIntToGraph() 381 402 IR3T_CalculateAchievedValues() 382 403 endif … … 438 459 CheckDisplayed /W=TwoPhaseSystemData AutoCorIntensityWv 439 460 if(V_flag==0) 440 AppendToGraph/W=TwoPhaseSystemData /RAutoCorIntensityWv vs AutoCorQWv461 AppendToGraph/W=TwoPhaseSystemData AutoCorIntensityWv vs AutoCorQWv 441 462 endif 442 463 //ModifyGraph lstyle(PDFIntensityWv)=9,lsize(PDFIntensityWv)=3,rgb(PDFIntensityWv)=(1,16019,65535) … … 873 894 Rmin = 0.1 874 895 //Rmax = IN2G_roundSignificant(35/lowQExtrapolationStart,2) 875 Rmax = IN2G_roundSignificant(10*RgValue,2) 896 variable Rmax1 = IN2G_roundSignificant(10*RgValue,2) 897 variable RadMax2 = ceil(1.1*sqrt(BoxSideSize^2+BoxSideSize^2+BoxSideSize^2)) 898 Rmax = max(RadMax2,Rmax1) 876 899 Kmin =IN2G_roundSignificant(lowQExtrapolationStart/10,1) 877 900 Kmax = IN2G_roundSignificant(highQExtrapolationStart*10, 1) 878 901 Kmax = Kmax>6.28 ? Kmax : 2*pi 902 else 903 //Rmax = ceil(1.3*sqrt(BoxSideSize^2+BoxSideSize^2+BoxSideSize^2)) 879 904 endif 880 905 DoWIndow TwoPhaseSystems … … 1128 1153 NVAR RadMin = root:Packages:TwoPhaseSolidModel:RMin 1129 1154 NVAR RadMax = root:Packages:TwoPhaseSolidModel:RMax 1155 RadMax = ceil(1.1*sqrt(BoxSideSize^2+BoxSideSize^2+BoxSideSize^2)) 1130 1156 1131 1157 make/O/N=(NumberOfKPoints)/D Kvalues … … 1239 1265 multithread SpectralFk = IR3T_Formula4_SpectralFnct(Kvalues[p],AutoCorfnctGr,PhaseAutocorFnctRadii) 1240 1266 // spectral function is ridiculously noisy, lets smooth it. 1241 1242 1267 //display/K=1 SpectralFk vs Kvalues as "SpectralFk" 1243 1244 1268 print "Spectral function calculation time was "+num2str((ticks-startTicks)/60) +" sec" 1245 1269 //******************************************** … … 1248 1272 //Step 5. Compute a nonnegative approximation of SpectralFk by solving the following convex quadratic programming problem: 1249 1273 Duplicate/O SpectralFk, PositiveSpectralFk 1250 1251 1274 //note: this makes HUGE difference and results look lot closer to SAXSMorph and expectations... 1252 1275 variable SMoothBy = ceil(numpnts(PositiveSpectralFk)/60) 1253 1276 Smooth/EVEN/B SMoothBy, PositiveSpectralFk 1254 1277 //this gets some differeces between SAXSMorph and Igor code, but it may be just different rounding and methods. Not sure which one is actually right here anyway. 1255 1256 //display/K=1 PositiveSpectralFk vs Kvalues as "PositiveSpectralFk" 1257 1278 //display/K=1 PositiveSpectralFk vs Kvalues as "PositiveSpectralFk" 1258 1279 ///display/K=1 PositiveAutoCorfnctGr vs Radii as "PositiveAutoCorfnctGr" 1259 1280 startTicks=ticks … … 1265 1286 startTicks=ticks 1266 1287 print "Calculating Matrix" 1267 //this is SAXSMo prh way1288 //this is SAXSMorph way 1268 1289 IR3T_GenerateMatrix(Kvalues, SpectralFk, BoxSideSize, BoxResolution, alfaValue) 1269 1290 else … … 1279 1300 print "Using FFT to generate 2 phase solid, this is not optimized yet" 1280 1301 //here we can take over by use of FFT... 1281 IR3T_UseFFTtoGenerateMatrix(PositiveAutoCorfnctGr,Radii, alfaValue, BoxResolution, BoxSideSize) 1302 Duplicate AutoCorfnctGr, PositiveAutoCorfnctGr 1303 PositiveAutoCorfnctGr = PositiveAutoCorfnctGr[p]>0 ? PositiveAutoCorfnctGr : 0 1304 IR3T_UseFFTtoGenerateMatrix(AutoCorfnctGr,PositiveAutoCorfnctGr, alfaValue, BoxResolution, BoxSideSize) 1305 1306 // IR3T_UseFFTtoGenerateMatrix(PositiveAutoCorfnctGr,Radii, alfaValue, BoxResolution, BoxSideSize) 1282 1307 endif 1283 1308 print "GenerateMatrix time is "+num2str((ticks-startTicks)/60) +" sec" … … 1328 1353 1329 1354 Function IR3T_UseFFTtoGenerateMatrix(Gr,Radii, alfaValue, BoxDivisions, BoxSide ) 1330 wave Gr, radii //this is covariance function (1D)1331 variable alfaValue //this is cut off value1355 wave Gr, radii //this is covariance function (1D) 1356 variable alfaValue //this is cut off value 1332 1357 variable BoxDivisions, BoxSide //Divisions is number of pixels per side, Side is length in A 1333 1358 … … 1365 1390 1366 1391 Make/N=(BoxDivisions,BoxDivisions,BoxDivisions)/O RandomField, CovarFunction3D 1392 multithread RandomField = gnoise(1) 1367 1393 variable HalfBox = BoxSide/2 1368 SetScale x 0,BoxSide,"A", RandomField 1369 SetScale y 0,BoxSide,"A", RandomField 1370 SetScale z 0,BoxSide,"A", RandomField 1371 multithread RandomField = gnoise(1) 1372 SetScale y -1*BoxSide,BoxSide,"A", CovarFunction3D 1373 SetScale x -1*BoxSide,BoxSide,"A", CovarFunction3D 1374 SetScale z -1*BoxSide,BoxSide,"A", CovarFunction3D 1375 //thsi does not fix anything... This is generating too small particles, something is off here. 1376 //Need to increase size of the particles twice, but cannot find way to scaqle them up. 1377 // SetScale y -1*HalfBox,HalfBox,"A", CovarFunction3D 1378 // SetScale x -1*HalfBox,HalfBox,"A", CovarFunction3D 1379 // SetScale z -1*HalfBox,HalfBox,"A", CovarFunction3D 1380 // SetScale x -1*HalfBox,HalfBox,"A", RandomField 1381 // SetScale y -1*HalfBox,HalfBox,"A", RandomField 1382 // SetScale z -1*HalfBox,HalfBox,"A", RandomField 1383 1384 multithread CovarFunction3D = CovarFunction1D(sqrt(x^2+y^2+z^2)) //this causes error at this time. 1394 // SetScale x 0,BoxSide,"A", RandomField 1395 // SetScale y 0,BoxSide,"A", RandomField 1396 // SetScale z 0,BoxSide,"A", RandomField 1397 // SetScale y 0,BoxSide,"A", CovarFunction3D 1398 // SetScale x 0,BoxSide,"A", CovarFunction3D 1399 // SetScale z 0,BoxSide,"A", CovarFunction3D 1400 SetScale x -HalfBox, HalfBox,"A", RandomField, CovarFunction3D 1401 SetScale y -HalfBox, HalfBox,"A", RandomField, CovarFunction3D 1402 SetScale z -HalfBox, HalfBox,"A", RandomField, CovarFunction3D 1403 //this is generating too small particles, something is off here. 1404 // variable BoxCenterX, BoxCenterY, BoxCenterZ 1405 // BoxCenterX = BoxSide/2 1406 // BoxCenterY = BoxSide/2 1407 // BoxCenterZ = BoxSide/2 1408 multithread CovarFunction3D = CovarFunction1D(sqrt((x)^2+(y)^2+(z)^2)) 1385 1409 1386 1410 //Now FFT the two components: 1387 FFT/OUT=1/Free/DEST=RandomField_FFT RandomField // this is random field after FFT, it should be more or less another random Gauss field. 1388 FFT/OUT=1/Free/DEST=CovarFunction3D_FFT CovarFunction3D // this is FFT of covariance function 1389 1390 //cannot make this below work somehow.... 1391 matrixOp/NTHR=0/O CovarFunction3D_FFTpwr = powC(CovarFunction3D_FFT, 1/2) // << even for 3D this needs to be sqrt, so why is it for 1D not sqrt??? 1411 FFT/OUT=1/DEST=RandomField_FFT RandomField // this is random field after FFT, it should be more or less another random Gauss field. 1412 FFT/OUT=1/DEST=CovarFunction3D_FFT CovarFunction3D // this is FFT of covariance function 1413 1414 //cannot make this below work somehow.... this is what causes my GRF to be wrong and narrow... 1415 //matrixOp does not preserve wave scaling, we need to copy scales after MatrixOps here! 1416 //still, this is incorrect. I am unable to get proper GRF generation here. 1417 matrixOp/NTHR=0/O CovarFunction3D_FFTpwr = powC(CovarFunction3D_FFT, 1/2) // << even for 3D this needs to be sqrt, so why is it for 1D not sqrt??? 1392 1418 matrixOp/NTHR=0/O RandomField_FFT_Covar = RandomField_FFT * CovarFunction3D_FFTpwr 1419 //return the wave scaling here so IFFT can work... 1420 CopyScales /P RandomField_FFT, RandomField_FFT_Covar 1393 1421 1394 1422 IFFT/DEST=RandomField_FFT_Covar_IFFT RandomField_FFT_Covar … … 1396 1424 1397 1425 MatrixOp/NTHR=0/O TwoPhaseSolidMatrix = greater(RandomField_FFT_Covar_IFFT,alfaValue) 1426 CopyScales /P RandomField_FFT_Covar_IFFT, TwoPhaseSolidMatrix 1398 1427 1399 1428 KillWaves/Z CovarFunction3D_FFTpwr, RandomField_FFT_Covar, RandomField_FFT_Covar_IFFT 1400 1401 SetScalex 0,BoxSide,"A", TwoPhaseSolidMatrix1402 SetScaley 0,BoxSide,"A", TwoPhaseSolidMatrix1403 SetScalez 0,BoxSide,"A", TwoPhaseSolidMatrix1429 // 1430 // SetScale/I x 0,BoxSide,"A", TwoPhaseSolidMatrix 1431 // SetScale/I y 0,BoxSide,"A", TwoPhaseSolidMatrix 1432 // SetScale/I z 0,BoxSide,"A", TwoPhaseSolidMatrix 1404 1433 1405 1434 print "Done" … … 1423 1452 end 1424 1453 ///************************************************************************************************************************************* 1425 Function IR3T_AppendModelIntToGraph()1426 DoWindow TwoPhaseSystemData1427 if(V_Flag)1428 DoWIndow/F TwoPhaseSystemData1429 Wave/Z PDFQWv = root:Packages:TwoPhaseSolidModel:PDFQWv1430 Wave/Z PDFIntensityWv = root:Packages:TwoPhaseSolidModel:PDFIntensityWv1431 Wave ExtrapolatedIntensity = root:Packages:TwoPhaseSolidModel:ExtrapolatedIntensity1432 Wave ExtrapolatedQvector = root:Packages:TwoPhaseSolidModel:ExtrapolatedQvector1433 Wave OriginalQvector = root:Packages:TwoPhaseSolidModel:OriginalQvector1434 Wave OriginalIntensity = root:Packages:TwoPhaseSolidModel:OriginalIntensity1435 Wave/Z TheoreticalIntensityDACF = root:Packages:TwoPhaseSolidModel:TheoreticalIntensityDACF1436 Wave/Z QvecTheorIntensityDACF=root:Packages:TwoPhaseSolidModel:QvecTheorIntensityDACF1437 NVAR Qmin = root:Packages:TwoPhaseSolidModel:LowQExtrapolationStart1438 NVAR Qmax = root:Packages:TwoPhaseSolidModel:HighQExtrapolationEnd1439 variable InvarModel1440 variable InvarData1441 // if(WaveExists(PDFQWv))1442 // //need to renormalzie this together...1443 // InvarModel=areaXY(PDFQWv, PDFIntensityWv )1444 // InvarData=areaXY(ExtrapolatedQvector, ExtrapolatedIntensity )1445 // PDFIntensityWv*=InvarData/InvarModel1446 // CheckDisplayed /W=TwoPhaseSystemData PDFIntensityWv1447 // if(V_flag==0)1448 // AppendToGraph/W=TwoPhaseSystemData PDFIntensityWv vs PDFQWv1449 // endif1450 // ModifyGraph lstyle(PDFIntensityWv)=9,lsize(PDFIntensityWv)=3,rgb(PDFIntensityWv)=(1,16019,65535)1451 // ModifyGraph mode(PDFIntensityWv)=4,marker(PDFIntensityWv)=191452 // ModifyGraph msize(PDFIntensityWv)=31453 // endif1454 // if(WaveExists(TheoreticalIntensityDACF))1455 // //need to renormalzie this together...1456 // InvarModel=areaXY(QvecTheorIntensityDACF, TheoreticalIntensityDACF, Qmin, QvecTheorIntensityDACF[numpnts(QvecTheorIntensityDACF)-2] )1457 // InvarData=areaXY(OriginalQvector, OriginalIntensity, Qmin, QvecTheorIntensityDACF[numpnts(QvecTheorIntensityDACF)-2] )1458 // TheoreticalIntensityDACF*=InvarData/InvarModel1459 // CheckDisplayed /W=TwoPhaseSystemData TheoreticalIntensityDACF1460 // if(V_flag==0)1461 // AppendToGraph/W=TwoPhaseSystemData TheoreticalIntensityDACF vs QvecTheorIntensityDACF1462 // endif1463 // ModifyGraph lstyle(TheoreticalIntensityDACF)=9,lsize(TheoreticalIntensityDACF)=3,rgb(TheoreticalIntensityDACF)=(1,16019,65535)1464 // ModifyGraph mode(TheoreticalIntensityDACF)=4,marker(TheoreticalIntensityDACF)=191465 // ModifyGraph msize(TheoreticalIntensityDACF)=31466 // endif1467 endif1468 1469 end1454 //Function IR3T_AppendModelIntToGraph() 1455 // DoWindow TwoPhaseSystemData 1456 // if(V_Flag) 1457 // DoWIndow/F TwoPhaseSystemData 1458 // Wave/Z PDFQWv = root:Packages:TwoPhaseSolidModel:PDFQWv 1459 // Wave/Z PDFIntensityWv = root:Packages:TwoPhaseSolidModel:PDFIntensityWv 1460 // Wave ExtrapolatedIntensity = root:Packages:TwoPhaseSolidModel:ExtrapolatedIntensity 1461 // Wave ExtrapolatedQvector = root:Packages:TwoPhaseSolidModel:ExtrapolatedQvector 1462 // Wave OriginalQvector = root:Packages:TwoPhaseSolidModel:OriginalQvector 1463 // Wave OriginalIntensity = root:Packages:TwoPhaseSolidModel:OriginalIntensity 1464 // Wave/Z TheoreticalIntensityDACF = root:Packages:TwoPhaseSolidModel:TheoreticalIntensityDACF 1465 // Wave/Z QvecTheorIntensityDACF=root:Packages:TwoPhaseSolidModel:QvecTheorIntensityDACF 1466 // NVAR Qmin = root:Packages:TwoPhaseSolidModel:LowQExtrapolationStart 1467 // NVAR Qmax = root:Packages:TwoPhaseSolidModel:HighQExtrapolationEnd 1468 // variable InvarModel 1469 // variable InvarData 1470 //// if(WaveExists(PDFQWv)) 1471 //// //need to renormalzie this together... 1472 //// InvarModel=areaXY(PDFQWv, PDFIntensityWv ) 1473 //// InvarData=areaXY(ExtrapolatedQvector, ExtrapolatedIntensity ) 1474 //// PDFIntensityWv*=InvarData/InvarModel 1475 //// CheckDisplayed /W=TwoPhaseSystemData PDFIntensityWv 1476 //// if(V_flag==0) 1477 //// AppendToGraph/W=TwoPhaseSystemData PDFIntensityWv vs PDFQWv 1478 //// endif 1479 //// ModifyGraph lstyle(PDFIntensityWv)=9,lsize(PDFIntensityWv)=3,rgb(PDFIntensityWv)=(1,16019,65535) 1480 //// ModifyGraph mode(PDFIntensityWv)=4,marker(PDFIntensityWv)=19 1481 //// ModifyGraph msize(PDFIntensityWv)=3 1482 //// endif 1483 //// if(WaveExists(TheoreticalIntensityDACF)) 1484 //// //need to renormalzie this together... 1485 //// InvarModel=areaXY(QvecTheorIntensityDACF, TheoreticalIntensityDACF, Qmin, QvecTheorIntensityDACF[numpnts(QvecTheorIntensityDACF)-2] ) 1486 //// InvarData=areaXY(OriginalQvector, OriginalIntensity, Qmin, QvecTheorIntensityDACF[numpnts(QvecTheorIntensityDACF)-2] ) 1487 //// TheoreticalIntensityDACF*=InvarData/InvarModel 1488 //// CheckDisplayed /W=TwoPhaseSystemData TheoreticalIntensityDACF 1489 //// if(V_flag==0) 1490 //// AppendToGraph/W=TwoPhaseSystemData TheoreticalIntensityDACF vs QvecTheorIntensityDACF 1491 //// endif 1492 //// ModifyGraph lstyle(TheoreticalIntensityDACF)=9,lsize(TheoreticalIntensityDACF)=3,rgb(TheoreticalIntensityDACF)=(1,16019,65535) 1493 //// ModifyGraph mode(TheoreticalIntensityDACF)=4,marker(TheoreticalIntensityDACF)=19 1494 //// ModifyGraph msize(TheoreticalIntensityDACF)=3 1495 //// endif 1496 // endif 1497 // 1498 //end 1470 1499 1471 1500 ///************************************************************************************************************************************* … … 2052 2081 2053 2082 2054 NewGizmo/K=1/ T="TwoPhaseSolid3D"/W=(627,70,1142,530)2083 NewGizmo/K=1/N=TwoPhaseSolid3D/T="TwoPhaseSolid3D"/W=(627,70,1142,530) 2055 2084 ModifyGizmo startRecMacro=700 2056 2085 ModifyGizmo scalingOption=63 -
trunk/User Procedures/Irena/IR3_MultiDataPlot.ipf
r934 r935 188 188 189 189 SVAR SelectedStyle = root:Packages:Irena:MultiSamplePlot:SelectedStyle 190 PopupMenu ApplyStyle,pos={280,6 80},size={400,20},proc=IR3L_PopMenuProc, title="Apply style:",help={"Set tool setting to defined conditions and apply to graph"}190 PopupMenu ApplyStyle,pos={280,660},size={400,20},proc=IR3L_PopMenuProc, title="Apply style:",help={"Set tool setting to defined conditions and apply to graph"} 191 191 PopupMenu ApplyStyle,value=#"root:Packages:Irena:MultiSamplePlot:ListOfDefinedStyles",popvalue=SelectedStyle 192 192 Button ApplyPresetFormating,pos={260,710},size={160,20}, proc=IR3L_ButtonProc,title="Apply All Formating", help={"Apply Preset Formating to update graph based on these choices"} -
trunk/User Procedures/Irena/IR3_WAXSDiffraction.ipf
r930 r935 126 126 DrawText 10,20,"Background if needed for fitting" 127 127 //fix case when neither is selected and default to qrs 128 root:Packages:Irena:WAXSBackground:DataFolderName =""128 root:Packages:Irena:WAXSBackground:DataFolderName ="" 129 129 //note, this sets up the dependence for same type of data for background and fit data, seems logical. 130 130 root:Packages:Irena:WAXSBackground:UseIndra2Data := root:Packages:Irena:WAXS:UseIndra2Data 131 root:Packages:Irena:WAXSBackground:UseQRSdata := root:Packages:Irena:WAXS:UseQRSdata131 root:Packages:Irena:WAXSBackground:UseQRSdata := root:Packages:Irena:WAXS:UseQRSdata 132 132 // done... 133 133 Checkbox UseIndra2Data, pos={100,5}, disable=1 … … 144 144 //TitleBox FakeLine1 title=" ",fixedSize=1,size={200,3},pos={290,130},frame=0,fColor=(0,0,52224), labelBack=(0,0,52224) 145 145 //Data Tabs definition 146 TabControl AnalysisTabs,pos={265,135},size={280,4 00}146 TabControl AnalysisTabs,pos={265,135},size={280,420} 147 147 TabControl AnalysisTabs,tabLabel(0)="Peak Fit",tabLabel(1)="Diff. Lines" 148 148 TabControl AnalysisTabs proc=IR3W_PDF4TabProc … … 192 192 Button AMSImportAMStxt, pos={375,491}, size={160,20}, title="Import AMS txt card", proc=IR3W_WAXSButtonProc, help={"Add Diffraction lines from http://rruff.geo.arizona.edu/AMS/amcsd.php"} 193 193 Button PDF4AddManually, pos={300,513}, size={200,20}, title="Add manually or Edit PDF card", proc=IR3W_WAXSButtonProc, help={"Add/Edit manually card, e.g. type from JCPDS PDF2 or 4 cards"} 194 195 SetVariable DistanceCorrection,pos={280,535},size={200,15}, proc=IR3W_SetVarProc,title="Distance correction ", help={"This corrects for distance calibration of instrument. Should be close to 1."} 196 Setvariable DistanceCorrection, variable=root:Packages:Irena:WAXS:DistanceCorrection, limits={0.9,1.1,0.0005} 197 194 198 195 199 TitleBox txt1 title="\Zr100Double click to add data to graph.",pos={4,665},frame=0,fstyle=3,size={300,24},fColor=(1,4,52428) … … 251 255 Button PDF4ExportImport, win=IR3W_WAXSPanel, disable=(tab!=1) 252 256 Checkbox PDF4_DisplayHKLTags, win=IR3W_WAXSPanel, disable=(tab!=1) 257 SetVariable DistanceCorrection, win=IR3W_WAXSPanel, disable=(tab!=1) 253 258 break 254 259 case -1: // control being killed … … 339 344 ListOfVariables+="ProcessManually;ProcessSequentially;OverwriteExistingData;AutosaveAfterProcessing;" 340 345 ListOfVariables+="Energy;Wavelength;" 341 ListOfVariables+="PDF4_DisplayHKLTags; "346 ListOfVariables+="PDF4_DisplayHKLTags;DistanceCorrection;" 342 347 343 348 //and here we create them … … 403 408 endif 404 409 Energy = 12.39842 / Wavelength 410 411 NVAR DistanceCorrection 412 DistanceCorrection = 1 405 413 406 414 Make/O/T/N=(0) ListOfAvailableData … … 902 910 Energy = 12.39842 / wavelength 903 911 IR3W_ConvertXdataToTTH(Data2ThetaWave,DataD2ThetaWave,XaxisType,wavelength) 912 endif 913 if(stringmatch(sva.ctrlName,"DistanceCorrection")) 914 IR3W_WAXSCorForDistance() 904 915 endif 905 916 if(stringmatch(sva.ctrlName,"Energy")) … … 2818 2829 Open /R /Z refNum as PathToFile 2819 2830 if(V_Flag!=0) //no success 2820 abort "Could not load file correctly"2831 abort //"Could not load file correctly" 2821 2832 endif 2822 2833 FReadLine refNum, MaterialName … … 2947 2958 string pdfNumber 2948 2959 pdfNumber = IR3W_ReadXMLJCPDSCard(PathToFile) 2960 SVAR chemical_formula = root:Packages:Irena_JCPDSImport:chemical_formula 2961 SVAR empirical_formula = root:Packages:Irena_JCPDSImport:empirical_formula 2962 SVAR chemical_name = root:Packages:Irena_JCPDSImport:chemical_name 2963 2949 2964 string OldCardName, NewCardNumber, NewCardName, NewCardNote, DeleteCardName 2950 2965 DeleteCardName="---" 2951 2966 OldCardName = "---" 2952 2967 NewCardNumber = pdfNumber 2953 NewCardName=StringFromList(0,StringFromList(ItemsInList(PathToFile,":")-1, PathToFile, ":"),".")+" "+pdfNumber 2954 NewCardNote ="" 2968 if(strlen(chemical_name)>1) 2969 NewCardName=chemical_name+" "+pdfNumber 2970 elseif(strlen(chemical_formula)>1) 2971 NewCardName=chemical_formula+" "+pdfNumber 2972 elseif(strlen(empirical_formula)>1) 2973 NewCardName=empirical_formula+" "+pdfNumber 2974 else 2975 NewCardName=StringFromList(0,StringFromList(ItemsInList(PathToFile,":")-1, PathToFile, ":"),".")+" "+pdfNumber 2976 endif 2977 NewCardName = IN2G_CreateUserName(NewCardName,23, 0, 0) 2978 NewCardNote ="JPCDSnumber:"+pdfNumber+";chemical_name:"+chemical_name+";chemical_formula:"+chemical_formula+";empirical_formula:"+empirical_formula+";" 2955 2979 Prompt OldCardName, "Select existing card to overwrite", popup "---;"+IR3W_PDF4CreateListOfCards() 2956 2980 Prompt NewCardName, "Enter new card name, e.g. Corundum" … … 2963 2987 endif 2964 2988 if(stringmatch(OldCardName,"---")) 2965 NewCardFullName= ((NewCardName)[0,23])2989 NewCardFullName=NewCardName 2966 2990 if(CheckName(NewCardFullName,1)!=0) 2967 2991 KillWIndow/Z JCPDS_Input … … 2994 3018 Print "Could not figure out what to do..." 2995 3019 endif 3020 Note /NOCR NewCard, NewCardNote 3021 Note /NOCR NewCard_hkl, NewCardNote 2996 3022 KillDataFOlder/Z root:Packages:Irena_JCPDSImport 2997 3023 Edit/K=1/W=(351,213,873,819) NewCard … … 3067 3093 continueLoop = 1 3068 3094 pdfNumber = XMLstrFmXpath(fileID,"/pdfcard/pdf_data/pdf_number","","") 3095 //and read materials names etc. 3096 string/g chemical_formula, empirical_formula, chemical_name 3097 chemical_formula = XMLstrFmXpath(fileID,"/pdfcard/pdf_data/chemical_formula","","") 3098 empirical_formula = XMLstrFmXpath(fileID,"/pdfcard/pdf_data/empirical_formula","","") 3099 chemical_name = XMLstrFmXpath(fileID,"/pdfcard/pdf_data/chemical_name","","") 3069 3100 DO 3070 3101 i+=1 … … 3165 3196 SelectionOfAvailableData[][][0] = 0x20 3166 3197 SelectionOfAvailableData[][][1] = p 3167 3198 string tempNameStr 3168 3199 For(i=0;i<ItemsInList(AvailableCards , ";");i+=1) 3169 3200 TempStr = StringFromList(i, AvailableCards , ";") 3170 3201 //let's also check that hklStr waves are correct... 3171 3202 Wave DtaWv=$("root:WAXS_PDF:"+possiblyquotename(TempStr)) 3172 Wave/T/Z DtaWvHklDStr=$("root:WAXS_PDF:"+possiblyquotename(TempStr[0,23]+"_hklStr")) 3203 //Wave/T/Z DtaWvHklDStr=$("root:WAXS_PDF:"+possiblyquotename(TempStr[0,23]+"_hklStr")) 3204 tempNameStr = IN2G_CreateUserName(TempStr,24, 0, 1) 3205 Wave/T/Z DtaWvHklDStr=$("root:WAXS_PDF:"+possiblyquotename(tempNameStr+"_hklStr")) 3173 3206 if(!WaveExists(DtaWvHklDStr)) 3174 make/O/T/N=(DimSize(DtaWv, 0 )) $("root:WAXS_PDF:"+possiblyquotename(TempStr[0,23]+"_hklStr")) 3175 Wave/T DtaWvHklDStr=$("root:WAXS_PDF:"+possiblyquotename(TempStr[0,23]+"_hklStr")) 3207 //make/O/T/N=(DimSize(DtaWv, 0 )) $("root:WAXS_PDF:"+possiblyquotename(TempStr[0,23]+"_hklStr")) 3208 make/O/T/N=(DimSize(DtaWv, 0 )) $("root:WAXS_PDF:"+possiblyquotename(tempNameStr+"_hklStr")) 3209 Wave/T DtaWvHklDStr=$("root:WAXS_PDF:"+possiblyquotename(tempNameStr+"_hklStr")) 3176 3210 endif 3177 3211 if(strlen(DtaWvHklDStr[0])<1) //empty wave, not filled... … … 3271 3305 if(PDF4_DisplayHKLTags) 3272 3306 TmpStrName=IN2G_RemoveExtraQuote(listWave[i][0],1,1) 3273 Wave LabelWave=$("root:WAXS_PDF:"+PossiblyQUoteName(TmpStrName[0,23]+"_hklStr")) 3307 //Wave LabelWave=$("root:WAXS_PDF:"+PossiblyQUoteName(TmpStrName[0,23]+"_hklStr")) 3308 Wave LabelWave=$("root:WAXS_PDF:"+PossiblyQUoteName(IN2G_CreateUserName(TmpStrName,23, 0, 0)+"_hklStr")) 3274 3309 IR3W_PDF4AddTagsFromWave("IR3W_WAXSMainGraph", listWave[i][0], labelWave, ListOfPDF4DataColors[i][0], ListOfPDF4DataColors[i][1],ListOfPDF4DataColors[i][2]) 3275 3310 endif … … 3300 3335 End 3301 3336 3337 3338 //************************************************************************************** 3339 //************************************************************************************** 3340 3341 static Function IR3W_WAXSCorForDistance() 3342 3343 IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"") 3344 DFref oldDf= GetDataFolderDFR() 3345 3346 if(DataFolderExists("root:Packages:Irena:WAXSTemp")) 3347 setDataFolder root:Packages:Irena:WAXSTemp 3348 3349 NVAR DistanceCorrection = root:Packages:Irena:WAXS:DistanceCorrection //when DistanceCorrection=1, distacne calibration is perfect, based on my sketch, correction is linear fix. 3350 NVAR Wavelength = root:Packages:Irena:WAXS:Wavelength 3351 string AllWaves = WaveList("*", ";", "DIMS:2,TEXT:0,MINCOLS:8" ) 3352 variable i 3353 string DimensionUnit 3354 For(i=0;i<ItemsInList(AllWaves);i+=1) 3355 Wave TheCardNew = $(StringFromList(i, AllWaves)) 3356 DimensionUnit=GetDimLabel(TheCardNew, 1, 0 ) 3357 if(stringmatch(DimensionUnit,"d_A")) //manually inserted, dimension is in d and A 3358 TheCardNew[][4] = 114.592 * asin((2 * pi / (DistanceCorrection*TheCardNew[p][0]))* wavelength / (4*pi)) 3359 else //other choice is "Q_nm" from LaueGo 3360 TheCardNew[][4] = 114.592 * asin((TheCardNew[p][0]*wavelength/125.664 )) //this is conversion to A and from Q 3361 endif 3362 endfor 3363 endif 3364 setDataFolder oldDf 3365 end 3302 3366 //************************************************************************************** 3303 3367 //************************************************************************************** … … 3311 3375 NVAR Wavelength = root:Packages:Irena:WAXS:Wavelength 3312 3376 wave TheCard=$("root:WAXS_PDF:"+possiblyquotename(CardName)) 3313 wave/T TheCardHKL=$("root:WAXS_PDF:"+possiblyquotename( CardName[0,23]+"_hklStr"))3377 wave/T TheCardHKL=$("root:WAXS_PDF:"+possiblyquotename(IN2G_CreateUserName(CardName,23, 0, 0)+"_hklStr")) 3314 3378 NewDataFolder/O/S root:Packages:Irena:WAXSTemp 3315 3379 Duplicate/O TheCard, $(CardName) 3316 Duplicate/O/T TheCardHKL, $( CardName[0,23]+"_hklStr")3380 Duplicate/O/T TheCardHKL, $(IN2G_CreateUserName(CardName,23, 0, 0)+"_hklStr") 3317 3381 Wave TheCardNew = $((CardName)) 3318 3382 string DimensionUnit=GetDimLabel(TheCardNew, 1, 0 ) 3383 NVAR DistanceCorrection = root:Packages:Irena:WAXS:DistanceCorrection //when DistanceCorrection=1, distacne calibration is perfect, based on my sketch, correction is linear fix. 3319 3384 if(stringmatch(DimensionUnit,"d_A")) //manually inserted, dimension is in d and A 3320 TheCardNew[][4] = 114.592 * asin((2 * pi / TheCard[p][0])* wavelength / (4*pi))3385 TheCardNew[][4] = 114.592 * asin((2 * pi / (DistanceCorrection*TheCard[p][0]))* wavelength / (4*pi)) 3321 3386 else //other choice is "Q_nm" from LaueGo 3322 3387 TheCardNew[][4] = 114.592 * asin((TheCard[p][0]*wavelength/125.664 )) //this is conversion to A and from Q -
trunk/User Procedures/Irena/Modification history.txt
r928 r935 11 11 Modification history: 12 12 ******************************************** 13 2.691 (beta) 13 2.262 (beta) 14 WAXS - changed how JCPDS cards are named (using chemical name or formula+PDF number) + enabled long name support for Igor 8 and when user chooses. 15 WAXS - added "Distance correction" for sticks. Tweaks calculated 2Theta angle using distance ratio correction. 14 16 Fractals - added optional use of Unified Fit Sphere form factor. This removes high-q Bessel function oscillations which are nto reasonable for most cases. 15 17 Added Multi Data Plot tool, new tool to plot quickly many data sets. New ipf file...
Note: See TracChangeset
for help on using the changeset viewer.