Changeset 836 for sans/Dev/trunk/NCNR_User_Procedures/Reduction
- Timestamp:
- Feb 17, 2012 12:04:13 PM (11 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf
r835 r836 605 605 end 606 606 607 608 607 // 608 // calculate the (atomic) He polarization at some delta time 609 // 610 // t2 is in hours, gamma in hours 611 // 612 Function Calc_PHe_atT(Po,err_Po,gam,err_gam,t2,err_Pt) 613 Variable Po,err_Po,gam,err_gam,t2,&err_Pt 614 615 616 Variable Pt 617 618 Pt = Po*exp(-t2/gam) 619 620 Variable arg,tmp2 621 // 2 terms, no error in t2 622 err_Pt = Pt^2/Po^2*err_Po^2 + t2^2/gam^4*Pt^2*err_gam^2 623 624 err_Pt = sqrt(err_Pt) 625 626 Printf "At (delta)t=%g P_He(t) = %g +/- %g (%g%)\r",t2,Pt,err_Pt,err_Pt/Pt*100 627 628 return(Pt) 629 End 630 631 632 633 // 609 634 // t2 is in hours, muP0 is at t0 610 635 // … … 615 640 Variable Pcell 616 641 617 618 642 PCell = tanh(muPo * exp(-t2/gam)) 643 // PCell = (muPo * exp(-t2/gam)) 619 644 620 645 Variable arg,tmp2 … … 627 652 628 653 Printf "At t=%g Pcell = %g +/- %g (%g%)\r",t2,Pcell,err_Pcell,err_Pcell/PCell*100 629 630 631 654 632 655 return(PCell) … … 762 785 case 2: // mouse up 763 786 // click code here 764 DoAlert 0,"Help for Flipper Panel not written yet" 787 DisplayHelpTopic/Z/K=1 "Flipper States Panel" 788 if(V_flag !=0) 789 DoAlert 0,"The Flipper States Panel Help file could not be found" 790 endif 765 791 break 766 792 case -1: // control being killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
r835 r836 775 775 case 2: // mouse up 776 776 // click code here 777 DoAlert 0,"Help for PolCor Panel not written yet" 777 DisplayHelpTopic/Z/K=1 "Polarization Correction Panel" 778 if(V_flag !=0) 779 DoAlert 0,"The Polarization Correction Panel Help file could not be found" 780 endif 778 781 break 779 782 case -1: // control being killed … … 1017 1020 Variable row,Psm, PsmPf, PCell,err_Psm, err_PsmPf, err_PCell 1018 1021 Variable ii,jj,muPo,err_muPo,gam,err_gam,monCts,t1,num,fileCount 1022 Variable Po,err_Po,Pt,err_Pt,Tmaj,Tmin,err_Tmaj,err_Tmin,Te,err_Te,mu,err_mu,summedMonCts 1019 1023 1020 1024 Variable ea_uu, ea_ud, ea_dd, ea_du … … 1056 1060 err_PsmPf = NumberByKey("err_P_sm_f", condNote, "=", ",", 0) 1057 1061 1062 // 1063 // 1064 // find the proper propotions to add the matrix contributions 1065 // if only one file, this = 1, otherwise it should sum to one 1066 // 1067 Make/O/D/N=10 proportion 1068 proportion = 0 1069 summedMonCts = 0 1070 // loop over the (10) rows in the listWave 1071 for(ii=0;ii<num;ii+=1) 1072 runStr = lb[ii][0] //the run number 1073 if(cmpstr(runStr, "" ) != 0) 1074 fname = FindFileFromRunNumber(str2num(runStr)) 1075 proportion[ii] = getMonitorCount(fname) 1076 summedMonCts += proportion[ii] 1077 endif 1078 endfor 1079 proportion /= summedMonCts 1058 1080 1059 1081 // loop over the (10) rows in the listWave … … 1080 1102 gam = NumberByKey("gamma", decayNote, "=", ",", 0) 1081 1103 err_gam = NumberByKey("err_gamma", decayNote, "=", ",", 0) 1104 Po = NumberByKey("P0", decayNote, "=", ",", 0) 1105 err_Po = NumberByKey("err_P0", decayNote, "=", ",", 0) 1082 1106 // get the elapsed time to calculate PCell at the current file time 1083 1107 t1str = getFileCreationDate(fname) … … 1086 1110 PCell = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t1,err_PCell) 1087 1111 1112 1113 1114 SVAR cellParamStr = $("root:Packages:NIST:Polarization:Cells:gCell_"+cellStr) 1115 1116 Pt = Calc_PHe_atT(Po,err_Po,gam,err_gam,t1,err_Pt) 1117 1118 Tmaj = Calc_Tmaj(cellParamStr,Pt,err_Pt,err_Tmaj) 1119 Tmin = Calc_Tmin(cellParamStr,Pt,err_Pt,err_Tmin) 1120 1121 // printf "File: %s\r",fname 1122 // printf "Elapsed time = %g hours\r",t1 1123 // printf "Pcell = %g\tTMaj = %g\tTmin = %g\r",PCell,(1+PCell)/2,(1-Pcell)/2 1124 // printf "\t\tRecalculated TMaj = %g\tTmin = %g\r",Tmaj,Tmin 1125 1088 1126 // get file info (monitor counts) 1089 monCts = getMonitorCount(fname) 1090 monCts /= 1e8 //to get a normalized value to add proportionally 1127 // monCts = getMonitorCount(fname) 1128 // monCts /= 1e8 //to get a normalized value to add proportionally 1129 1130 // use the proper proportion of each file to add to each row 1131 // monCts = proportion[ii] 1091 1132 1092 1133 Variable err_monCts … … 1101 1142 matA_err[row][] = 0 1102 1143 endif 1103 ea_uu = (1+Psm)/2 1104 ea_du = (1-Psm)/2 1105 ec_uu = (1+Pcell)/2 1106 ec_du = (1-Pcell)/2 1107 1108 matA[row][0] += ea_uu*ec_uu*monCts 1109 matA[row][1] += ea_du*ec_uu*monCts 1110 matA[row][2] += ea_du*ec_du*monCts 1111 matA[row][3] += ea_uu*ec_du*monCts 1144 // original version 1145 // ea_uu = (1+Psm)/2 1146 // ea_du = (1-Psm)/2 1147 // ec_uu = (1+Pcell)/2 1148 // ec_du = (1-Pcell)/2 1149 // 1150 // matA[row][0] += ea_uu*ec_uu*monCts 1151 // matA[row][1] += ea_du*ec_uu*monCts 1152 // matA[row][2] += ea_du*ec_du*monCts 1153 // matA[row][3] += ea_uu*ec_du*monCts 1154 // 1155 // matA_err[row][0] += (ea_uu*ec_uu*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1156 // matA_err[row][1] += (ea_du*ec_uu*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1157 // matA_err[row][2] += (ea_du*ec_du*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1158 // matA_err[row][3] += (ea_uu*ec_du*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1159 // end original version 1160 1161 // using Tmaj, Tmin calc from Po, not Pcell 1162 matA[row][0] += (1+Psm)*Tmaj*proportion[ii] 1163 matA[row][1] += (1-Psm)*Tmaj*proportion[ii] 1164 matA[row][2] += (1-Psm)*Tmin*proportion[ii] 1165 matA[row][3] += (1+Psm)*Tmin*proportion[ii] 1112 1166 1113 1167 // this seems to be too large... 1114 // matA_err[row][0] += (1/2*ec_uu*monCts)^2*err_Psm^2 + (1/2*ea_uu*monCts)^2*err_Pcell^2 1115 // matA_err[row][1] += (1/2*ec_uu*monCts)^2*err_Psm^2 + (1/2*ea_du*monCts)^2*err_Pcell^2 1116 // matA_err[row][2] += (1/2*ec_du*monCts)^2*err_Psm^2 + (1/2*ea_du*monCts)^2*err_Pcell^2 1117 // matA_err[row][3] += (1/2*ec_du*monCts)^2*err_Psm^2 + (1/2*ea_uu*monCts)^2*err_Pcell^2 1118 1119 matA_err[row][0] += (ea_uu*ec_uu*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1120 matA_err[row][1] += (ea_du*ec_uu*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1121 matA_err[row][2] += (ea_du*ec_du*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1122 matA_err[row][3] += (ea_uu*ec_du*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1123 1168 matA_err[row][0] += (Tmaj)^2*err_Psm^2 + (1+Psm)^2*err_Tmaj^2 1169 matA_err[row][1] += (Tmaj)^2*err_Psm^2 + (1-Psm)^2*err_Tmaj^2 1170 matA_err[row][2] += (Tmin)^2*err_Psm^2 + (1-Psm)^2*err_Tmin^2 1171 matA_err[row][3] += (Tmin)^2*err_Psm^2 + (1+Psm)^2*err_Tmin^2 1172 1124 1173 break 1125 1174 case "DU": … … 1129 1178 matA_err[row][] = 0 1130 1179 endif 1131 ea_ud = (1-PsmPf)/2 1132 ea_dd = (1+PsmPf)/2 1133 ec_uu = (1+Pcell)/2 1134 ec_du = (1-Pcell)/2 1135 1136 matA[row][0] += ea_ud*ec_uu*monCts 1137 matA[row][1] += ea_dd*ec_uu*monCts 1138 matA[row][2] += ea_dd*ec_du*monCts 1139 matA[row][3] += ea_ud*ec_du*monCts 1140 1141 // matA_err[row][0] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 1142 // matA_err[row][1] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 1143 // matA_err[row][2] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 1144 // matA_err[row][3] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 1145 1146 matA_err[row][0] += (ea_ud*ec_uu*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1147 matA_err[row][1] += (ea_dd*ec_uu*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1148 matA_err[row][2] += (ea_dd*ec_du*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1149 matA_err[row][3] += (ea_ud*ec_du*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1150 1180 // original version 1181 // ea_ud = (1-PsmPf)/2 1182 // ea_dd = (1+PsmPf)/2 1183 // ec_uu = (1+Pcell)/2 1184 // ec_du = (1-Pcell)/2 1185 // 1186 // matA[row][0] += ea_ud*ec_uu*monCts 1187 // matA[row][1] += ea_dd*ec_uu*monCts 1188 // matA[row][2] += ea_dd*ec_du*monCts 1189 // matA[row][3] += ea_ud*ec_du*monCts 1190 // 1191 // matA_err[row][0] += (ea_ud*ec_uu*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1192 // matA_err[row][1] += (ea_dd*ec_uu*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1193 // matA_err[row][2] += (ea_dd*ec_du*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1194 // matA_err[row][3] += (ea_ud*ec_du*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1195 // original version 1196 1197 // using Tmaj, Tmin calc from Po, not Pcell 1198 matA[row][0] += (1-PsmPf)*Tmaj*proportion[ii] 1199 matA[row][1] += (1+PsmPf)*Tmaj*proportion[ii] 1200 matA[row][2] += (1+PsmPf)*Tmin*proportion[ii] 1201 matA[row][3] += (1-PsmPf)*Tmin*proportion[ii] 1202 1203 // this seems to be too large... 1204 matA_err[row][0] += (Tmaj)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmaj^2 1205 matA_err[row][1] += (Tmaj)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmaj^2 1206 matA_err[row][2] += (Tmin)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmin^2 1207 matA_err[row][3] += (Tmin)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmin^2 1208 1209 1151 1210 break 1152 1211 case "DD": … … 1156 1215 matA_err[row][] = 0 1157 1216 endif 1158 ea_ud = (1-PsmPf)/2 1159 ea_dd = (1+PsmPf)/2 1160 ec_ud = (1-Pcell)/2 1161 ec_dd = (1+Pcell)/2 1162 1163 matA[row][0] += ea_ud*ec_ud*monCts 1164 matA[row][1] += ea_dd*ec_ud*monCts 1165 matA[row][2] += ea_dd*ec_dd*monCts 1166 matA[row][3] += ea_ud*ec_dd*monCts 1167 1168 // matA_err[row][0] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 1169 // matA_err[row][1] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 1170 // matA_err[row][2] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 1171 // matA_err[row][3] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 1172 1173 matA_err[row][0] += (ea_ud*ec_ud*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1174 matA_err[row][1] += (ea_dd*ec_ud*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1175 matA_err[row][2] += (ea_dd*ec_dd*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1176 matA_err[row][3] += (ea_ud*ec_dd*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1217 // original version 1218 // ea_ud = (1-PsmPf)/2 1219 // ea_dd = (1+PsmPf)/2 1220 // ec_ud = (1-Pcell)/2 1221 // ec_dd = (1+Pcell)/2 1222 // 1223 // matA[row][0] += ea_ud*ec_ud*monCts 1224 // matA[row][1] += ea_dd*ec_ud*monCts 1225 // matA[row][2] += ea_dd*ec_dd*monCts 1226 // matA[row][3] += ea_ud*ec_dd*monCts 1227 // 1228 // matA_err[row][0] += (ea_ud*ec_ud*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1229 // matA_err[row][1] += (ea_dd*ec_ud*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1230 // matA_err[row][2] += (ea_dd*ec_dd*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1231 // matA_err[row][3] += (ea_ud*ec_dd*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) 1232 // original version 1233 1234 // using Tmaj, Tmin calc from Po, not Pcell 1235 matA[row][0] += (1-PsmPf)*Tmin*proportion[ii] 1236 matA[row][1] += (1+PsmPf)*Tmin*proportion[ii] 1237 matA[row][2] += (1+PsmPf)*Tmaj*proportion[ii] 1238 matA[row][3] += (1-PsmPf)*Tmaj*proportion[ii] 1239 1240 // this seems to be too large... 1241 matA_err[row][0] += (Tmin)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmin^2 1242 matA_err[row][1] += (Tmin)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmin^2 1243 matA_err[row][2] += (Tmaj)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmaj^2 1244 matA_err[row][3] += (Tmaj)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmaj^2 1177 1245 1178 1246 break … … 1183 1251 matA_err[row][] = 0 1184 1252 endif 1185 ea_uu = (1+Psm)/2 1186 ea_du = (1-Psm)/2 1187 ec_ud = (1-Pcell)/2 1188 ec_dd = (1+Pcell)/2 1253 // original version 1254 // ea_uu = (1+Psm)/2 1255 // ea_du = (1-Psm)/2 1256 // ec_ud = (1-Pcell)/2 1257 // ec_dd = (1+Pcell)/2 1258 // 1259 // matA[row][0] += ea_uu*ec_ud*monCts 1260 // matA[row][1] += ea_du*ec_ud*monCts 1261 // matA[row][2] += ea_du*ec_dd*monCts 1262 // matA[row][3] += ea_uu*ec_dd*monCts 1263 // 1264 // matA_err[row][0] += (ea_uu*ec_ud*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1265 // matA_err[row][1] += (ea_du*ec_ud*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1266 // matA_err[row][2] += (ea_du*ec_dd*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1267 // matA_err[row][3] += (ea_uu*ec_dd*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1268 // original version 1269 1270 // using Tmaj, Tmin calc from Po, not Pcell 1271 matA[row][0] += (1+Psm)*Tmin*proportion[ii] 1272 matA[row][1] += (1-Psm)*Tmin*proportion[ii] 1273 matA[row][2] += (1-Psm)*Tmaj*proportion[ii] 1274 matA[row][3] += (1+Psm)*Tmaj*proportion[ii] 1275 1276 // this seems to be too large... 1277 matA_err[row][0] += (Tmin)^2*err_Psm^2 + (1+Psm)^2*err_Tmin^2 1278 matA_err[row][1] += (Tmin)^2*err_Psm^2 + (1-Psm)^2*err_Tmin^2 1279 matA_err[row][2] += (Tmaj)^2*err_Psm^2 + (1-Psm)^2*err_Tmaj^2 1280 matA_err[row][3] += (Tmaj)^2*err_Psm^2 + (1+Psm)^2*err_Tmaj^2 1189 1281 1190 matA[row][0] += ea_uu*ec_ud*monCts 1191 matA[row][1] += ea_du*ec_ud*monCts 1192 matA[row][2] += ea_du*ec_dd*monCts 1193 matA[row][3] += ea_uu*ec_dd*monCts 1194 1195 // matA_err[row][0] += (1/2*(1-Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1+Psm)/2*monCts)^2*err_Pcell^2 1196 // matA_err[row][1] += (1/2*(1-Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1-Psm)/2*monCts)^2*err_Pcell^2 1197 // matA_err[row][2] += (1/2*(1+Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1-Psm)/2*monCts)^2*err_Pcell^2 1198 // matA_err[row][3] += (1/2*(1+Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1+Psm)/2*monCts)^2*err_Pcell^2 1199 1200 matA_err[row][0] += (ea_uu*ec_ud*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1201 matA_err[row][1] += (ea_du*ec_ud*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1202 matA_err[row][2] += (ea_du*ec_dd*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1203 matA_err[row][3] += (ea_uu*ec_dd*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) 1204 1282 1205 1283 break 1206 1284 endswitch … … 1216 1294 // to switch based on pType... 1217 1295 1218 matA[row][0] /= fileCount1219 matA[row][1] /= fileCount1220 matA[row][2] /= fileCount1221 matA[row][3] /= fileCount1222 1223 matA_err[row][0] /= fileCount1224 matA_err[row][1] /= fileCount1225 matA_err[row][2] /= fileCount1226 matA_err[row][3] /= fileCount1296 // matA[row][0] /= fileCount 1297 // matA[row][1] /= fileCount 1298 // matA[row][2] /= fileCount 1299 // matA[row][3] /= fileCount 1300 // 1301 // matA_err[row][0] /= fileCount 1302 // matA_err[row][1] /= fileCount 1303 // matA_err[row][2] /= fileCount 1304 // matA_err[row][3] /= fileCount 1227 1305 1228 1306 SetDataFolder root: … … 1460 1538 DoPrompt "Change Display",dataType,scaling 1461 1539 1462 Display_4(dataType,scaling) 1463 1540 if(V_flag==0) //continue 1541 Display_4(dataType,scaling) 1542 endif 1464 1543 break 1465 1544 case -1: // control being killed … … 1486 1565 DoPrompt "Change Display",dataType,pType 1487 1566 1488 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType 1489 Execute str 1490 1567 if(V_flag==0) //continue 1568 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType 1569 Execute str 1570 endif 1491 1571 break 1492 1572 case -1: // control being killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r835 r836 279 279 case 2: // mouse up 280 280 // click code here 281 DoAlert 0,"Help for Cell Param Panel not written yet" 281 DisplayHelpTopic/Z/K=1 "Fundamental Cell Parameters" 282 if(V_flag !=0) 283 DoAlert 0,"The Cell Parameter Help file could not be found" 284 endif 282 285 break 283 286 case -1: // control being killed … … 471 474 String fname, t0str, condStr,noteStr,t1Str,cellStr 472 475 476 t0Str = "31-OCT-2012 19:30:00" 473 477 switch( ba.eventCode ) 474 478 case 2: // mouse up … … 491 495 Prompt gamma_val, "Enter gamma: " 492 496 Prompt err_gamma, "Enter err_gamma: " 493 Prompt runNum,"Run number for time=0 of decay" 494 DoPrompt "Enter Cell Decay Parameters", Po, err_Po, muPo, err_muPo, gamma_val, err_gamma, runNum 497 Prompt t0Str,"Enter the t=0 time DD-MMM-YYYY HH:MM:SS" 498 // Prompt runNum,"Run number for time=0 of decay" 499 DoPrompt "Enter Cell Decay Parameters", Po, err_Po, muPo, err_muPo, gamma_val, err_gamma, t0Str 495 500 if (V_Flag) 496 501 return -1 // User canceled 497 502 endif 498 499 fname = FindFileFromRunNumber(runNum) 500 t0str = getFileCreationDate(fname) 503 504 // enter the time as a string now, rather than from a run number 505 // fname = FindFileFromRunNumber(runNum) 506 // t0str = getFileCreationDate(fname) 501 507 502 508 // for the wave note … … 869 875 870 876 877 // calculate Tmin and its error 878 Function Calc_Tmin(cellStr,Po,err_Po,err_Tmin) 879 String cellStr 880 Variable Po,err_Po,&err_Tmin 881 882 Variable Tmin,arg 883 Variable Te,err_Te,mu,err_mu 884 // cell constants 885 Te = NumberByKey("Te", cellStr, "=", ",", 0) 886 err_Te = NumberByKey("err_Te", cellStr, "=", ",", 0) 887 mu = NumberByKey("mu", cellStr, "=", ",", 0) 888 err_mu = NumberByKey("err_mu", cellStr, "=", ",", 0) 889 890 Tmin = Te*exp(-mu*(1+Po)) 891 892 //the error 893 err_Tmin = (Tmin/Te)^2*err_Te^2 + (Tmin*(1+Po))^2*err_mu^2 + (Tmin*mu)^2*err_Po^2 894 err_Tmin = sqrt(err_Tmin) 895 896 Printf "Tmin = %g +/- %g (%g%)\r",Tmin,err_Tmin,err_Tmin/Tmin*100 897 898 899 return(Tmin) 900 End 901 902 903 871 904 // calculate PCell and its error 872 905 // … … 1282 1315 case 2: // mouse up 1283 1316 // click code here 1284 DoAlert 0,"Help for Cell Decay Panel not written yet" 1317 DisplayHelpTopic/Z/K=1 "Cell Decay Constant Panel" 1318 if(V_flag !=0) 1319 DoAlert 0,"The Cell Decay Help file could not be found" 1320 endif 1285 1321 break 1286 1322 case -1: // control being killed -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/RawWindowHook.ipf
r829 r836 112 112 //show the "next" buttons 113 113 //these buttons should only be available in RAW data type 114 Button backOne size={20,20},pos={350,23},proc=BackOneFileButtonProc,title="<"114 Button backOne win=SANS_Data,size={20,20},pos={350,23},proc=BackOneFileButtonProc,title="<" 115 115 Button backOne help={"Display the previous RAW data file run number"} 116 Button forwardOne size={20,20},pos={375,23},proc=ForwardOneFileButtonProc,title=">"116 Button forwardOne win=SANS_Data,size={20,20},pos={375,23},proc=ForwardOneFileButtonProc,title=">" 117 117 Button forwardOne help={"Display the next RAW data file run number"} 118 118 // 119 119 else 120 120 //kill them 121 KillControl backOne122 KillControl forwardOne121 KillControl/W=SANS_Data backOne 122 KillControl/W=SANS_Data forwardOne 123 123 Endif 124 124 125 125 //reset the slider values to 0,1 126 Slider loSlide ,value=0127 Slider hiSlide ,value=1126 Slider loSlide win=SANS_Data,value=0 127 Slider hiSlide win=SANS_Data,value=1 128 128 129 129 //remove old data and add new data to it … … 132 132 WAVE data = $(curPath + ":data") 133 133 WAVE NIHColors = $"root:myGlobals:NIHColors" 134 AppendImage data134 AppendImage/W=SANS_Data data 135 135 WaveStats/Q $(curPath + ":data") 136 136 if(cmpstr(cur_folder,"MSK")==0) 137 ModifyImage data ctab={0,1,BlueRedGreen,0}137 ModifyImage/W=SANS_Data data ctab={0,1,BlueRedGreen,0} 138 138 else 139 139 //Call the procedure that would normally be called if the sliders were moved … … 144 144 endif 145 145 //make the pixels square, color the backgrounds 146 ModifyGraph width={plan,1,bottom,left},mirror=0147 ModifyGraph axisenab(bottom)={0,0.7}148 ModifyGraph axOffset(left)=-3149 ModifyGraph standoff=0150 ModifyGraph wbRGB=(65535,54611,49151),gbRGB=(65535,54611,49151),cbRGB=(1,52428,52428)146 ModifyGraph/W=SANS_Data width={plan,1,bottom,left},mirror=0 147 ModifyGraph/W=SANS_Data axisenab(bottom)={0,0.7} 148 ModifyGraph/W=SANS_Data axOffset(left)=-3 149 ModifyGraph/W=SANS_Data standoff=0 150 ModifyGraph/W=SANS_Data wbRGB=(65535,54611,49151),gbRGB=(65535,54611,49151),cbRGB=(1,52428,52428) 151 151 152 152 //add the qx and qy axes … … 155 155 Set_Q_Axes(q_x_axis,q_y_axis,curPath) 156 156 RemoveFromGraph/Z q_x_axis,q_y_axis 157 AppendToGraph/ T q_x_axis158 AppendToGraph/ R=Right_Q q_y_axis //plot on a free axis, crossing at x=127 (pixelsX)159 ModifyGraph freePos(Right_q)={pixelsX-1,bottom}160 ModifyGraph minor(top)=1,minor(Right_Q)=1,lowTrip(top)=1e-05,lowTrip(Right_Q)=1e-05161 ModifyGraph mode(q_x_axis)=2,mode(q_y_axis)=2 //dots162 ModifyGraph axisEnab(top)={0,0.7}157 AppendToGraph/W=SANS_Data/T q_x_axis 158 AppendToGraph/W=SANS_Data/R=Right_Q q_y_axis //plot on a free axis, crossing at x=127 (pixelsX) 159 ModifyGraph/W=SANS_Data freePos(Right_q)={pixelsX-1,bottom} 160 ModifyGraph/W=SANS_Data minor(top)=1,minor(Right_Q)=1,lowTrip(top)=1e-05,lowTrip(Right_Q)=1e-05 161 ModifyGraph/W=SANS_Data mode(q_x_axis)=2,mode(q_y_axis)=2 //dots 162 ModifyGraph/W=SANS_Data axisEnab(top)={0,0.7} 163 163 164 164 //add the color bar 165 ColorScale/ N=colBar/A=RT/X=-3/Y=-1.5/Z=1 image=data, heightPct=100, widthPct=4,notation=1166 ColorScale/ C/N=colBar/B=(65535,60076,49151)165 ColorScale/W=SANS_Data/N=colBar/A=RT/X=-3/Y=-1.5/Z=1 image=data, heightPct=100, widthPct=4,notation=1 166 ColorScale/W=SANS_Data/C/N=colBar/B=(65535,60076,49151) 167 167 168 168 //update the displayed filename, using FileList in the current data folder … … 176 176 //always set to linear 177 177 //re-draw the data on the graph to make sure "data" from the current folder is being used 178 ControlInfo bisLog178 ControlInfo/W=SANS_Data bisLog 179 179 if(V_flag ==1) //if bisLog exists, this will return true 180 Button bisLog, title="isLin",rename=bisLin180 Button bisLog,win=SANS_Data,title="isLin",rename=bisLin 181 181 endif 182 182 //now that button state and data are sure to match (both are linear) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf
r824 r836 1217 1217 NVAR pixelsY = root:myGlobals:gNPixelsY 1218 1218 1219 WAVE/Z data1=$("root:Packages:NIST:"+workMathStr+"File_1: data")1219 WAVE/Z data1=$("root:Packages:NIST:"+workMathStr+"File_1:linear_data") 1220 1220 WAVE/Z err1=$("root:Packages:NIST:"+workMathStr+"File_1:linear_data_error") 1221 1221 … … 1230 1230 //Load set #2 1231 1231 Load_NamedASC_File(pathStr+str2,workMathStr+"File_2") 1232 WAVE/Z data2=$("root:Packages:NIST:"+workMathStr+"File_2: data")1232 WAVE/Z data2=$("root:Packages:NIST:"+workMathStr+"File_2:linear_data") 1233 1233 WAVE/Z err2=$("root:Packages:NIST:"+workMathStr+"File_2:linear_data_error") 1234 1234 Endif … … 1237 1237 1238 1238 //now that we know that data exists, convert each of the operands to linear scale 1239 ConvertFolderToLinearScale(workMathStr+"File_1") 1240 If(cmpstr(str2,"UNIT MATRIX")!=0) 1241 ConvertFolderToLinearScale(workMathStr+"File_2") //don't need to convert unit matrix to linear 1242 endif 1239 // ConvertFolderToLinearScale(workMathStr+"File_1") 1240 // If(cmpstr(str2,"UNIT MATRIX")!=0) 1241 // ConvertFolderToLinearScale(workMathStr+"File_2") //don't need to convert unit matrix to linear 1242 // endif 1243 1243 1244 //copy contents of str1 folder to dest and create the wave ref (it will exist) 1244 1245 CopyWorkContents(workMathStr+"File_1",workMathStr+dest) 1245 WAVE/Z destData=$("root:Packages:NIST:"+workMathStr+dest+":data") 1246 WAVE/Z destData=$("root:Packages:NIST:"+workMathStr+dest+":linear_data") 1247 WAVE/Z destData_log=$("root:Packages:NIST:"+workMathStr+dest+":data") 1246 1248 WAVE/Z destErr=$("root:Packages:NIST:"+workMathStr+dest+":linear_data_error") 1247 1249 … … 1270 1272 endswitch 1271 1273 1274 destData_log = log(destData) //for display 1272 1275 //show the result 1273 1276 WorkMath_Display_PopMenuProc("",0,"Result") 1277 1278 PopupMenu popup4 win=WorkFileMath,mode=3 //3rd item selected == Result 1274 1279 End 1275 1280 … … 1338 1343 // if file1 or file2, load in the data and display 1339 1344 if(cmpstr(popStr,"File_1")==0) 1340 ControlInfo popup01345 ControlInfo/W=WorkFileMath popup0 1341 1346 str1 = S_Value 1342 1347 Endif 1343 1348 if(cmpstr(popStr,"File_2")==0) 1344 ControlInfo popup11349 ControlInfo/W=WorkFileMath popup1 1345 1350 str1 = S_Value 1346 1351 Endif
Note: See TracChangeset
for help on using the changeset viewer.