Ignore:
Timestamp:
Feb 17, 2012 12:04:13 PM (11 years ago)
Author:
srkline
Message:

changes to FFT routines to clean things up for a beta release at the next startup. No functionality changes, just cleaning up the operation, interface, and menu items.

Some important changes to the polarization routines. New equations for calculating the coefficient matrix. Now appears to be correct. Also, proper proportions are used when adding multiple files together to the matrix.

Change to the Model Docs is an updated reference.

WorkFileUtils? was broken when I changed to use linear_data exclusively. This has now been fixed and it operates as expected.

PackageLoader? now has menu items (under Macros) for the Polarization routines. These may later be moved to the SANS menu.

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  
    605605end 
    606606 
    607  
    608  
     607// 
     608// calculate the (atomic) He polarization at some delta time 
     609// 
     610// t2 is in hours, gamma in hours 
     611// 
     612Function 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) 
     629End 
     630 
     631 
     632 
     633// 
    609634// t2 is in hours, muP0 is at t0 
    610635// 
     
    615640        Variable Pcell 
    616641 
    617  
    618642        PCell = tanh(muPo * exp(-t2/gam)) 
     643//      PCell = (muPo * exp(-t2/gam)) 
    619644         
    620645        Variable arg,tmp2 
     
    627652         
    628653        Printf "At t=%g  Pcell = %g +/- %g (%g%)\r",t2,Pcell,err_Pcell,err_Pcell/PCell*100 
    629  
    630  
    631654 
    632655        return(PCell) 
     
    762785                case 2: // mouse up 
    763786                        // 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 
    765791                        break 
    766792                case -1: // control being killed 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf

    r835 r836  
    775775                case 2: // mouse up 
    776776                        // 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 
    778781                        break 
    779782                case -1: // control being killed 
     
    10171020        Variable row,Psm, PsmPf, PCell,err_Psm, err_PsmPf, err_PCell 
    10181021        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 
    10191023 
    10201024        Variable ea_uu, ea_ud, ea_dd, ea_du 
     
    10561060        err_PsmPf = NumberByKey("err_P_sm_f", condNote, "=", ",", 0) 
    10571061 
     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 
    10581080 
    10591081        // loop over the (10) rows in the listWave 
     
    10801102                        gam = NumberByKey("gamma", decayNote, "=", ",", 0) 
    10811103                        err_gam = NumberByKey("err_gamma", decayNote, "=", ",", 0) 
     1104                        Po = NumberByKey("P0", decayNote, "=", ",", 0) 
     1105                        err_Po = NumberByKey("err_P0", decayNote, "=", ",", 0) 
    10821106                        // get the elapsed time to calculate PCell at the current file time 
    10831107                        t1str = getFileCreationDate(fname) 
     
    10861110                        PCell = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t1,err_PCell) 
    10871111                         
     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                                                 
    10881126                        // 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] 
    10911132                         
    10921133                        Variable err_monCts 
     
    11011142                                                matA_err[row][] = 0 
    11021143                                        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] 
    11121166 
    11131167// 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                                                 
    11241173                                        break 
    11251174                                case "DU":               
     
    11291178                                                matA_err[row][] = 0 
    11301179                                        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 
    11511210                                        break    
    11521211                                case "DD":               
     
    11561215                                                matA_err[row][] = 0 
    11571216                                        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 
    11771245                                                                                 
    11781246                                        break                                            
     
    11831251                                                matA_err[row][] = 0 
    11841252                                        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 
    11891281                                         
    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                                                                                                                 
    12051283                                        break 
    12061284                        endswitch 
     
    12161294// to switch based on pType... 
    12171295         
    1218         matA[row][0] /= fileCount 
    1219         matA[row][1] /= fileCount 
    1220         matA[row][2] /= fileCount 
    1221         matA[row][3] /= fileCount        
    1222          
    1223         matA_err[row][0] /= fileCount 
    1224         matA_err[row][1] /= fileCount 
    1225         matA_err[row][2] /= fileCount 
    1226         matA_err[row][3] /= fileCount    
     1296//      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    
    12271305                                 
    12281306        SetDataFolder root: 
     
    14601538                        DoPrompt "Change Display",dataType,scaling 
    14611539                         
    1462                         Display_4(dataType,scaling) 
    1463                          
     1540                        if(V_flag==0)           //continue 
     1541                                Display_4(dataType,scaling) 
     1542                        endif                    
    14641543                        break 
    14651544                case -1: // control being killed 
     
    14861565                        DoPrompt "Change Display",dataType,pType 
    14871566                         
    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 
    14911571                        break 
    14921572                case -1: // control being killed 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf

    r835 r836  
    279279                case 2: // mouse up 
    280280                        // 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 
    282285                        break 
    283286                case -1: // control being killed 
     
    471474        String fname, t0str, condStr,noteStr,t1Str,cellStr 
    472475 
     476        t0Str = "31-OCT-2012 19:30:00" 
    473477        switch( ba.eventCode ) 
    474478                case 2: // mouse up 
     
    491495                        Prompt gamma_val, "Enter gamma: "                
    492496                        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 
    495500                        if (V_Flag) 
    496501                                return -1                                                               // User canceled 
    497502                        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) 
    501507                                         
    502508//              for the wave note 
     
    869875 
    870876 
     877// calculate Tmin and its error 
     878Function 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) 
     900End 
     901 
     902 
     903 
    871904// calculate PCell and its error 
    872905// 
     
    12821315                case 2: // mouse up 
    12831316                        // 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 
    12851321                        break 
    12861322                case -1: // control being killed 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/RawWindowHook.ipf

    r829 r836  
    112112                //show the "next" buttons 
    113113                //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="<" 
    115115                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=">" 
    117117                Button forwardOne help={"Display the next RAW data file run number"} 
    118118                // 
    119119        else 
    120120                //kill them 
    121                 KillControl backOne 
    122                 KillControl forwardOne 
     121                KillControl/W=SANS_Data backOne 
     122                KillControl/W=SANS_Data forwardOne 
    123123        Endif 
    124124         
    125125        //reset the slider values to 0,1 
    126         Slider loSlide,value=0 
    127         Slider hiSlide,value=1 
     126        Slider loSlide win=SANS_Data,value=0 
     127        Slider hiSlide win=SANS_Data,value=1 
    128128         
    129129        //remove old data and add new data to it 
     
    132132        WAVE data = $(curPath + ":data") 
    133133        WAVE NIHColors = $"root:myGlobals:NIHColors" 
    134         AppendImage data 
     134        AppendImage/W=SANS_Data data 
    135135   WaveStats/Q $(curPath + ":data") 
    136136   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} 
    138138   else 
    139139        //Call the procedure that would normally be called if the sliders were moved 
     
    144144        endif 
    145145        //make the pixels square, color the backgrounds 
    146         ModifyGraph width={plan,1,bottom,left},mirror=0 
    147         ModifyGraph axisenab(bottom)={0,0.7} 
    148         ModifyGraph axOffset(left)=-3 
    149         ModifyGraph standoff=0 
    150         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) 
    151151         
    152152        //add the qx and qy axes 
     
    155155        Set_Q_Axes(q_x_axis,q_y_axis,curPath) 
    156156        RemoveFromGraph/Z q_x_axis,q_y_axis 
    157         AppendToGraph/T q_x_axis 
    158         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-05 
    161         ModifyGraph mode(q_x_axis)=2,mode(q_y_axis)=2           //dots 
    162         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} 
    163163 
    164164        //add the color bar 
    165         ColorScale/N=colBar/A=RT/X=-3/Y=-1.5/Z=1 image=data, heightPct=100, widthPct=4,notation=1 
    166         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) 
    167167         
    168168        //update the displayed filename, using FileList in the current data folder 
     
    176176        //always set to linear 
    177177        //re-draw the data on the graph to make sure "data" from the current folder is being used 
    178         ControlInfo bisLog 
     178        ControlInfo/W=SANS_Data bisLog 
    179179        if(V_flag ==1)  //if bisLog exists, this will return true 
    180                 Button bisLog,title="isLin",rename=bisLin 
     180                Button bisLog,win=SANS_Data,title="isLin",rename=bisLin 
    181181        endif 
    182182        //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  
    12171217        NVAR pixelsY = root:myGlobals:gNPixelsY 
    12181218         
    1219         WAVE/Z data1=$("root:Packages:NIST:"+workMathStr+"File_1:data") 
     1219        WAVE/Z data1=$("root:Packages:NIST:"+workMathStr+"File_1:linear_data") 
    12201220        WAVE/Z err1=$("root:Packages:NIST:"+workMathStr+"File_1:linear_data_error") 
    12211221         
     
    12301230                //Load set #2 
    12311231                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") 
    12331233                WAVE/Z err2=$("root:Packages:NIST:"+workMathStr+"File_2:linear_data_error") 
    12341234        Endif 
     
    12371237         
    12381238        //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 
    12431244        //copy contents of str1 folder to dest and create the wave ref (it will exist) 
    12441245        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") 
    12461248        WAVE/Z destErr=$("root:Packages:NIST:"+workMathStr+dest+":linear_data_error") 
    12471249         
     
    12701272        endswitch 
    12711273         
     1274        destData_log = log(destData)            //for display 
    12721275        //show the result 
    12731276        WorkMath_Display_PopMenuProc("",0,"Result") 
     1277         
     1278        PopupMenu popup4 win=WorkFileMath,mode=3                //3rd item selected == Result 
    12741279End 
    12751280 
     
    13381343        // if file1 or file2, load in the data and display 
    13391344        if(cmpstr(popStr,"File_1")==0) 
    1340                 ControlInfo popup0 
     1345                ControlInfo/W=WorkFileMath popup0 
    13411346                str1 = S_Value 
    13421347        Endif 
    13431348        if(cmpstr(popStr,"File_2")==0) 
    1344                 ControlInfo popup1 
     1349                ControlInfo/W=WorkFileMath popup1 
    13451350                str1 = S_Value 
    13461351        Endif 
Note: See TracChangeset for help on using the changeset viewer.