- Timestamp:
- Apr 18, 2012 1:14:45 PM (11 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
r836 r851 6 6 // 7 7 // -3-Flipper efficiency 8 9 10 11 // **** search for TODO to find items still to be fixed in other procedures ********** 12 8 13 9 14 … … 388 393 389 394 // do the calculations: 390 391 Print "The Blocked CR is not rescaled to zero attenuators"392 395 cr1 = TotalCR_FromRun(w[selRow][%UU_Trans],err_cr1,0) 393 396 cr2 = TotalCR_FromRun(w[selRow][%DU_Trans],err_cr2,0) … … 395 398 cr4 = TotalCR_FromRun(w[selRow][%UD_Trans],err_cr4,0) 396 399 // cr5 = TotalCR_FromRun(w[selRow][%Blocked],err_cr5,1) //blocked beam is NOT normalized to zero attenuators 397 cr5 = TotalCR_FromRun(w[selRow][%Blocked],err_cr5,0) //blocked beam is NOT normalized to zero attenuators 400 // Print "The Blocked CR is *NOT* rescaled to zero attenuators -- FlipperAverageButtonProc" 401 cr5 = TotalCR_FromRun(w[selRow][%Blocked],err_cr5,0) //blocked beam is normalized to zero attenuators 402 Print "The Blocked CR *IS* rescaled to zero attenuators -- FlipperAverageButtonProc" 398 403 399 404 calc[selRow][%cr_UU] = cr1 … … 469 474 // gCellKW passed in has gamma, muPo, etc. needed for PCell(t) calculation 470 475 // 471 // these are not the equations that Kaythrn gave to me, but rather 472 // equations 14 and 15 from the SS handout. These replacement equations 473 // are in terms of relative transmissions, so I can use count rates 474 // otherwise, I don't know how to calculate a transmission -- I don't know what 475 // the "empty beam" condition is... 476 // 476 // TODO: 477 477 // this is only using the measurement at t1 for the calculation! 478 // -- do I need to recalculate at the midpoint of the time interval? 479 // -- then how do I define the beginning and ending time? 478 480 // 479 481 Function Calc_PsmPf(w,calc,gCellKW,selRow,err_PsmPf) … … 539 541 // gCellKW passed in has gamma, muPo, etc. needed for PCell(t) calculation 540 542 // 541 // these are not the equations that Kaythrn gave to me, but rather 542 // equations 14 and 15 from the SS handout. These replacement equations 543 // are in terms of relative transmissions, so I can use count rates 544 // otherwise, I don't know how to calculate a transmission -- I don't know what 545 // the "empty beam" condition is... 546 // 543 // TODO: 547 544 // this is only using the measurement at t1 for the calculation! 545 // -- do I need to recalculate at the midpoint of the time interval? 546 // -- then how do I define the beginning and ending time? 547 // 548 548 // 549 549 Function Calc_Psm(w,calc,gCellKW,selRow,err_Psm) … … 906 906 // do a check of the elapsed time from start to finish 907 907 908 909 910 911 908 if( (sdd1 != sdd2) || (sdd2 != sdd3) || (sdd1 != sdd3) ) 912 909 DoAlert 0,"Files in row "+num2str(selRow)+" are not all at the same detector distance" … … 914 911 endif 915 912 916 917 918 919 913 920 914 if( (atten1 != atten2) || (atten2 != atten3) || (atten1 != atten3) ) 921 915 DoAlert 0,"Files in row "+num2str(selRow)+" are not all collected with the same attenuation. Just so you know." -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
r836 r851 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 3 4 // **** search for TODO to find items still to be fixed in other procedures ********** 5 2 6 3 7 // These procedures and calculations duplicate the work of K. Krycka and WC Chen … … 20 24 // - each of the calculations based on transmissions will need to have errors 21 25 // brought in, and carried through the calculations. Some will be simple, some 22 // will probably be easiest w ithexpansions.26 // will probably be easiest written as expansions. 23 27 // 24 28 … … 42 46 // -- this can be tricky with rescaling for time, and adding to the proper row of the 43 47 // coefficient matrix. I'll need to re-read either the monitor or the time from the header 44 // of each file that was added 48 // of each file that was added so that the contributions are added to the matrix in correct proportion 45 49 // 46 50 // Then everything is set to do the inversion. … … 53 57 // 54 58 // 59 60 // **** search for TODO to find items still to be fixed in other procedures ********** 61 55 62 // 56 63 // TODO: 57 // - need a better way of flowing through the process, to be sure that values are set64 // - Overall, I need a better way of flowing through the whole process, to be sure that values are set 58 65 // as needed and that one step won't fail because a previous step wasn't done yet. Combining the 59 66 // first three panels into one w/ tabs would help a lot, but that is rather complex to implement. … … 68 75 // -- When multiple files are added together, there are changes made to the RealsRead (monCts, etc.). Are these 69 76 // properly made, and then properly copied to the "_UU", and then properly copied back to the untagged waves 70 // for use in the reduction? 77 // for use in the reduction? (now at this later date, I don't understand this question...) 71 78 // 72 79 … … 247 254 // X- need a way of saving the "protocol" since the setup is so complex. 248 255 // - generate a report of the setup. 249 // - 4-panel display (maybe a layout with labels?) Maybe a panel with 4 subwindows. Can I use color bars in them?256 // X- 4-panel display (maybe a layout with labels?) Maybe a panel with 4 subwindows. Can I use color bars in them? 250 257 // 251 258 // … … 790 797 // loads the specified type of data (SAM, EMP, BGD) based on the active tab 791 798 // loads either specified spin type or all four 792 // (( now, defaults to trying to load ALL four data spin states )) 793 // - I'll have to fix this later if only 2 of the four are needed 799 // 794 800 // -- during loading, the proper row of the PolMatrix is filled, based on pType 795 801 // … … 798 804 // -the error in the PolMatrix is calculated 799 805 // -the error in Inv_PolMatrix is calculated 806 // 807 // TODO: 808 // (( now, defaults to trying to load ALL four data spin states )) 809 // - I'll have to fix this later if only 2 of the four are needed 800 810 // 801 811 Function LoadRawPolarizedButton(ba) : ButtonControl … … 871 881 872 882 Inv_PolMatrix_err = sqrt(Inv_PolMatrix_err) 873 874 883 875 884 endif 876 877 878 885 879 886 SetDataFolder root: … … 1008 1015 // UD = 3 1009 1016 // 1017 // 1018 // TODO: 1010 1019 // -- check all of the math 1011 // not yet using the midpoint time 1020 // -- not yet using the midpoint time, even though it is passed in (?) 1021 // exactly where in the math would I use the time midpoint? The midpoint passed in is the 1022 // midpoint of all of the files in the list. Individual contributions to the matrix are here 1023 // calculated at the (start) time of each file. So is a midpoint really necessary? 1012 1024 // 1013 1025 // -- the PolMatrix_err returned from here is the squared error! … … 1165 1177 matA[row][3] += (1+Psm)*Tmin*proportion[ii] 1166 1178 1167 // this seems to be too large... 1168 matA_err[row][0] += (Tmaj)^2*err_Psm^2 + (1+Psm)^2*err_Tmaj^21169 matA_err[row][1] += (Tmaj)^2*err_Psm^2 + (1-Psm)^2*err_Tmaj^21170 matA_err[row][2] += (Tmin)^2*err_Psm^2 + (1-Psm)^2*err_Tmin^21171 matA_err[row][3] += (Tmin)^2*err_Psm^2 + (1+Psm)^2*err_Tmin^21179 // this seems to be too large... do I need to add the errors in proportion too? squared? 1180 matA_err[row][0] += proportion[ii]*( (Tmaj)^2*err_Psm^2 + (1+Psm)^2*err_Tmaj^2 ) 1181 matA_err[row][1] += proportion[ii]*( (Tmaj)^2*err_Psm^2 + (1-Psm)^2*err_Tmaj^2 ) 1182 matA_err[row][2] += proportion[ii]*( (Tmin)^2*err_Psm^2 + (1-Psm)^2*err_Tmin^2 ) 1183 matA_err[row][3] += proportion[ii]*( (Tmin)^2*err_Psm^2 + (1+Psm)^2*err_Tmin^2 ) 1172 1184 1173 1185 break … … 1201 1213 matA[row][3] += (1-PsmPf)*Tmin*proportion[ii] 1202 1214 1203 // this seems to be too large... 1204 matA_err[row][0] += (Tmaj)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmaj^21205 matA_err[row][1] += (Tmaj)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmaj^21206 matA_err[row][2] += (Tmin)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmin^21207 matA_err[row][3] += (Tmin)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmin^21215 // this seems to be too large... do I need to add the errors in proportion too? squared? 1216 matA_err[row][0] += proportion[ii]*( (Tmaj)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmaj^2 ) 1217 matA_err[row][1] += proportion[ii]*( (Tmaj)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmaj^2 ) 1218 matA_err[row][2] += proportion[ii]*( (Tmin)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmin^2 ) 1219 matA_err[row][3] += proportion[ii]*( (Tmin)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmin^2 ) 1208 1220 1209 1221 … … 1238 1250 matA[row][3] += (1-PsmPf)*Tmaj*proportion[ii] 1239 1251 1240 // this seems to be too large... 1241 matA_err[row][0] += (Tmin)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmin^21242 matA_err[row][1] += (Tmin)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmin^21243 matA_err[row][2] += (Tmaj)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmaj^21244 matA_err[row][3] += (Tmaj)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmaj^21252 // this seems to be too large... do I need to add the errors in proportion too? squared? 1253 matA_err[row][0] += proportion[ii]*( (Tmin)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmin^2 ) 1254 matA_err[row][1] += proportion[ii]*( (Tmin)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmin^2 ) 1255 matA_err[row][2] += proportion[ii]*( (Tmaj)^2*err_PsmPf^2 + (1+PsmPf)^2*err_Tmaj^2 ) 1256 matA_err[row][3] += proportion[ii]*( (Tmaj)^2*err_PsmPf^2 + (1-PsmPf)^2*err_Tmaj^2 ) 1245 1257 1246 1258 break … … 1274 1286 matA[row][3] += (1+Psm)*Tmaj*proportion[ii] 1275 1287 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 1281 1282 1288 // this seems to be too large... do I need to add the errors in proportion too? squared? 1289 matA_err[row][0] += proportion[ii]*( (Tmin)^2*err_Psm^2 + (1+Psm)^2*err_Tmin^2 ) 1290 matA_err[row][1] += proportion[ii]*( (Tmin)^2*err_Psm^2 + (1-Psm)^2*err_Tmin^2 ) 1291 matA_err[row][2] += proportion[ii]*( (Tmaj)^2*err_Psm^2 + (1-Psm)^2*err_Tmaj^2 ) 1292 matA_err[row][3] += proportion[ii]*( (Tmaj)^2*err_Psm^2 + (1+Psm)^2*err_Tmaj^2 ) 1293 1283 1294 break 1284 1295 endswitch 1285 1296 1286 1287 1297 endif 1288 1298 endfor … … 1290 1300 // can't take the SQRT here, since the matrix won't necessarily be full yet, 1291 1301 1292 // but now need to re-normalize the row based on the number of files that were added1293 // pType has only one value as passed in, so the row has already been set. It would be more correct1294 // to switch based on pType...1295 1296 // matA[row][0] /= fileCount1297 // matA[row][1] /= fileCount1298 // matA[row][2] /= fileCount1299 // matA[row][3] /= fileCount1300 //1301 // matA_err[row][0] /= fileCount1302 // matA_err[row][1] /= fileCount1303 // matA_err[row][2] /= fileCount1304 // matA_err[row][3] /= fileCount1305 1306 1302 SetDataFolder root: 1307 1303 return(0) … … 2246 2242 // at a first pass, uses the regular reduction protocol SaveProtocolButton(ctrlName) 2247 2243 // 2248 // -- won't work, as it uses the MakeProtocolFromPanel function... so replace this 2244 // TODO 2245 // X- won't work, as it uses the MakeProtocolFromPanel function... so replace this 2249 2246 // 2250 2247 Function SavePolCorProtocolButton(ctrlName) : ButtonControl -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r836 r851 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 2 3 4 5 // **** search for TODO to find items still to be fixed in other procedures ********** 3 6 4 7 // TODO: … … 753 756 // 1 for each file, return the count rate and err_CR (normalize to atten or not) 754 757 755 Print "************The Blocked CR *is* rescaled to zero attenuators -- "756 758 cr1 = TotalCR_FromRun(w[selRow][%Trans_He_In],err_cr1,0) 757 759 cr2 = TotalCR_FromRun(w[selRow][%Trans_He_Out],err_cr2,0) 758 760 // cr3 = TotalCR_FromRun(w[selRow][%Blocked],err_cr3,1) //blocked beam is NOT normalized to zero attenuators 759 cr3 = TotalCR_FromRun(w[selRow][%Blocked],err_cr3,0) //blocked beam is NOT normalized to zero attenuators 760 761 // Print "************The Blocked CR is *NOT* rescaled to zero attenuators -- CalcRowParamButton" 762 cr3 = TotalCR_FromRun(w[selRow][%Blocked],err_cr3,0) //blocked beam is normalized to zero attenuators 763 Print "************The Blocked CR *is* rescaled to zero attenuators -- CalcRowParamButton " 764 765 761 766 calc[selRow][%CR_Trans_He_In] = cr1 762 767 calc[selRow][%CR_Trans_He_Out] = cr2 … … 995 1000 //End 996 1001 997 // calculate the total detector CR an eits error.1002 // calculate the total detector CR and its error. 998 1003 // 999 1004 // the result is automatically normalized to 10^8 monitor counts, and to zero attenuators
Note: See TracChangeset
for help on using the changeset viewer.