Ignore:
Timestamp:
Feb 6, 2012 12:19:28 PM (11 years ago)
Author:
srkline
Message:

moving the Polarization routines to a temporary "beta" menu location on the macros menu, numbering the panels.

Created a loader for the polarization routines that will load the SANS reduction if needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf

    r832 r835  
    33 
    44// TODO: 
    5 // - on the decay panel. need to be able to manually enter a date that is to or an offset 
     5// x- on the decay panel. need to be able to manually enter a date that is to or an offset 
    66//              number of hours. currently it takes the first file as t=0, which is often not correct 
    77// 
     
    1616// -1- Fundamental Cell Parameters -- these are constants, generally not editable. (this file) 
    1717// -2- Decay Parameters -- these are fitted values based on transmission mearurements (this file) 
    18 // -3- Flipper Panel is in its own procedure (FlipperPanel.ipf) 
    19 // -4- PolCor_Panel is in PolarizationCorrection.ipf 
    20  
     18// -3- Flipper Panel is in its own procedure (Pol_FlipperPanel.ipf) 
     19// -4- PolCor_Panel is in Pol_PolarizationCorrection.ipf 
     20// 
    2121// 
    2222// Driven by 4 panels to get the necessary information from the users 
     
    7171//              - Polarization correction is done with one click (one per tab). "_pc" tags are added to the resulting names, 
    7272//                      and copies of all of the associated waves are again copied (wasteful), but makes switching display very easy 
    73 //              - Once all of the polariztion correction is done, then the UU_pc (etc.) data can be reduced as usual (xx_pc = 4 passes) 
     73//              - Once all of the polarization correction is done, then the UU_pc (etc.) data can be reduced as usual (xx_pc = 4 passes) 
    7474//              - protocol is built as ususal, from this panel only (since the SAM, EMP, and BGD need to be switched, rather than loaded 
    7575//              - protocols can be saved/recalled. 
     
    8484 
    8585 
     86// for the menu 
     87Menu "Macros" 
     88        "1 Fundamental Cell Parameters",ShowCellParamPanel() 
     89        "2 Cell Decay",ShowCellDecayPanel() 
     90        "3 Flipper States",ShowFlipperPanel() 
     91        "4 Polarization Correction",ShowPolCorSetup() 
     92End 
     93 
    8694 
    8795// 
     
    96104// Te=num 
    97105// err_Te=num 
    98 // mu=nnum 
     106// mu=num 
    99107// err_mu=num 
    100108// 
     
    103111// all of the strings start w/ "gCell_" 
    104112// 
    105 Macro ShowCellParamPanel() 
     113Proc ShowCellParamPanel() 
    106114         
    107115        // init folders 
     
    359367// all of the strings start w/ "gDecay_" 
    360368// 
    361 Macro ShowCellDecayPanel() 
     369Proc ShowCellDecayPanel() 
    362370         
    363371        // init folders 
     
    426434        Button button_6,pos={620,620},size={100,20},proc=WindowSnapshotButton,title="Snapshot" 
    427435        Button button_7,pos={620,580},size={130,20},proc=ManualEnterDecayButton,title="Manual Entry" 
    428  
     436        CheckBox check0,mode=0,pos={600,550},title="Overrride T0?",value=0 
    429437 
    430438 
     
    561569                        SetDataFolder root: 
    562570                         
     571                        // 
     572                        // now show the fit results, if any, from the wave note 
     573                        // 
     574                        SVAR gMuPo = root:Packages:NIST:Polarization:Cells:gMuPo 
     575                        SVAR gPo  = root:Packages:NIST:Polarization:Cells:gPo 
     576                        SVAR gGamma  = root:Packages:NIST:Polarization:Cells:gGamma 
     577                        SVAR gT0  = root:Packages:NIST:Polarization:Cells:gT0 
     578                        String nStr=note(decay) 
     579                         
     580 
     581                        // for the panel display 
     582                        sprintf gMuPo, "%g +/- %g",NumberByKey("muP", nStr, "=",","),NumberByKey("err_muP", nStr, "=",",") 
     583                        sprintf gPo, "%g +/- %g",NumberByKey("P0", nStr, "=",","),NumberByKey("err_P0", nStr, "=",",") 
     584                        sprintf gGamma, "%g +/- %g",NumberByKey("gamma", nStr, "=",","),NumberByKey("err_gamma", nStr, "=",",") 
     585                        gT0 = StringByKey("T0", nStr, "=",",") 
     586                 
     587                         
     588                        // clear the graph - force the user to update it manually 
     589                        // clear old data, and plot the new 
     590                        // 
     591                        SetDataFolder root:Packages:NIST:Polarization:Cells: 
     592 
     593                        CheckDisplayed/W=DecayPanel#G0 tmp_muP,tmp_muP2,fit_tmp_muP 
     594                        // if both present, bit 0 + bit 1 = 3 
     595                        if(V_flag & 2^0)                        //check bit 0 
     596                                RemoveFromGraph/W=DecayPanel#G0 tmp_muP 
     597                        endif 
     598                        if(V_flag & 2^1) 
     599                                RemoveFromGraph/W=DecayPanel#G0 tmp_muP2 
     600                        endif 
     601                        if(V_flag & 2^2) 
     602                                RemoveFromGraph/W=DecayPanel#G0 fit_tmp_muP 
     603                        endif 
     604                         
     605                        // kill the text box (name is hard-wired) 
     606                        TextBox/W=DecayPanel#G0/K/N=CF_tmp_muP 
     607                         
     608                        setDataFolder root: 
     609                         
    563610                        break 
    564611                case -1: // control being killed 
     
    588635         
    589636        // generate the dummy wave note now, change as needed 
    590         Note decay, "muP=2,err_muP=0,P0=0.6,err_P0=0,T0=asdf,gamma=200,err_gamma=0," 
     637        Note decay, "muP=0,err_muP=0,P0=0,err_P0=0,T0=undefined,gamma=0,err_gamma=0," 
    591638         
    592639        // to hold the results of the calculation 
     
    657704//                      selRow = V_startRow 
    658705 
    659                         Variable sum_muP, err_avg_muP, sum_Po, err_avg_Po, avg_muP, avg_Po 
     706                        Variable sum_muP, err_avg_muP, sum_Po, err_avg_Po, avg_muP, avg_Po, overrideT0 
    660707                        sum_muP = 0 
    661708                        sum_Po = 0 
     
    663710                        err_avg_Po = 0 
    664711                         
     712                        ControlInfo/W=DecayPanel check0 
     713                        overrideT0 = V_Value 
     714                         
    665715                        for(selRow=0;selRow<numRows;selRow+=1) 
    666716                                Print "calculate the row ",selRow 
    667717 
    668                                 if(selRow == 0) 
     718                                if(selRow == 0 && !overrideT0) 
    669719                                        //find T0 
    670720                                        fname = FindFileFromRunNumber(w[0][%Trans_He_In]) 
     
    677727                                        Note w, noteStr 
    678728                                        Print t0str 
    679                                         w[selRow][%elapsed_hr] = 0                      //by definition 
     729                                else 
     730                                        // manually entered on the panel to override the  
     731                                        SVAR gT0 = root:Packages:NIST:Polarization:Cells:gT0 
     732                                        t0Str = gT0 
     733                                        noteStr = note(w) 
     734                                        noteStr = ReplaceStringByKey("T0", noteStr, gT0  ,"=", ",", 0) 
     735                                        Note/K w 
     736                                        Note w, noteStr 
     737                                        Print t0str 
    680738                                endif 
    681739                                 
Note: See TracChangeset for help on using the changeset viewer.