Changeset 432 for sans/Dev/trunk
- Timestamp:
- Oct 24, 2008 3:48:54 PM (14 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf
r431 r432 65 65 Variable doPlot 66 66 67 Variable rr,gg,bb,refnum 67 Variable rr,gg,bb,refnum,dQv 68 68 String w0,w1,w2,n0,n1,n2 69 69 String w3,w4,w5,n3,n4,n5 //3 extra waves to load 70 70 SetDataFolder root: //build sub-folders for each data set under root 71 72 if (exists("root:Packages:NIST:USANS:Globals:MainPanel:dQv")) 73 //Running from USANS reduction 74 Variable dQv = root:Packages:NIST:USANS:Globals:MainPanel:dQv 75 endif 76 if(exists("root:Packages:NIST:USANS_dQv")) 77 //Running from SANS Analysis 78 Variable dQv = root:Packages:NIST:USANS_dQv 79 else 80 //running from somewhere else, probably SANS Reduction, which uses common loaders 81 Variable/G root:Packages:NIST:USANS_dQv = 0.117 82 endif 71 72 // I can't see that we need to find dQv here. 73 // if (exists("root:Packages:NIST:USANS:Globals:MainPanel:gDQv")) 74 // //Running from USANS reduction 75 // Variable dQv = root:Packages:NIST:USANS:Globals:MainPanel:gDQv 76 // endif 77 // if(exists("root:Packages:NIST:USANS_dQv")) 78 // //Running from SANS Analysis 79 // Variable dQv = root:Packages:NIST:USANS_dQv 80 // else 81 // //running from somewhere else, probably SANS Reduction, which uses common loaders 82 // Variable/G root:Packages:NIST:USANS_dQv = 0.117 83 // endif 83 84 84 85 if (cmpStr(fileStr,"") == 0) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/LakeDesmearing_JB.ipf
r404 r432 49 49 // Igor 4 routines are currently used. 50 50 51 52 51 //////////////////////////////////////////////////////////////////////// 53 52 … … 55 54 Proc Desmear() 56 55 57 S VARUSANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder56 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 58 57 59 58 //check for the correct data folder, initialize if necessary 60 59 // 61 if(DataFolderExists( $(USANSFolder+":DSM")) == 0)60 if(DataFolderExists(USANSFolder+":DSM") == 0) 62 61 Execute "Init_Desmearing()" 63 62 endif 64 63 65 //always initialize these 66 String/G $(USANSFolder+":DSM:gStr1") = "" 67 String/G $(USANSFolder+":DSM:gStr2") = "" 68 String/G $(USANSFolder+":DSM:gIterStr") = "" 64 SetDataFolder $(USANSFolder+":DSM") 65 //always initialize these global variables 66 gStr1 = "" 67 gStr2 = "" 68 gIterStr = "" 69 SetDataFolder root: 69 70 70 71 DoWindow/F Desmear_Graph … … 75 76 76 77 Proc Init_Desmearing() 78 79 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 80 77 81 //set up the folder(s) needed 78 82 NewDataFolder/O $(USANSFolder+":DSM") 79 83 NewDataFolder/O $(USANSFolder+":myGlobals") //in case it wasn't created elsewhere 80 84 81 String/G $(USANSFolder+":DSM:gCurFile")="" 82 83 Variable/G $(USANSFolder+":DSM:gMaxFastIter") = 100 //max number of iter in Fast convergence 84 Variable/G $(USANSFolder+":DSM:gMaxSlowIter") = 10000 85 86 Variable/G $(USANSFolder+":DSM:gNptsExtrap") = 10 //points for high q extrapolation 87 Variable/G $(USANSFolder+":DSM:gChi2Target") = 1 //chi^2 target 88 Variable/G $(USANSFolder+":DSM:gPowerM") = -4 89 Variable/G $(USANSFolder+":DSM:gDqv") = 0.117 //2005 measured slit height - see John 90 Variable/G $(USANSFolder+":DSM:gNq") = 1 91 Variable/G $(USANSFolder+":DSM:gS") = 0 // global varaible for Midpnt() 92 Variable/G $(USANSFolder+":DSM:gSmoothFac")=0.03 93 94 Variable/G $(USANSFolder+":DSM:gChi2Final") = 0 //chi^2 final 95 Variable/G $(USANSFolder+":DSM:gIterations") = 0 //total number of iterations 96 97 String/G $(USANSFolder+":DSM:gStr1") = "" //information strings 98 String/G $(USANSFolder+":DSM:gStr2") = "" 99 String/G $(USANSFolder+":DSM:gIterStr") = "" 100 Variable/G $(USANSFolder+":DSM:gChi2Smooth") = 0 101 102 Variable/G $(USANSFolder+":DSM:gFreshMask")=1 85 SetDataFolder $(USANSFolder+":DSM") 86 87 String/G gCurFile="" 88 89 Variable/G gMaxFastIter = 100 //max number of iter in Fast convergence 90 Variable/G gMaxSlowIter = 10000 91 92 Variable/G gNptsExtrap = 10 //points for high q extrapolation 93 Variable/G gChi2Target = 1 //chi^2 target 94 Variable/G gPowerM = -4 95 Variable/G gDqv = 0.117 //2005 measured slit height - see John 96 Variable/G gNq = 1 97 Variable/G gS = 0 // global varaible for Midpnt() 98 Variable/G gSmoothFac=0.03 99 100 Variable/G gChi2Final = 0 //chi^2 final 101 Variable/G gIterations = 0 //total number of iterations 102 103 String/G gStr1 = "" //information strings 104 String/G gStr2 = "" 105 String/G gIterStr = "" 106 Variable/G gChi2Smooth = 0 107 108 Variable/G gFreshMask=1 109 110 SetDataFolder root: 103 111 End 104 112 … … 230 238 FW[NN-1][NN-1] = R_wave[NN-1] 231 239 // 232 SetDataFolder root:233 240 Return (0) 234 241 End … … 570 577 NVAR m = $(USANSFolder+":DSM:gPowerM") // power law exponent 571 578 NVAR chiFinal = $(USANSFolder+":DSM:gChi2Final") //chi^2 final 572 NVAR iter = $(USANSFolder+":DSM:gIterations :") //total number of iterations579 NVAR iter = $(USANSFolder+":DSM:gIterations") //total number of iterations 573 580 574 581 //get the number of spline passes from the wave note … … 773 780 774 781 Proc Desmear_Graph() 775 S VARUSANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder782 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 776 783 777 784 PauseUpdate; Silent 1 // building window... … … 863 870 SetVariable DSMControl_3f,help={"Smoothing factor for the smoothing spline"} 864 871 SetVariable DSMControl_3f format="%5.4f" 865 SetVariable DSMControl_3f,limits={0.01,2,0.01},value= $(USANSFolder+" DSM:gSmoothFac")872 SetVariable DSMControl_3f,limits={0.01,2,0.01},value= $(USANSFolder+":DSM:gSmoothFac") 866 873 SetVariable DSMControl_3f,disable=1 867 874 CheckBox DSMControl_3g,pos={268,39},size={90,14},title="Log-scale smoothing?" … … 869 876 CheckBox DSMControl_3g,value=0 870 877 CheckBox DSMControl_3g,disable=1 871 ValDisplay DSMControl_3h pos={235,97},title="Chi^2",size={80,20},value=root: DSM:gChi2Smooth878 ValDisplay DSMControl_3h pos={235,97},title="Chi^2",size={80,20},value=root:Packages:NIST:USANS:DSM:gChi2Smooth 872 879 ValDisplay DSMControl_3h,help={"This is the Chi^2 value for the smoothed data vs experimental data"} 873 880 ValDisplay DSMControl_3h,disable=1 … … 945 952 946 953 Proc AppendSmeared() 947 S VARUSANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder954 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 948 955 949 956 SetDataFolder $(USANSFolder+":DSM") … … 962 969 TextBox/K/N=text1 963 970 // TextBox/C/N=text1/F=0/A=MT/E=2/X=5.50/Y=0.00 root:DSM:gCurFile //Igor 5 964 TextBox/C/N=text1/F=0/A=MT/E=1/X=5.50/Y=0.00 $(USANSFolder+" DSM:gCurFile")971 TextBox/C/N=text1/F=0/A=MT/E=1/X=5.50/Y=0.00 $(USANSFolder+":DSM:gCurFile") 965 972 End 966 973 967 974 Proc AppendMask() 968 S VARUSANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder975 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 969 976 970 977 // if( strsearch(TraceNameList("Desmear_Graph", "", 1),"MaskData",0,2) == -1) //Igor 5 … … 979 986 980 987 Proc AppendSmoothed() 981 S VARUSANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder988 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 982 989 983 990 // if( strsearch(TraceNameList("Desmear_Graph", "", 1),"I_smth",0,2) == -1) //Igor 5 … … 1007 1014 1008 1015 Proc AppendDesmeared() 1009 S VARUSANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder1016 String USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 1010 1017 1011 1018 // if( strsearch(TraceNameList("Desmear_Graph", "", 1),"I_dsm",0,2) == -1) //Igor 5 … … 1067 1074 1068 1075 SetDataFolder root: 1069 Execute " U_LoadOneDDataWithName(\"\")"1076 Execute "A_LoadOneDDataWithName(\"\",0)" 1070 1077 //define the waves that the smoothing will be looking for... 1071 SVAR fname = $( USANSFolder+":myGlobals:gLastFileName") //this changes as any data is loaded1078 SVAR fname = $("root:Packages:NIST:gLastFileName") //this changes as any data is loaded 1072 1079 SVAR curFile = $(USANSFolder+":DSM:gCurFile") //keep this for title, save 1073 1080 curFile = fname … … 1078 1085 sqStr = CleanupName((fName + "sq"),0) //the sq-wave, which should have -dQv as the elements 1079 1086 1080 Duplicate/O $qStr $(USANSFolder+":DSM:Q_exp ") 1081 Duplicate/O $iStr $(USANSFolder+":DSM:I_exp") 1082 Duplicate/O $sStr $(USANSFolder+":DSM:S_exp ") 1087 String DFStr= CleanupName(fname,0) 1088 1089 Duplicate/O $("root:"+DFStr+":"+qStr) $(USANSFolder+":DSM:Q_exp ") 1090 Duplicate/O $("root:"+DFStr+":"+iStr) $(USANSFolder+":DSM:I_exp") 1091 Duplicate/O $("root:"+DFStr+":"+sStr) $(USANSFolder+":DSM:S_exp ") 1083 1092 wave Q_exp = $(USANSFolder+":DSM:Q_exp") 1084 1093 Wave I_exp = $(USANSFolder+":DSM:I_exp") 1085 1094 Wave S_exp = $(USANSFolder+":DSM:S_exp") 1086 Wave/Z sigQ = $sqStr1087 1095 1088 1096 // remove any negative q-values (and q=0 values!)(and report this) … … 1105 1113 nq = numpnts($(USANSFolder+":DSM:Q_exp")) 1106 1114 1107 if(WaveExists(sigQ)) //try to read dQv 1108 dqv = -sigQ[0] 1109 // DoAlert 0,"Found dQv value of " + num2str(dqv) 1110 else 1111 dqv = 0.117 1112 // dqv = 0.037 //old value 1113 DoAlert 0,"Could not find dQv in the data file - using " + num2str(dqv) 1114 endif 1115 dQv = NumVarOrDefault("root:"+DFStr+":USANS_dQv", 0.117 ) 1116 // if(WaveExists(sigQ)) //try to read dQv 1117 //// dqv = -sigQ[0][0] 1118 //// DoAlert 0,"Found dQv value of " + num2str(dqv) 1119 // else 1120 // dqv = 0.117 1121 // // dqv = 0.037 //old value 1122 // DoAlert 0,"Could not find dQv in the data file - using " + num2str(dqv) 1123 // endif 1115 1124 NVAR gDqv = $(USANSFolder+":DSM:gDqv") //needs to be global for Weights_L() 1116 1125 NVAR gNq = $(USANSFolder+":DSM:gNq") … … 1316 1325 // need to get rid of old smoothed data if data is re-masked 1317 1326 Execute "RemoveSmoothed()" 1318 SetDataFolder root:DSM1327 SetDataFolder $(USANSFolder+":DSM") 1319 1328 Killwaves/Z I_smth,Q_smth,S_smth 1320 1329 … … 1505 1514 endif 1506 1515 1507 NVAR sParam = $(USANSFolder+":DSM:gSmoothFac")1516 NVAR sParam = gSmoothFac //already in the right DF 1508 1517 1509 1518 ControlInfo/W=Desmear_Graph DSMControl_3c //SSCheck … … 1519 1528 // Interpolate2/T=3/N=(nq_ext)/I=1/F=(sParam)/Y=Yi_SS/X=Yq_SS Q_ext, I_ext 1520 1529 // end Igor 4 1521 wave yi_ss = root:DSM:yi_ss1522 wave yq_ss = root:DSM:yq_ss1530 wave yi_ss = yi_ss // already in the right DF 1531 wave yq_ss = yq_ss 1523 1532 // reassign the "working" waves with the result of interpolate, which has the same I/Q values 1524 1533 I_ext = yi_ss … … 1550 1559 // Print "end of smoothed, note = ",note(I_smth) 1551 1560 1552 Variable nq = numpnts( root:DSM:Q_smth)1561 Variable nq = numpnts($(USANSFolder+":DSM:Q_smth")) 1553 1562 // Print "nq after smoothing = ",nq 1554 1563 1555 1564 //reset the global 1556 NVAR gNq = $(USANSFolder+":DSM:gNq")1565 NVAR gNq = gNq 1557 1566 gNq = nq 1558 1567 //report the chi^2 difference between the smoothed curve and the experimental data 1559 NVAR chi2 = root:DSM:gChi2Smooth1568 NVAR chi2 = gChi2Smooth 1560 1569 chi2 = SmoothedChi2(I_smth) 1561 1570 … … 1721 1730 // y_old = I_old, y_new = I_dsm, I_dsm_sm = ys_new, 1722 1731 // duplicate preserves the wave note! 1723 Duplicate/O I_work I_old,Is_old, root:DSM:I_dsm,root:DSM:I_dsm_sm1732 Duplicate/O I_work I_old,Is_old,I_dsm,I_dsm_sm 1724 1733 Duplicate/O Q_work Q_dsm,S_dsm //sets Q_dsm correctly 1725 1734 wave S_dsm,I_old,Is_old,I_dsm,I_dsm_sm … … 1768 1777 Execute "AppendDesmeared()" 1769 1778 DoUpdate 1779 1770 1780 SetDataFolder $(USANSFolder+":DSM") 1771 1781 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/Main_USANS.ipf
r404 r432 542 542 Function PickBT5Path() 543 543 544 NVAR isChecked = root: Globals:MainPanel:gUseCurrentData544 NVAR isChecked = root:Packages:NIST:USANS:Globals:MainPanel:gUseCurrentData 545 545 546 546 //set the global string to the selected pathname … … 1149 1149 newList = SortList(newList,";",0) //get them in order 1150 1150 num=ItemsInList(newlist,";") 1151 Wave/T curWave = $(USANSFolder+" 1151 Wave/T curWave = $(USANSFolder+":Globals:MainPanel:curWave") 1152 1152 Redimension/N=(num) curWave 1153 1153 curWave="" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/USANS_Includes.ipf
r405 r432 19 19 #include "USANSCatNotebook",version >= 2.20 20 20 #include "CheckVersionFTP" //added June 2008 21 #include "GaussUtils_v40" //added Oct 2008 for unified file loading
Note: See TracChangeset
for help on using the changeset viewer.