Changeset 608
- Timestamp:
- Dec 3, 2009 3:59:42 AM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Common/DataSetHandling.ipf
r607 r608 139 139 PopupMenu DS1_popup,pos={30,21},size={318,20},title="Data Set 1" 140 140 PopupMenu DS1_popup,mode=1,value= #"DM_DataSetPopupList()" 141 PopupMenu DS1_popup,proc=DA_PopupProc 141 142 PopupMenu DS1_popup,fsize=12,fcolor=(65535,0,0),valueColor=(65535,0,0) 142 143 … … 145 146 PopupMenu DS2_popup,pos={30,51},size={318,20},title="Data Set 2" 146 147 PopupMenu DS2_popup,mode=1,value= #"DM_DataSetPopupList()" 148 PopupMenu DS2_popup,proc=DA_PopupProc 147 149 PopupMenu DS2_popup,fsize=12,fcolor=(0,0,65535),valueColor=(0,0,65535) 148 150 … … 162 164 Button DACursors_button,title="Get Matching Range",pos={175,250},size={150,20} 163 165 Button DACursors_button,proc=DACursorButtonProc 166 164 167 SetVariable DAResultName_sv,title="Result Name (max 25 characters)",pos={50,280},size={400,20} 165 SetVariable DAResultName_Sv,fsize=12,value=_STR:"SubtractionResult",proc=setvarproc,live=1 168 SetVariable DAResultName_Sv,fsize=12,proc=setvarproc,live=1 169 //Update the result name 170 ControlInfo/W=DataArithmeticPanel DS1_popup 171 if (cmpstr(S_Value,"No data loaded") == 0) 172 SetVariable DAResultName_sv,value=_STR:"SubtractionResult" 173 else 174 //fake call to popup 175 STRUCT WMPopupAction pa 176 pa.win = "DataArithmeticPanel" 177 pa.ctrlName = "DS1_popup" 178 pa.eventCode = 2 179 DA_PopupProc(pa) 180 endif 181 166 182 CheckBox DANoDS2_cb,title="Data Set 2 = 1?",pos={300,180} 167 183 CheckBox DANoDS2_cb,proc=DANoDS2Proc … … 175 191 176 192 NewPanel/HOST=DataArithmeticPanel/N=arithDisplay/W=(50,150,170,190) 193 194 //Update the result name 195 ControlInfo/W=DataArithmeticPanel DS1_popup 196 197 198 177 199 arithDisplayProc(0) 178 200 … … 233 255 ControlInfo/W=$(win) DS1_popup 234 256 DS1name = S_Value 235 if (!DataFolderExists("root:NullSolvent")) 236 DuplicateDataSet("root:"+DS1name,"NullSolvent") 237 endif 257 DuplicateDataSet("root:"+DS1name,"NullSolvent",1) 238 258 Wave qWave =root:NullSolvent:NullSolvent_q 239 259 Wave iWave = root:NullSolvent:NullSolvent_i 240 260 Wave errWave = root:NullSolvent:NullSolvent_s 241 261 iWave = 1 242 errWave = 0 .1262 errWave = 0 243 263 AppendToGraph/W=DAPlotPanel#DAPlot iWave vs Qwave 244 264 ErrorBars/W=DAPlotPanel#DAPlot /T=0 NullSolvent_i, Y wave=(errWave,errWave) … … 392 412 393 413 endif 414 //fake call to popup 415 STRUCT WMPopupAction pa 416 pa.win = ba.win 417 pa.ctrlName = "DS1_popup" 418 pa.eventCode = 2 419 DA_PopupProc(pa) 394 420 break 395 421 endswitch 396 422 397 423 return 0 424 End 425 426 Function DA_PopupProc(pa) : PopupMenuControl 427 STRUCT WMPopupAction &pa 428 429 String resultName 430 431 switch( pa.eventCode) 432 case 2: 433 //print "Called by "+pa.ctrlname+" with value "+pa.popStr 434 ControlInfo/W=$(pa.win) $(pa.ctrlName) 435 String popStr = S_Value 436 if (stringmatch(pa.ctrlname,"*DS1*") == 1) 437 resultName = stringfromlist(0,popStr,"_")+"_mod" 438 439 SetVariable DAResultName_sv win=$(pa.win), value=_STR:resultName 440 endif 441 break 442 endswitch 443 444 398 445 End 399 446 … … 405 452 // in this way, buttons will always be drawn correctly.. 406 453 // 407 Function DATabsProc(name,tab) 408 String name 409 Variable tab 410 411 // Print "name,number",name,tab 412 String ctrlList = ControlNameList("",";"),item="",nameStr="" 413 Variable num = ItemsinList(ctrlList,";"),ii,onTab 414 for(ii=0;ii<num;ii+=1) 415 //items all start w/"DSTabItem_" 416 item=StringFromList(ii, ctrlList ,";") 417 nameStr=item[0,9] 418 if(cmpstr(nameStr,"DATabItem_")==0) 419 onTab = str2num(item[10]) 420 ControlInfo $item 421 switch (V_flag) 422 case 1: 423 Button $item,disable=(tab!=onTab) 424 break 425 case 2: 426 CheckBox $item,disable=(tab!=onTab) 427 break 428 case 3: 429 PopUpMenu $item,disable=(tab!=onTab) 430 break 431 case 5: 432 SetVariable $item,disable=(tab!=onTab) 433 break 434 endswitch 435 endif 436 endfor 437 438 arithDisplayProc(tab) 454 Function DATabsProc(tca) : TabControl 455 STRUCT WMTabControlAction &tca 456 457 switch (tca.eventCode) 458 case 2: 459 // Print "name,number",name,tab 460 String ctrlList = ControlNameList("",";"),item="",nameStr="" 461 Variable num = ItemsinList(ctrlList,";"),ii,onTab 462 for(ii=0;ii<num;ii+=1) 463 //items all start w/"DSTabItem_" 464 item=StringFromList(ii, ctrlList ,";") 465 nameStr=item[0,9] 466 if(cmpstr(nameStr,"DATabItem_")==0) 467 onTab = str2num(item[10]) 468 ControlInfo $item 469 switch (V_flag) 470 case 1: 471 Button $item,disable=(tca.tab!=onTab) 472 break 473 case 2: 474 CheckBox $item,disable=(tca.tab!=onTab) 475 break 476 case 3: 477 PopUpMenu $item,disable=(tca.tab!=onTab) 478 break 479 case 5: 480 SetVariable $item,disable=(tca.tab!=onTab) 481 break 482 endswitch 483 endif 484 endfor 485 486 arithDisplayProc(tca.tab) 487 break 488 endswitch 439 489 End 440 490 … … 450 500 ControlInfo/W=$(ba.win) DATabs 451 501 Variable tabNum = V_value 452 Print "Tab number "+num2str(tabNum)502 //Print "Tab number "+num2str(tabNum) 453 503 454 504 ControlInfo/W=$(ba.win) DS1_popup … … 734 784 735 785 736 Function DuplicateDataSet(dataSetFolder, newName )786 Function DuplicateDataSet(dataSetFolder, newName, forceoverwrite) 737 787 String dataSetFolder 738 788 String newName 789 Variable forceoverwrite 739 790 740 791 String dataSetFolderParent,basestr,objName … … 746 797 basestr = ParseFilePath(0,dataSetFolder,":",1,0) 747 798 799 print "Duplicating "+dataSetFolder+" as "+newName 800 748 801 SetDataFolder $(dataSetFolderParent) 749 // try 750 DuplicateDataFolder $(dataSetFolder) $(dataSetFolderParent+newName)//; AbortOnRTE 751 752 SetDataFolder $(dataSetFolderParent+newName)//; AbortOnRTE 753 do 754 objName = GetIndexedObjName("",1,index) 755 if (strlen(objName) == 0) 756 break 757 endif 758 Rename $(objName) $(ReplaceString(basestr,objName,newName)) 759 index+=1 760 while(1) 761 SetDataFolder root: 762 // catch 763 // Print "Aborted: " + num2str(V_AbortCode) 764 // SetDataFolder root: 765 // 766 // endtry 802 803 if (!DataFolderExists(newName)) 804 NewDataFolder $(newName) 805 else 806 if (!forceoverwrite) 807 DoAlert 1, "A dataset with the name "+newName+" already exists. Overwrite?" 808 if (V_flag == 2) 809 return 1 810 endif 811 endif 812 endif 813 814 //If we are here, the folder (now) exists and the user has agreed to overwrite 815 //either in the function call or from the alert. 816 do 817 objName = GetIndexedObjName(basestr,1,index) 818 if (strlen(objName) == 0) 819 break 820 endif 821 objname = ":"+basestr+":"+objname 822 Duplicate/O $(objName) $(ReplaceString(basestr,objName,newName)) 823 index+=1 824 while(1) 825 826 SetDataFolder root: 827 return 0 767 828 End 768 829 … … 783 844 //Create folder for result 784 845 //UnloadDataSet(resultName) 785 if (!DataFolderExists(resultPath)) 786 //Make the folder 787 DuplicateDataSet(set1Path,resultName) 788 endif 789 846 //Make the folder 847 if (DuplicateDataSet(set1Path,resultName,0)) 848 return 1 849 else 790 850 //Do subtraction of I waves - including interpolation if necessary. 791 851 Wave result_i = $(resultPath+resultName+"_i") 852 Wave result_s = $(resultPath+resultName+"_s") 792 853 Wave set1_i = $(set1Path+set1Name+"_i") 793 854 Wave set1_q = $(set1Path+set1Name+"_q") 855 Wave set1_s = $(set1Path+set1Name+"_s") 794 856 Wave set2_i = $(set2Path+set2Name+"_i") 795 857 Wave set2_q = $(set2Path+set2Name+"_q") 858 Wave set2_s = $(set2Path+set2Name+"_s") 859 796 860 result_i = set1_i - (set2Scale*interp(set1_q[p],set2_q,set2_i)) 797 798 861 result_s = sqrt(set1_s^2 + set2Scale^2*interp(set1_q[p],set2_q,set2_s)) 799 862 //Calculate result error wave - can we produce corrected Q error? 800 863 801 864 //Generate history string to record what was done? 802 865 return 0 866 endif 803 867 End 804 868 … … 817 881 SetDataFolder root: 818 882 //Create folder for result 819 //UnloadDataSet(resultName) 820 if (DataFolderExists(resultPath) != 1) 821 //Make the folder 822 DuplicateDataSet(set1Path,resultName) 823 endif 824 883 if(DuplicateDataSet(set1Path,resultName,0)) 884 //User said no overwrite 885 return 1 886 else 825 887 //Do addition of I waves - including interpolation if necessary. 826 888 Wave result_i = $(resultPath+resultName+"_i") … … 834 896 835 897 //Generate history string to record what was done? 836 898 return 0 899 endif 837 900 End 838 901 … … 851 914 SetDataFolder root: 852 915 //Create folder for result 853 //UnloadDataSet(resultName) 854 if (DataFolderExists(resultPath) != 1) 855 //Make the folder 856 DuplicateDataSet(set1Path,resultName) 857 endif 858 916 //Make the folder 917 if(DuplicateDataSet(set1Path,resultName,0)) 918 //User said no overwrite 919 return 1 920 else 859 921 //Do multiplcation of I waves - including interpolation if necessary. 860 922 Wave result_i = $(resultPath+resultName+"_i") … … 869 931 870 932 //Generate history string to record what was done? 871 933 return 0 934 endif 872 935 End 873 936 … … 886 949 SetDataFolder root: 887 950 //Create folder for result 888 //UnloadDataSet(resultName) 889 if (DataFolderExists(resultPath) != 1) 890 //Make the folder 891 DuplicateDataSet(set1Path,resultName) 892 endif 893 951 //Make the folder 952 if(DuplicateDataSet(set1Path,resultName,0)) 953 //User said no overwrite 954 return 1 955 else 894 956 //Do division of I waves - including interpolation if necessary. 895 957 Wave result_i = $(resultPath+resultName+"_i") … … 903 965 904 966 //Generate history string to record what was done? 905 967 return 0 968 endif 906 969 End 907 970 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/Main_USANS.ipf
r578 r608 68 68 69 69 //Preference value to determine if we are outputting XML 70 Variable/G root:Packages:NIST: USANS:Globals:gUseXMLOutput= 070 Variable/G root:Packages:NIST:gXML_Write = 0 71 71 72 72 Make/O/T/N=1 fileWave,samWave,empWave,curWave //Added curWave Sept 06 A. Jackson -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/USANS_Includes.ipf
r570 r608 31 31 #include "NCNR_Utils" 32 32 #include "MultipleReduce" 33 34 //AJJ for data set output? 35 //#include "DataSetHandling" 36 //#Include "WriteModelData_v40"
Note: See TracChangeset
for help on using the changeset viewer.