- Timestamp:
- Oct 2, 2012 3:51:06 PM (10 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf
r863 r864 933 933 934 934 //////////////////////////////////////////// 935 936 937 938 /////////////////////// 939 // 940 // 941 // Utilities to write out waves as Igor Text 942 // 943 // 944 // -- TODO 945 // -- add flags for SetScale, Note, DimLabels, text? (or a separate function) 946 // x- add a function for 2D waves. wfprintf is not 2D aware... 947 948 949 Function testWriteITX() 950 951 Variable refnum 952 String fname="a_test.itx" 953 // WAVE w=root:testMat 954 // WAVE/T w=root:testText 955 WAVE/T w=root:Packages:NIST:Polarization:ListWave_0_UU 956 957 958 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 959 960 fprintf refNum,"IGOR\r" 961 962 // Write1DWaveToITX(w,refnum) 963 // Write2DWaveToITX(w,refnum) 964 // Write1DTextWaveToITX(w,refnum) 965 Write2DTextWaveToITX(w,refnum) 966 Close refnum 967 968 return(0) 969 end 970 971 // writes out a 1D wave as Igor Text 972 // 973 // the wave and a valid refNum to an open file are passed 974 // 975 // the file is NOT closed when exiting 976 // 977 Function Write1DWaveToITX(w,refnum) 978 Wave w 979 Variable refNum 980 981 String tmpStr,waveStr 982 waveStr=NameOfWave(w) 983 984 fprintf refNum,"WAVES/D\t%s\r",waveStr 985 986 fprintf refNum,"BEGIN\r" 987 988 wfprintf refnum, "\t%g\r",w 989 990 fprintf refNum,"END\r" 991 992 fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale y 0,0,\"\", %s\r",waveStr,waveStr 993 994 // X SetScale/P x 0,1,"", fyy; SetScale y 0,0,"", fyy 995 996 997 return(0) 998 End 999 1000 // writes out a 1D TEXT wave as Igor Text 1001 // 1002 // the wave and a valid refNum to an open file are passed 1003 // 1004 // the file is NOT closed when exiting 1005 // 1006 Function Write1DTextWaveToITX(w,refnum) 1007 Wave/T w 1008 Variable refNum 1009 1010 String tmpStr,waveStr 1011 waveStr=NameOfWave(w) 1012 1013 fprintf refNum,"WAVES/T\t%s\r",waveStr 1014 1015 fprintf refNum,"BEGIN\r" 1016 1017 wfprintf refnum, "\t\"%s\"\r",w 1018 1019 fprintf refNum,"END\r" 1020 1021 fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale y 0,0,\"\", %s\r",waveStr,waveStr 1022 1023 return(0) 1024 End 1025 1026 // writes out a 2D TEXT wave as Igor Text 1027 // 1028 // the wave and a valid refNum to an open file are passed 1029 // 1030 // the file is NOT closed when exiting 1031 // 1032 Function Write2DTextWaveToITX(w,refnum) 1033 Wave/T w 1034 Variable refNum 1035 1036 String tmpStr,waveStr 1037 Variable row,col,ii,jj,tmp 1038 1039 row=DimSize(w, 0 ) 1040 col=DimSize(w, 1 ) 1041 waveStr=NameOfWave(w) 1042 1043 fprintf refNum,"WAVES/T/N=(%d,%d)\t%s\r",row,col,waveStr 1044 fprintf refNum,"BEGIN\r" 1045 1046 for(ii=0;ii<row;ii+=1) 1047 for(jj=0;jj<col;jj+=1) 1048 fprintf refnum, "\t\"%s\"",w[ii][jj] 1049 endfor 1050 fprintf refnum, "\r" 1051 endfor 1052 1053 1054 fprintf refNum,"END\r" 1055 1056 fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",waveStr,waveStr,waveStr 1057 1058 // X SetScale/P x 0,1,"", testMat; SetScale/P y 0,1,"", testMat; SetScale d 0,0,"", testMat 1059 1060 1061 1062 return(0) 1063 End 1064 1065 // writes out a 2D wave as Igor Text 1066 // 1067 // the wave and a valid refNum to an open file are passed 1068 // 1069 // the file is NOT closed when exiting 1070 // 1071 Function Write2DWaveToITX(w,refnum) 1072 Wave w 1073 Variable refNum 1074 1075 String tmpStr,waveStr 1076 Variable row,col,ii,jj,tmp 1077 1078 row=DimSize(w, 0 ) 1079 col=DimSize(w, 1 ) 1080 waveStr=NameOfWave(w) 1081 1082 fprintf refNum,"WAVES/D/N=(%d,%d)\t%s\r",row,col,waveStr 1083 fprintf refNum,"BEGIN\r" 1084 1085 for(ii=0;ii<row;ii+=1) 1086 for(jj=0;jj<col;jj+=1) 1087 fprintf refnum, "\t%g",w[ii][jj] 1088 endfor 1089 fprintf refnum, "\r" 1090 endfor 1091 1092 1093 fprintf refNum,"END\r" 1094 1095 fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",waveStr,waveStr,waveStr 1096 1097 // X SetScale/P x 0,1,"", testMat; SetScale/P y 0,1,"", testMat; SetScale d 0,0,"", testMat 1098 1099 1100 1101 return(0) 1102 End 1103 1104 // root:Packages:NIST:Polarization:Cells: 1105 // save the state of the pink panel, as CellParamSaveState.itx 1106 Function SaveCellParameterTable() 1107 1108 SetDataFolder root:Packages:NIST:Polarization:Cells: 1109 1110 // the waves are: 1111 // CellName (T) 1112 // lambda 1113 // Te, err_Te 1114 // mu, err_mu 1115 1116 Variable refnum 1117 String fname="CellParamSaveState.itx" 1118 // WAVE w=root:testMat 1119 WAVE/T cellName=root:Packages:NIST:Polarization:Cells:CellName 1120 WAVE lambda=root:Packages:NIST:Polarization:Cells:lambda 1121 WAVE Te=root:Packages:NIST:Polarization:Cells:Te 1122 WAVE err_Te=root:Packages:NIST:Polarization:Cells:err_Te 1123 WAVE mu=root:Packages:NIST:Polarization:Cells:mu 1124 WAVE err_mu=root:Packages:NIST:Polarization:Cells:err_mu 1125 1126 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 1127 fprintf refNum,"IGOR\r" 1128 1129 Write1DTextWaveToITX(cellName,refnum) 1130 fprintf refNum,"\r" 1131 1132 Write1DWaveToITX(lambda,refnum) 1133 fprintf refNum,"\r" 1134 1135 Write1DWaveToITX(Te,refnum) 1136 fprintf refNum,"\r" 1137 1138 Write1DWaveToITX(err_Te,refnum) 1139 fprintf refNum,"\r" 1140 1141 Write1DWaveToITX(mu,refnum) 1142 fprintf refNum,"\r" 1143 1144 Write1DWaveToITX(err_mu,refnum) 1145 1146 Close refnum 1147 1148 SetDataFolder root: 1149 1150 return(0) 1151 End 1152 1153 //could use /P=home, but the whole point is that this is for users without Igor licenses, that can't save... so "home" won't exist... 1154 Function RestoreCellParameterTable() 1155 1156 SetDataFolder root:Packages:NIST:Polarization:Cells: 1157 String fname="CellParamSaveState.itx" 1158 1159 // LoadWave/P=home/O/T fname 1160 LoadWave/O/T fname 1161 1162 SetDataFolder root: 1163 return(0) 1164 End 1165 1166 1167 // saves the parameters for the cell decay table 1168 // 1169 // fname = "CellDecayPanelSaveState.itx" 1170 // 1171 // 1172 Function SaveCellDecayTable() 1173 1174 SetDataFolder root:Packages:NIST:Polarization:Cells: 1175 1176 String listStr,item,fname,noteStr,wStr 1177 Variable num,ii,refnum 1178 1179 fname = "CellDecayPanelSaveState.itx" 1180 1181 // get a list of the Decay waves 1182 listStr=WaveList("Decay_*",";","") 1183 num=ItemsInList(listStr,";") 1184 // print listStr 1185 1186 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 1187 fprintf refNum,"IGOR\r" 1188 1189 // Save each of the decay waves, then be sure to add the DimLabels and Wave Note 1190 for(ii=0;ii<num;ii+=1) 1191 item = StringFromList(ii, listStr,";") 1192 Wave w = $item 1193 wStr=NameOfWave(w) 1194 noteStr = note(w) 1195 1196 Write2DWaveToITX(w,refnum) 1197 1198 // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr 1199 fprintf refNum,"X SetDimLabel 1, 0, 'Trans_He_In?', %s\r",wStr 1200 fprintf refNum,"X SetDimLabel 1, 1, 'Trans_He_Out?', %s\r",wStr 1201 fprintf refNum,"X SetDimLabel 1, 2, 'Blocked?', %s\r",wStr 1202 fprintf refNum,"X SetDimLabel 1, 3, mu_star, %s\r",wStr 1203 fprintf refNum,"X SetDimLabel 1, 4, Effective_Pol, %s\r",wStr 1204 fprintf refNum,"X SetDimLabel 1, 5, Atomic_Pol, %s\r",wStr 1205 fprintf refNum,"X SetDimLabel 1, 6, T_Major, %s\r",wStr 1206 fprintf refNum,"X SetDimLabel 1, 7, 'Include?', %s\r",wStr 1207 fprintf refNum,"X SetDimLabel 1, 8, elapsed_hr, %s\r",wStr 1208 fprintf refNum,"X Note %s, \"%s\"\r",wStr,noteStr 1209 1210 fprintf refNum,"\r" //space between waves 1211 endfor 1212 1213 // get a list of the DecayCalc_ waves 1214 listStr=WaveList("DecayCalc_*",";","") 1215 num=ItemsInList(listStr,";") 1216 1217 // Save each of the DecayCalc waves, and add all of the proper dim labels 1218 for(ii=0;ii<num;ii+=1) 1219 item = StringFromList(ii, listStr,";") 1220 Wave w = $item 1221 wStr=NameOfWave(w) 1222 1223 Write2DWaveToITX(w,refnum) 1224 1225 // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr 1226 fprintf refNum,"X SetDimLabel 1, 0, CR_Trans_He_In, %s\r",wStr 1227 fprintf refNum,"X SetDimLabel 1, 1, err_CR_Trans_He_In, %s\r",wStr 1228 fprintf refNum,"X SetDimLabel 1, 2, CR_Trans_He_Out, %s\r",wStr 1229 fprintf refNum,"X SetDimLabel 1, 3, err_CR_Trans_He_Out, %s\r",wStr 1230 fprintf refNum,"X SetDimLabel 1, 4, CR_Blocked, %s\r",wStr 1231 fprintf refNum,"X SetDimLabel 1, 5, err_CR_Blocked, %s\r",wStr 1232 fprintf refNum,"X SetDimLabel 1, 6, muPo, %s\r",wStr 1233 fprintf refNum,"X SetDimLabel 1, 7, err_muPo, %s\r",wStr 1234 fprintf refNum,"X SetDimLabel 1, 8, Po, %s\r",wStr 1235 fprintf refNum,"X SetDimLabel 1, 9, err_Po, %s\r",wStr 1236 fprintf refNum,"X SetDimLabel 1, 10, Tmaj, %s\r",wStr 1237 fprintf refNum,"X SetDimLabel 1, 11, err_Tmaj, %s\r",wStr 1238 fprintf refNum,"X SetDimLabel 1, 12, gamm, %s\r",wStr 1239 fprintf refNum,"X SetDimLabel 1, 13, err_gamm, %s\r",wStr 1240 1241 fprintf refNum,"\r" 1242 endfor 1243 1244 Close refnum 1245 1246 SetDataFolder root: 1247 return(0) 1248 End 1249 1250 // restores the waves for the cell decay table 1251 // 1252 // fname = "CellDecayPanelSaveState.itx" 1253 // 1254 // 1255 Function RestoreCellDecayTable() 1256 1257 SetDataFolder root:Packages:NIST:Polarization:Cells: 1258 1259 String listStr,item,fname,noteStr,wStr 1260 Variable num,ii,refnum 1261 1262 fname = "CellDecayPanelSaveState.itx" 1263 LoadWave/O/T fname 1264 1265 SetDataFolder root: 1266 return(0) 1267 End 1268 1269 1270 1271 //////// 1272 // 1273 // save the state of the Flipper panel 1274 // 1275 // fname = "FlipperPanelSaveState.itx" 1276 // 1277 Function SaveFlipperTable() 1278 1279 SetDataFolder root:Packages:NIST:Polarization:Cells: 1280 1281 String listStr,item,fname,noteStr,wStr 1282 Variable num,ii,refnum 1283 1284 fname = "FlipperPanelSaveState.itx" 1285 1286 // get a list of the "Condition" waves 1287 listStr=WaveList("Cond_*",";","") 1288 num=ItemsInList(listStr,";") 1289 // print listStr 1290 1291 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 1292 fprintf refNum,"IGOR\r" 1293 1294 // Save each of the cond waves, then be sure to add the DimLabels and Wave Note 1295 for(ii=0;ii<num;ii+=1) 1296 item = StringFromList(ii, listStr,";") 1297 Wave w = $item 1298 wStr=NameOfWave(w) 1299 noteStr = note(w) 1300 1301 Write2DWaveToITX(w,refnum) 1302 1303 // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr 1304 fprintf refNum,"X SetDimLabel 1, 0, 'UU_Trans?', %s\r",wStr 1305 fprintf refNum,"X SetDimLabel 1, 1, 'DU_Trans?', %s\r",wStr 1306 fprintf refNum,"X SetDimLabel 1, 2, 'DD_Trans?', %s\r",wStr 1307 fprintf refNum,"X SetDimLabel 1, 3, 'UD_Trans?', %s\r",wStr 1308 fprintf refNum,"X SetDimLabel 1, 4, 'Blocked?', %s\r",wStr 1309 fprintf refNum,"X SetDimLabel 1, 5, Pol_SM_FL, %s\r",wStr 1310 fprintf refNum,"X SetDimLabel 1, 6, Pol_SM, %s\r",wStr 1311 fprintf refNum,"X SetDimLabel 1, 7, 'Include?', %s\r",wStr 1312 fprintf refNum,"X Note %s, \"%s\"\r",wStr,noteStr 1313 1314 fprintf refNum,"\r" //space between waves 1315 endfor 1316 1317 // get a list of the CondCalc_ waves (2d, with dimlabels) 1318 listStr=WaveList("CondCalc_*",";","") 1319 num=ItemsInList(listStr,";") 1320 1321 // Save each of the DecayCalc waves, and add all of the proper dim labels 1322 for(ii=0;ii<num;ii+=1) 1323 item = StringFromList(ii, listStr,";") 1324 Wave w = $item 1325 wStr=NameOfWave(w) 1326 1327 Write2DWaveToITX(w,refnum) 1328 1329 // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr 1330 fprintf refNum,"X SetDimLabel 1, 0, CR_UU, %s\r",wStr 1331 fprintf refNum,"X SetDimLabel 1, 1, err_CR_UU, %s\r",wStr 1332 fprintf refNum,"X SetDimLabel 1, 2, CR_DU, %s\r",wStr 1333 fprintf refNum,"X SetDimLabel 1, 3, err_CR_DU, %s\r",wStr 1334 fprintf refNum,"X SetDimLabel 1, 4, CR_DD, %s\r",wStr 1335 fprintf refNum,"X SetDimLabel 1, 5, err_CR_DD, %s\r",wStr 1336 fprintf refNum,"X SetDimLabel 1, 6, CR_UD, %s\r",wStr 1337 fprintf refNum,"X SetDimLabel 1, 7, err_CR_UD, %s\r",wStr 1338 fprintf refNum,"X SetDimLabel 1, 8, CR_Blocked, %s\r",wStr 1339 fprintf refNum,"X SetDimLabel 1, 9, err_CR_Blocked, %s\r",wStr 1340 fprintf refNum,"X SetDimLabel 1, 10, P_sm_f, %s\r",wStr 1341 fprintf refNum,"X SetDimLabel 1, 11, err_P_sm_f, %s\r",wStr 1342 fprintf refNum,"X SetDimLabel 1, 12, P_sm, %s\r",wStr 1343 fprintf refNum,"X SetDimLabel 1, 13, err_P_sm, %s\r",wStr 1344 1345 fprintf refNum,"\r" 1346 endfor 1347 1348 // get a list of the CondCell_ waves (these are text, 1d) 1349 listStr=WaveList("CondCell_*",";","") 1350 num=ItemsInList(listStr,";") 1351 1352 // Save each of the DecayCalc waves, and add all of the proper dim labels 1353 for(ii=0;ii<num;ii+=1) 1354 item = StringFromList(ii, listStr,";") 1355 Wave w = $item 1356 wStr=NameOfWave(w) 1357 1358 Write1DTextWaveToITX(w,refnum) 1359 1360 // fprintf refnum,"X SetScale/P x 0,1,\"\", wStr; SetScale y 0,0,\"\", %s\r",wStr 1361 1362 fprintf refNum,"\r" 1363 endfor 1364 1365 Close refnum 1366 1367 SetDataFolder root: 1368 return(0) 1369 end 1370 1371 1372 1373 // restores the state of the Flipper panel 1374 // 1375 // fname = "FlipperPanelSaveState.itx" 1376 // 1377 // 1378 Function RestoreFlipperTable() 1379 1380 SetDataFolder root:Packages:NIST:Polarization:Cells: 1381 1382 String listStr,item,fname,noteStr,wStr 1383 Variable num,ii,refnum 1384 1385 fname = "FlipperPanelSaveState.itx" 1386 LoadWave/O/T fname 1387 1388 SetDataFolder root: 1389 return(0) 1390 End -
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 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r863 r864 94 94 "3 Flipper States",ShowFlipperPanel() 95 95 "4 Polarization Correction",ShowPolCorSetup() 96 "-" 97 Submenu "Save State of..." 98 "Fundamental Cell Parameters",SaveCellParameterTable() 99 "Cell Decay Panel",SaveCellDecayTable() 100 "Flipper Condition Panel",SaveFlipperTable() 101 "Polarization Correction Panel",SavePolCorPanelState() 102 End 103 Submenu "Restore State of..." 104 "Fundamental Cell Parameters",RestoreCellParameterTable() 105 "Cell Decay Panel",RestoreCellDecayTable() 106 "Flipper Condition Panel",RestoreFlipperTable() 107 "Polarization Correction Panel",RestorePolCorPanelState() 108 End 96 109 End 97 110 … … 179 192 180 193 Make/O/T/N=0 CellName 181 Make/O/N=0 lambda,Te,err_Te,mu,err_mu 182 194 Make/O/D/N=0 lambda,Te,err_Te,mu,err_mu 195 196 // when the values are reverted, necessary to get back to zero elements 197 Redimension/N=0 CellName 198 Redimension/N=0 lambda,Te,err_Te,mu,err_mu 199 183 200 // parse the strings to fill the table 184 201 for(ii=0;ii<num;ii+=1)
Note: See TracChangeset
for help on using the changeset viewer.