Changeset 740
- Timestamp:
- Sep 15, 2010 3:02:50 PM (12 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/SA_includes_v410.ipf
r708 r740 33 33 "Fit Manager", Init_WrapperPanel() 34 34 "Load Model Functions",Execute/P "INSERTINCLUDE \"SANSModelPicker_v40\"";Execute/P "COMPILEPROCEDURES ";Execute/P "ModelPicker_Panel()" 35 "Load and Plot Manager", Show_Plot_Manager() 36 "Freeze Model" 37 "Write Model Data" 38 "ReWrite Experimental Data",ReWrite1DData() 39 "1D Arithmetic Panel",MakeDAPanel() 35 "-" 36 Submenu "1D Utilities" 37 "Load and Plot Manager", Show_Plot_Manager() 38 "Freeze Model" 39 "Write Model Data" 40 "ReWrite Experimental Data",MakeDMPanel() //,ReWrite1DData() // SRK SEP10 41 "1D Arithmetic Panel",MakeDAPanel() 42 "ReBin 1D Data",OpenRebin() 43 end 40 44 "-" 41 45 Submenu "Packages" -
sans/Dev/trunk/NCNR_User_Procedures/Common/DataSetHandling.ipf
r734 r740 62 62 Button Rename_button,title="Rename",pos={75,170},size={150,20} 63 63 Button Rename_button,proc=DM_RenameProc 64 Button 64 Button Duplicate_button,title="Duplicate",pos={275,170},size={150,20} 65 65 Button Duplicate_button,proc=DM_DuplicateProc 66 66 … … 71 71 Button SaveAsXML_button,proc=DMSaveAsXMLproc 72 72 73 Button SaveAs6col_button,title="Save as NIST 6 column",pos={275,230},size={1 50,20}73 Button SaveAs6col_button,title="Save as NIST 6 column",pos={275,230},size={160,20} 74 74 Button SaveAs6col_button,proc=DMSaveAs6colproc 75 75 76 Button BatchConvertData_button,title=" Convert Format of 1D Data Files",pos={75,290},size={350,20}76 Button BatchConvertData_button,title="Batch Convert Format of 1D Data Files",pos={75,290},size={350,20} 77 77 Button BatchConvertData_button,proc=DMBatchConvertProc 78 78 … … 88 88 else 89 89 //fake call to popup 90 STRUCT WMPopupAction pa 91 pa.win = "DataManagementPanel" 92 pa.ctrlName = "DS_popup" 93 pa.eventCode = 2 94 DM_PopupProc(pa) 95 endif 96 97 End 90 //// -- can't use STRUCT in a Proc, only a function 91 // STRUCT WMPopupAction pa 92 // pa.win = "DataManagementPanel" 93 // pa.ctrlName = "DS_popup" 94 // pa.eventCode = 2 95 // DM_PopupProc(pa) 96 endif 97 98 End 99 100 Function DMSaveAs6colproc(ba) : ButtonControl 101 STRUCT WMButtonAction &ba 102 103 switch( ba.eventCode) 104 case 2: 105 ControlInfo/W=DataManagementPanel DS_popup 106 String folderName = S_Value 107 fReWrite1DData(folderName,"tab","CRLF") 108 break 109 endswitch 110 111 return 0 112 End 113 114 Function DMSaveAsXMLproc(ba) : ButtonControl 115 STRUCT WMButtonAction &ba 116 117 switch( ba.eventCode) 118 case 2: 119 ControlInfo/W=DataManagementPanel DS_popup 120 String folderName = S_Value 121 ReWrite1DXMLData(folderName) 122 break 123 endswitch 124 125 return 0 126 End 127 128 129 //Function SaveDataSetToFile(folderName) 130 // String folderName 131 // 132 // String protoStr = "" 133 // //Check for history string in folder 134 // //If it doesn't exist then 135 // 136 // //Do saving of data file. 137 // 138 // NVAR gXML_Write = root:Packages:NIST:gXML_Write 139 // 140 // if (gXML_Write == 1) 141 // ReWrite1DXMLData(folderName) 142 // else 143 // fReWrite1DData(folderName,"tab","CRLF") 144 // endif 145 // 146 // //Include history string to record what was done? 147 // 148 //End 149 150 151 152 153 98 154 99 155 Function DMBatchConvertProc(ba) : ButtonControl … … 102 158 switch( ba.eventCode) 103 159 case 2: 104 Execute "Make BatchConvertPanel()"160 Execute "MakeNCNRBatchConvertPanel()" 105 161 break 106 162 endswitch … … 380 436 Button button7,pos={238,20},size={100,20},proc=NCNRBatchConvertNewFolder,title="New Folder" 381 437 Button button7,help={"Select a new data folder"} 382 TitleBox msg0,pos={238,1 40},size={100,30},title="\JCShift-click to\rselect multiple files"438 TitleBox msg0,pos={238,160},size={100,30},title="\JCShift-click to\rselect multiple files" 383 439 TitleBox msg0,frame=0,fixedSize=1 384 440 … … 388 444 CheckBox filterCheck_3,pos={100,220},size={69,14},title="none",value= 0,mode=1, proc=BC_filterCheckProc 389 445 390 Button button8,pos={238,76},size={100,20},proc=NCNRBatchConvertHelpProc,title="Help" 391 Button button9,pos={238,48},size={100,20},proc=NCNRBatchConvertRefresh,title="Refresh List" 392 Button button0,pos={238,106},size={100,20},proc=NCNRBatchConvertDone,title="Done" 446 Button button8,pos={238,75},size={100,20},proc=NCNRBatchConvertHelpProc,title="Help" 447 Button button9,pos={238,47},size={100,20},proc=NCNRBatchConvertRefresh,title="Refresh List" 448 Button button10,pos={238,102},size={100,20},proc=NCNRBatchConvertSelectAll,title="Select All" 449 Button button0,pos={238,130},size={100,20},proc=NCNRBatchConvertDone,title="Done" 393 450 394 451 GroupBox outputGroup,pos={13,270},size={206,60},title="Output File Type" … … 502 559 End 503 560 561 Function NCNRBatchConvertSelectAll(ba) : ButtonControl 562 STRUCT WMButtonAction &ba 563 564 switch (ba.eventcode) 565 case 2: 566 Wave sel=$"root:Packages:NIST:BatchConvert:selWave" 567 sel = 1 568 break 569 endswitch 570 571 End 504 572 505 573 Function NCNRBatchConvertNewFolder(ba) : ButtonControl … … 533 601 if(gRadioVal == 1) 534 602 //keep XML data 535 tmpList = ListMatch(newList, "*.ABSx" ,";") 603 tmpList = ListMatch(newList, "*.ABSx" ,";") //note that ListMatch is not case-sensitive 536 604 tmpList += ListMatch(newList, "*.AVEx" ,";") 605 tmpList += ListMatch(newList, "*.CORx" ,";") 537 606 tmpList += ListMatch(newList, "*.xml" ,";") 538 607 else … … 877 946 SetDrawEnv fname="Times", fsize=22, fstyle= 2,textrgb= (0,0,0) 878 947 DrawText 105,30,")" 879 break 948 break 880 949 endswitch 881 950 … … 1661 1730 endif 1662 1731 1663 // NISTSave1DData(folderName,protoStr)1664 1665 1732 //Include history string to record what was done? 1666 1733 1667 1734 End 1668 1669 1670 1671 //////////////////// Write data functions ////////////////////////////////////1672 // AJJ Nov 2009 - should move towards unified writer1673 //1674 //////////////////////////////////////////////////////////////////////////1675 1676 //Function NISTSave1DData(folderPath,protoStr)1677 // String folderPath, protoStr1678 //1679 // //protoStr is string that will be written to either1680 //1681 //1682 //End1683 1684 1735 1685 1736 … … 1914 1965 1915 1966 ///////////end SRK 1967 1968 1969 1970 ///// SRK 1971 ///// Rebinning 1972 1973 1974 // main entry procedure for subtraction panel 1975 // re-initializes necessary folders and waves 1976 Proc OpenRebin() 1977 DoWindow/F Rebin_Panel 1978 if(V_Flag==0) 1979 InitRebin() 1980 Rebin() //the panel 1981 // Plot_Sub1D() //the graph 1982 endif 1983 1984 End 1985 1986 Function InitRebin() 1987 1988 NewDataFolder/O/S root:Packages:NIST:Rebin 1989 // Variable/G gPtsBeg1=0 1990 // Variable/G gPtsEnd1=0 1991 Variable/G binning=2 1992 1993 SetDataFolder root: 1994 End 1995 1996 Proc Rebin() 1997 1998 PauseUpdate; Silent 1 // building window... 1999 NewPanel /W=(658,347,920,562)/K=1 2000 DoWindow/C Rebin_Panel 2001 ModifyPanel cbRGB=(65535,48662,45086),fixedSize=1 2002 Button button0,pos={161,178},size={50,20},proc=Rebin_Done,title="Done" 2003 PopupMenu popup0,pos={11,50},size={211,20},title="Data in Memory" 2004 PopupMenu popup0,mode=1,value= #"A_OneDDataInMemory()" 2005 Button button1,pos={60,14},size={150,20},proc=Rebin_Load,title="Load Data From File" 2006 Button button2,pos={118,84},size={100,20},proc=Rebin_Append,title="Append Data" 2007 Button button3,pos={11,84},size={80,20},proc=Rebin_newGraph,title="New Graph" 2008 Button button6,pos={11,138},size={70,20},proc=Rebin_by,title="Rebin by" 2009 Button button_8,pos={160,138},size={90,20},proc=SaveResultBin,title="Save Result" 2010 2011 SetVariable end_3,pos={97,140},size={40,14},title=" ",Font="Arial",fsize=10 2012 SetVariable end_3,limits={1,10,1},value= root:Packages:NIST:Rebin:binning 2013 2014 EndMacro 2015 2016 2017 Function Rebin_Done(ctrlName) : ButtonControl 2018 String ctrlName 2019 DoWindow/K Rebin_Panel 2020 End 2021 2022 Proc Rebin_Load(ctrlName) : ButtonControl 2023 String ctrlName 2024 2025 A_LoadOneDData() 2026 ControlUpdate/W=Rebin_Panel popup0 2027 End 2028 2029 Function Rebin_Append(ctrlName) : ButtonControl 2030 String ctrlName 2031 //appends data set from memory /// joindre 2032 String iStr,qStr,eStr 2033 Variable rr,gg,bb 2034 2035 //get the current selection 2036 ControlInfo popup0 2037 if(strlen(S_Value)==0) 2038 Abort "You must load data from a file into memory before appending the data" 2039 Endif 2040 2041 A_PM_doAppend(S_Value) 2042 2043 DoWindow/F Rebin_Panel 2044 End 2045 2046 2047 Function Rebin_newGraph(ctrlName) : ButtonControl 2048 String ctrlName 2049 2050 //get the current selection 2051 ControlInfo popup0 2052 if(strlen(S_Value)==0 || cmpstr(S_Value,"No data loaded")==0) 2053 Abort "You must load data from a file into memory before plotting the data" 2054 Endif 2055 2056 A_PM_doNewGraph(S_Value) 2057 2058 DoWindow/F Rebin_Panel 2059 End 2060 2061 2062 2063 Function Rebin_by (ctrlName) : ButtonControl 2064 String ctrlName 2065 2066 2067 Variable len 2068 Variable ii,jj, helplp,kk 2069 String iStr,qStr,eStr,sqStr,qbStr,fsStr,wtStr,folderStr 2070 Variable rr,gg,bb 2071 NVAR binpts = root:Packages:NIST:Rebin:binning 2072 2073 2074 2075 ControlInfo popup0 2076 if(strlen(S_Value)==0) 2077 Abort "You must load data from a file into memory before plotting the data" 2078 Endif 2079 folderStr = S_Value 2080 2081 SetDataFolder $("root:"+folderStr) 2082 2083 Wave w0 = $(folderStr+"_q") 2084 Wave w1 = $(folderStr+"_i") 2085 Wave w2 = $(folderStr+"_s") 2086 Wave resW = $(folderStr+"_res") 2087 2088 len = numpnts(w0) 2089 Make/O/D/N=(len) w3,w4,w5 2090 w3 = resW[p][0] //std dev of resolution fn 2091 w4 = resW[p][1] //mean q-value 2092 w5 = resW[p][2] //beamstop shadow factor 2093 2094 Make/O/D/N=(round((len-1)/binpts)) qbin,Ibin,sigbin,sqbin,qbbin,fsbin,helpTemp 2095 2096 qbin = 0 2097 Ibin = 0 2098 sigbin = 0 2099 sqbin = 0 2100 qbbin = 0 2101 fsbin = 0 2102 helptemp = 0 2103 2104 ii=0 2105 do 2106 qBin = qBin + w0[binpts*p+ii]/binpts 2107 iBin = iBin + w1[binpts*p+ii]/binpts 2108 helptemp = helptemp + w2[binpts*p+ii]^2 2109 sqBin = sqBin + w3[binpts*p+ii]/binpts 2110 qbBin = qbBin + w4[binpts*p+ii]/binpts 2111 fsBin = fsBin + w5[binpts*p+ii]/binpts 2112 2113 2114 ii+=1 2115 while (ii<binpts) 2116 2117 sigBin = sqrt(helptemp)/binpts 2118 2119 CheckDisplayed Ibin //check top graph only 2120 if(V_flag==0) 2121 AppendToGraph Ibin vs qbin 2122 ModifyGraph log=1,mode(Ibin)=4,marker(Ibin)=29,msize(Ibin)=3,rgb(Ibin)=(65535,0,0) 2123 ErrorBars/T=0 ibin Y,wave=(sigbin,sigbin) 2124 endif 2125 2126 KillWaves/Z helpTemp,w3,w4,w5 2127 2128 SetDataFolder root: 2129 End 2130 2131 2132 // duplicates the binned data to its own data folder, fixing up the names 2133 // as needed, then write out the file from the folder using the standard procedures 2134 // then kill the data folder to clean up. 2135 Function SaveResultBin(ctrlName) : ButtonControl 2136 String ctrlName 2137 2138 String finalname,folderStr 2139 2140 ControlInfo popup0 2141 folderStr=S_Value 2142 2143 SetDataFolder $("root:"+folderStr) 2144 WAVE qbin = qBin 2145 WAVE Ibin = iBin 2146 WAVE sigbin = sigBin 2147 WAVE sqbin = sqBin 2148 WAVE qbbin = qbBin 2149 WAVE fsbin = fsBin 2150 2151 NVAR/Z dQv = USANS_dQv 2152 Variable isSANS = (NVAR_Exists(dQv) == 0) 2153 // Print "isSANS = ",isSANS 2154 if(isSANS) 2155 // SANS data - make a smaller resWave 2156 Variable np=numpnts(qBin) 2157 Make/D/O/N=(np,4) $(folderStr+"_resBin") 2158 Wave res = $(folderStr+"_resBin") 2159 2160 res[][0] = sqBin[p] //sigQ 2161 res[][1] = qbBin[p] //qBar 2162 res[][2] = fsBin[p] //fShad 2163 res[][3] = qBin[p] //Qvalues 2164 2165 endif 2166 finalname = folderStr+"bin" 2167 2168 SetDataFolder root: 2169 DuplicateDataSet(folderStr,finalname,1) 2170 2171 // rename the waves so that the correct ones are written out 2172 SetDataFolder $("root:"+finalname) 2173 Killwaves/Z $(finalname+"_q") 2174 Killwaves/Z $(finalname+"_i") 2175 Killwaves/Z $(finalname+"_s") 2176 if(isSANS) //if USANS, keep the resolution waves, so that the writer will recognize the set as USANS 2177 Killwaves/Z $(finalname+"_res") 2178 endif 2179 2180 WAVE qbin = qBin //reset the wave references to the new folder (bin) 2181 WAVE Ibin = iBin 2182 WAVE sigbin = sigBin 2183 if(isSANS) 2184 Wave res = $(finalName+"_resBin") 2185 endif 2186 2187 Rename qbin $(finalname+"_q") 2188 Rename ibin $(finalname+"_i") 2189 Rename sigbin $(finalname+"_s") 2190 if(isSANS) 2191 Rename res $(finalname+"_res") 2192 endif 2193 SetDataFolder root: 2194 2195 // save out the data in the folder 2196 SaveDataSetToFile(finalName) 2197 2198 KillDataFolder/Z $("root:"+finalname) 2199 2200 SetDataFolder root: 2201 return(0) 2202 End 2203 2204 2205 2206 2207 /// end rebinning procedures -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Menu.ipf
r665 r740 34 34 "Sort and Combine data",ShowNSORTPanel() 35 35 // "Subtract 1D Data Sets",OpenSubtract1DPanel() 36 "Subtract 1D Data Sets",MakeDAPanel() //new version 36 "ReWrite Experimental Data",MakeDMPanel() //,ReWrite1DData() // SRK SEP10 37 "1D Arithmetic Panel",MakeDAPanel() 38 "ReBin 1D Data",OpenRebin() 37 39 End 38 40 Submenu "2-D Processing" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/Main_USANS.ipf
r734 r740 27 27 "Add two data sets",ShowUSANSAddPanel() 28 28 "-" 29 "Load USANS Data",A_LoadOneDData() 30 "Convert to 6 Columns",Convert3ColTo6Col() 29 Submenu "1D Utilities" 30 "Load and Plot Manager", Show_Plot_Manager() 31 "Convert to 6 Columns",Convert3ColTo6Col() 32 "ReWrite Experimental Data",MakeDMPanel() //,ReWrite1DData() // SRK SEP10 33 "1D Arithmetic Panel",MakeDAPanel() 34 "ReBin 1D Data",OpenRebin() 35 end 31 36 "-" 37 // "Load USANS Data",A_LoadOneDData() 38 // "-" 32 39 "USANS Simulator",Show_UCALC() 33 40 "-" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/USANS_Includes_v230.ipf
r739 r740 33 33 #include "WriteQIS" 34 34 35 //AJJ for data set output? 36 //#include "DataSetHandling" 37 //#Include "WriteModelData_v40" 35 //AJJ for data set output 36 #include "DataSetHandling" 37 #Include "WriteModelData_v40" 38 #include "PlotManager_v40"
Note: See TracChangeset
for help on using the changeset viewer.