Changeset 864 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
- Timestamp:
- Oct 2, 2012 3:51:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
r853 r864 132 132 133 133 134 // saves the runs+cells for the PolCor Panel, separate from what is saved when the panel is closed 135 // 136 // fname = "CellDecayPanelSaveState.itx" 137 // 138 // 139 Function SavePolCorPanelState() 140 141 SetDataFolder root:Packages:NIST:Polarization 142 143 String listStr,item,fname,noteStr,wStr 144 Variable num,ii,refnum 145 146 fname = "PolCorPanelSaveState.itx" 147 148 // get a list of the List waves 149 listStr=WaveList("ListWave_*",";","") 150 num=ItemsInList(listStr,";") 151 // print listStr 152 153 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 154 fprintf refNum,"IGOR\r" 155 156 // Save each of the list waves, 2D text 157 for(ii=0;ii<num;ii+=1) 158 item = StringFromList(ii, listStr,";") 159 Wave/T tw = $item 160 161 Write2DTextWaveToITX(tw,refnum) 162 163 fprintf refNum,"\r" //space between waves 164 endfor 165 166 // get a list of the Selection waves 167 listStr=WaveList("lbSelWave_*",";","") 168 num=ItemsInList(listStr,";") 169 170 // Save each of the Selection waves, 2D numerical 171 for(ii=0;ii<num;ii+=1) 172 item = StringFromList(ii, listStr,";") 173 Wave w = $item 174 175 Write2DWaveToITX(w,refnum) 176 177 fprintf refNum,"\r" 178 endfor 179 180 // save the popState wave 181 Wave/T tw=root:Packages:NIST:Polarization:PolCor_popState 182 Write2DTextWaveToITX(tw,refnum) 183 184 Close refnum 185 186 SetDataFolder root: 187 return(0) 188 End 189 190 // restores the waves for the cell decay table 191 // 192 // fname = "PolCorPanelSaveState.itx" 193 // 194 // 195 Function RestorePolCorPanelState() 196 197 SetDataFolder root:Packages:NIST:Polarization 198 199 String listStr,item,fname,noteStr,wStr 200 Variable num,ii,refnum 201 202 fname = "PolCorPanelSaveState.itx" 203 LoadWave/O/T fname 204 205 SetDataFolder root: 206 return(0) 207 End 208 134 209 // 135 210 // TODO: … … 144 219 DoAlert 1,"Do you want to initialize, wiping out all of your entries?" 145 220 if(V_flag != 1) //1== yes initialize, so everything else, restore the entries 146 return(1) 221 return(1) //send back 1 to say yes, restore the saved state 147 222 endif 148 223 … … 542 617 // PopupMenu popup_1_UD_4,mode=1,popvalue="none",value= #"D_CellNameList()" 543 618 544 545 // BKG Tab 619 // TODO 620 // BKG Tab -- DU, DD, UD are not shown, since the background is not dependent on the flipper states, so only one background 621 // file is necessary - this is "incorrectly" labeled as UU. I'll get around to changing this in the future... 622 // 623 TitleBox title_2_UU,pos={350,100},size={400,48},title="\\f01BGD files are independent of polarization\rEnter all as UU",fSize=12 624 625 546 626 // UU 547 627 ListBox ListBox_2_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 … … 570 650 571 651 // DU 572 ListBox ListBox_2_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2573 ListBox ListBox_2_DU,listWave=root:Packages:NIST:Polarization:ListWave_2_DU,titleWave=root:Packages:NIST:Polarization:lbTitles574 ListBox ListBox_2_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_2_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2652 //////// ListBox ListBox_2_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 653 //////// ListBox ListBox_2_DU,listWave=root:Packages:NIST:Polarization:ListWave_2_DU,titleWave=root:Packages:NIST:Polarization:lbTitles 654 //////// ListBox ListBox_2_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_2_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 575 655 // SetVariable setvar_2_DU_0,pos={368,102},size={70,16},title="File",fSize=10 576 656 // SetVariable setvar_2_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_0 … … 595 675 596 676 // DD 597 ListBox ListBox_2_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2598 ListBox ListBox_2_DD,listWave=root:Packages:NIST:Polarization:ListWave_2_DD,titleWave=root:Packages:NIST:Polarization:lbTitles599 ListBox ListBox_2_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_2_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2677 //////// ListBox ListBox_2_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 678 //////// ListBox ListBox_2_DD,listWave=root:Packages:NIST:Polarization:ListWave_2_DD,titleWave=root:Packages:NIST:Polarization:lbTitles 679 //////// ListBox ListBox_2_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_2_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 600 680 // SetVariable setvar_2_DD_0,pos={33,286},size={70,16},title="File",fSize=10 601 681 // SetVariable setvar_2_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_0 … … 620 700 621 701 // UD 622 ListBox ListBox_2_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2623 ListBox ListBox_2_UD,listWave=root:Packages:NIST:Polarization:ListWave_2_UD,titleWave=root:Packages:NIST:Polarization:lbTitles624 ListBox ListBox_2_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_2_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2702 //////// ListBox ListBox_2_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 703 //////// ListBox ListBox_2_UD,listWave=root:Packages:NIST:Polarization:ListWave_2_UD,titleWave=root:Packages:NIST:Polarization:lbTitles 704 //////// ListBox ListBox_2_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_2_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 625 705 // SetVariable setvar_2_UD_0,pos={368,286},size={70,16},title="File",fSize=10 626 706 // SetVariable setvar_2_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_0 … … 777 857 End 778 858 779 859 // 0 = SAM, 1 = EMP, 2 = BGD 860 Function ChangeDataTab(tab) 861 Variable tab 862 Variable val 863 864 TabControl PolCorTab win=PolCor_Panel,value=tab 865 866 // as if the tab was clicked 867 val = (tab != 0) 868 // Print "tab 0 val = ",val 869 ToggleSelControls("_0_",val) 870 871 val = (tab != 1) 872 // Print "tab 1 val = ",val 873 ToggleSelControls("_1_",val) 874 875 val = (tab != 2) 876 // Print "tab 2 val = ",val 877 ToggleSelControls("_2_",val) 878 879 return(0) 880 End 780 881 781 882 Function PolCorHelpParButtonProc(ba) : ButtonControl … … 909 1010 // -the PolMatrix of coefficients is filled (the specified row) 910 1011 // 1012 // *** IF THE DATA IS BGD *** 1013 // take the file list from UU every time, but load and put this in all 4 XS locations 1014 // ************************* 1015 // 911 1016 // TODO: 912 1017 // X- pre-parsing is not done to check for valid file numbers. This should be done gracefully. … … 935 1040 // listStr = StringList("gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*", ";" ) 936 1041 937 Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+pType) 1042 //////////// 1043 if(tabNum == 2) //BGD data, read from UU every time, but don't change the pType tag 1044 Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+"UU") 1045 else 1046 Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+pType) 1047 endif 938 1048 num = DimSize(lb,0) //should be 10, as initialized 939 1049 … … 1053 1163 // listStr = StringList("gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*", ";" ) 1054 1164 1055 1056 Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+pType) 1165 //////////// 1166 if(tabNum == 2) //BGD data, read from UU every time, but don't change the pType tag 1167 Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+"UU") 1168 else 1169 Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+pType) 1170 endif 1057 1171 num = DimSize(lb,0) //should be 10, as initialized 1058 1172 … … 1680 1794 // largely copied from ReduceAFile() 1681 1795 // 1796 // 1797 // 1798 // 1682 1799 Function ReducePolCorDataButton(ctrlName) : ButtonControl 1683 1800 String ctrlName 1684 1801 1685 // depends on which tab you're on 1686 // (maybe) select UD type 1687 1802 1688 1803 String pType 1689 1804 // Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;All;" … … 1738 1853 // very similar to ExecuteProtocol 1739 1854 // 1740 // -- SAM, EMP, and BGD do not need to be loaded1741 // -- but they do need to be "moved" into the regular data positions1742 // rather then their tagged locations.1743 1855 // 1856 // OCT 2012 - changed this to force a re-load of all of the data, and a re-calculation 1857 // of the Pol-corrected data, so that all of the "_pc" waves that are present are the 1858 // correct, and current values. Only re-loads the data that is used for the particular protocol, 1859 // just like a normal reduction. This is, somewhat redundant, since the data is re-loaded 4x, when 1860 // it really only needs to be re-loaded 1x, but this is only a minor speed hit. 1861 // 1744 1862 // -- the "extensions" now all are "_UU_pc" and similar, to use the polarization corrected data and errors 1745 1863 // … … 1766 1884 //5 - average params 1767 1885 //6 = DRK file (**out of sequence) 1768 1769 // don't load the SAM data, just re-tag it 1886 1887 1888 // For each of the tabs (SAM, EMP, BGD) 1889 // -- reload the data 1890 // -- re-do the polarization correction 1891 1892 // then, and only then, after we're sure that all of the data is correct and current, then proceed with the 1893 // correction of the data with the selected protocol 1894 String dataType,str 1895 1896 STRUCT WMButtonAction ba 1897 ba.eventCode = 2 // mouse up 1898 1899 1900 // Now ensure that the proper SAM data is loaded, then re-tag it 1770 1901 // the Polarization corrected data is UU_pc, DU_pc, etc. 1771 1902 // this tags it for display, and puts it in the correctly named waves 1772 String dataType,str 1903 1904 ChangeDataTab(0) //SAM 1905 LoadRawPolarizedButton(ba) 1906 PolCorButton(ba) 1773 1907 1774 1908 dataType="SAM" … … 1776 1910 Execute str 1777 1911 1778 1779 1780 // don't load the BGD data, just re-tag it 1912 // force a re-load of BGD data, then re-tag it 1781 1913 if(cmpstr(prot[0],"none") != 0) //if BGD is used, protStr[0] = "" 1914 ChangeDataTab(2) //BGD 1915 LoadRawPolarizedButton(ba) 1916 PolCorButton(ba) 1917 1782 1918 dataType="BGD" 1783 1919 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" … … 1785 1921 endif 1786 1922 1787 // don't load the EMP data, just re-tag it 1788 // 1923 // force a re-load the EMP data, then re-tag it 1789 1924 if(cmpstr(prot[1],"none") != 0) //if EMP is used, protStr[1] = "" 1925 ChangeDataTab(1) //EMP 1926 LoadRawPolarizedButton(ba) 1927 PolCorButton(ba) 1928 1790 1929 dataType="EMP" 1791 1930 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" … … 2069 2208 //if this doesn't exist, a dialog will be presented by setting dialog = 1 2070 2209 // 2071 // -- add in pType tag to the name 2210 // -- add in pType tag to the name for the polarization "type" 2072 2211 // 2073 2212 Variable dialog = 0
Note: See TracChangeset
for help on using the changeset viewer.