Changeset 851


Ignore:
Timestamp:
Apr 18, 2012 1:14:45 PM (10 years ago)
Author:
srkline
Message:

simply added some comments to the polarization files. No code changes.

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  
    66// 
    77// -3-Flipper efficiency 
     8 
     9 
     10 
     11// **** search for TODO to find items still to be fixed in other procedures  ********** 
     12 
    813 
    914 
     
    388393                                         
    389394                                        // do the calculations: 
    390                  
    391                                         Print "The Blocked CR is not rescaled to zero attenuators" 
    392395                                        cr1 = TotalCR_FromRun(w[selRow][%UU_Trans],err_cr1,0) 
    393396                                        cr2 = TotalCR_FromRun(w[selRow][%DU_Trans],err_cr2,0) 
     
    395398                                        cr4 = TotalCR_FromRun(w[selRow][%UD_Trans],err_cr4,0) 
    396399//                                      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" 
    398403         
    399404                                        calc[selRow][%cr_UU] = cr1 
     
    469474// gCellKW passed in has gamma, muPo, etc. needed for PCell(t) calculation 
    470475// 
    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: 
    477477//  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? 
    478480// 
    479481Function Calc_PsmPf(w,calc,gCellKW,selRow,err_PsmPf) 
     
    539541// gCellKW passed in has gamma, muPo, etc. needed for PCell(t) calculation 
    540542// 
    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: 
    547544//  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// 
    548548// 
    549549Function Calc_Psm(w,calc,gCellKW,selRow,err_Psm) 
     
    906906        // do a check of the elapsed time from start to finish 
    907907         
    908          
    909          
    910          
    911908        if( (sdd1 != sdd2) || (sdd2 != sdd3) || (sdd1 != sdd3) ) 
    912909                DoAlert 0,"Files in row "+num2str(selRow)+" are not all at the same detector distance" 
     
    914911        endif 
    915912         
    916          
    917          
    918          
    919          
     913 
    920914        if( (atten1 != atten2) || (atten2 != atten3) || (atten1 != atten3) ) 
    921915                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  
    11#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 
    26 
    37// These procedures and calculations duplicate the work of K. Krycka and WC Chen 
     
    2024// - each of the calculations based on transmissions will need to have errors 
    2125// brought in, and carried through the calculations. Some will be simple, some 
    22 // will probably be easiest with expansions. 
     26// will probably be easiest written as expansions. 
    2327// 
    2428 
     
    4246// -- this can be tricky with rescaling for time, and adding to the proper row of the  
    4347// 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 
    4549// 
    4650// Then everything is set to do the inversion. 
     
    5357// 
    5458// 
     59 
     60// **** search for TODO to find items still to be fixed in other procedures  ********** 
     61 
    5562// 
    5663// TODO: 
    57 // - need a better way of flowing through the process, to be sure that values are set 
     64// - Overall, I need a better way of flowing through the whole process, to be sure that values are set 
    5865// as needed and that one step won't fail because a previous step wasn't done yet. Combining the 
    5966// first three panels into one w/ tabs would help a lot, but that is rather complex to implement. 
     
    6875// -- When multiple files are added together, there are changes made to the RealsRead (monCts, etc.). Are these 
    6976//              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...) 
    7178// 
    7279 
     
    247254// X- need a way of saving the "protocol" since the setup is so complex. 
    248255// - 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? 
    250257// 
    251258// 
     
    790797// loads the specified type of data (SAM, EMP, BGD) based on the active tab 
    791798// 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// 
    794800//  -- during loading, the proper row of the PolMatrix is filled, based on pType 
    795801// 
     
    798804//              -the error in the PolMatrix is calculated 
    799805//              -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 
    800810// 
    801811Function LoadRawPolarizedButton(ba) : ButtonControl 
     
    871881                                 
    872882                                Inv_PolMatrix_err = sqrt(Inv_PolMatrix_err) 
    873          
    874883                                 
    875884                        endif 
    876          
    877          
    878885         
    879886                        SetDataFolder root: 
     
    10081015//      UD = 3 
    10091016// 
     1017// 
     1018// TODO: 
    10101019// -- 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? 
    10121024// 
    10131025// -- the PolMatrix_err returned from here is the squared error! 
     
    11651177                                        matA[row][3] += (1+Psm)*Tmin*proportion[ii] 
    11661178 
    1167 // this seems to be too large... 
    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 
     1179// 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 ) 
    11721184                                                 
    11731185                                        break 
     
    12011213                                        matA[row][3] += (1-PsmPf)*Tmin*proportion[ii] 
    12021214 
    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 
     1215// 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 ) 
    12081220 
    12091221 
     
    12381250                                        matA[row][3] += (1-PsmPf)*Tmaj*proportion[ii] 
    12391251 
    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 
     1252// 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 ) 
    12451257                                                                                 
    12461258                                        break                                            
     
    12741286                                        matA[row][3] += (1+Psm)*Tmaj*proportion[ii] 
    12751287 
    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                                                                                                                                                         
    12831294                                        break 
    12841295                        endswitch 
    12851296 
    1286                          
    12871297                endif 
    12881298        endfor 
     
    12901300// can't take the SQRT here, since the matrix won't necessarily be full yet,  
    12911301         
    1292 // but now need to re-normalize the row based on the number of files that were added 
    1293 // pType has only one value as passed in, so the row has already been set. It would be more correct 
    1294 // to switch based on pType... 
    1295          
    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    
    1305                                  
    13061302        SetDataFolder root: 
    13071303        return(0) 
     
    22462242// at a first pass, uses the regular reduction protocol         SaveProtocolButton(ctrlName) 
    22472243// 
    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 
    22492246// 
    22502247Function SavePolCorProtocolButton(ctrlName) : ButtonControl 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf

    r836 r851  
    11#pragma rtGlobals=1             // Use modern global access method. 
    22 
     3 
     4 
     5// **** search for TODO to find items still to be fixed in other procedures  ********** 
    36 
    47// TODO: 
     
    753756                                // 1 for each file, return the count rate and err_CR (normalize to atten or not) 
    754757         
    755                                 Print "************The Blocked CR *is* rescaled to zero attenuators -- " 
    756758                                cr1 = TotalCR_FromRun(w[selRow][%Trans_He_In],err_cr1,0) 
    757759                                cr2 = TotalCR_FromRun(w[selRow][%Trans_He_Out],err_cr2,0) 
    758760//                              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 
    761766                                calc[selRow][%CR_Trans_He_In] = cr1 
    762767                                calc[selRow][%CR_Trans_He_Out] = cr2 
     
    9951000//End 
    9961001 
    997 // calculate the total detector CR ane its error. 
     1002// calculate the total detector CR and its error. 
    9981003// 
    9991004// the result is automatically normalized to 10^8 monitor counts, and to zero attenuators 
Note: See TracChangeset for help on using the changeset viewer.