Ignore:
Timestamp:
Feb 2, 2017 9:52:47 AM (6 years ago)
Author:
srkline
Message:

ADDED:

included common NCNR procedures for the PlotManager?, to allow plotting of 1D data sets using a familiar interface

greatly expanded Patch functionality to include input in the multiple sections of the Nexus file, including separate panels to handle patching of waves to the file - needed for non-linear coefficients, dead time, and XY beam centers. All patch operations are expandable as more fields become necessary to patch.

removed bug of group_id being defined in /reduction and in /sample (removed R/W that referenced /reduction)

added panel to "isolate" a single detector panel, allowing the corrections to be applied/removed/recalculated as needed to directly see their effects.

linked new procedures to their appropriate action buttons

Added more data fields (label, intent, etc.) to the VCALC to Nexus data writer to get more realistic values into the fake data files for testing

Added VCALC simulation functions with EMP and BGD in anticipation of testing the CORRECT step

more little bug and documentation fixes which I can't remember, but they are all important...

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
1 added
18 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotManager_v40.ipf

    r1001 r1022  
    157157        Variable rr,gg,bb 
    158158         
    159         SVAR angst = root:Packages:NIST:gAngstStr 
     159        SVAR/Z angst = root:Packages:NIST:gAngstStr 
    160160         
    161161        SetDataFolder $("root:"+DF) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_BeamCenter.ipf

    r1018 r1022  
    145145// 
    146146// -- need to adjust the size of the image subwindows to keep the model 
    147 //    calculation from spillon over onto the table (maybe just move the table) 
     147//    calculation from spilling over onto the table (maybe just move the table) 
    148148// -- need to do something for panel "B". currently ignored 
    149149// -- currently the pixel sizes for "real" data is incorrect in the file 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Q.ipf

    r995 r1022  
    920920        endif 
    921921 
    922         if(binType==4)          // slit aperture binning - Mt, ML, MR, MB are averaged 
     922        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged 
    923923                ClearIQIfDisplayed("VCALC","MLRTB") 
    924924                ClearIQIfDisplayed("VCALC","MLR") 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf

    r1019 r1022  
    4949        // 
    5050        // peak @ 0.015 in middle of middle detector, maybe not "real" vycor, but that is to be resolved 
    51         //      Make/O/D coef_BroadPeak = {1e-9, 3, 20, 500.0, 0.015,3,0.1}              
     51        //      Make/O/D coef_BroadPeak = {1e-9, 3, 20, 500.0, 0.015,3,0.1}      
     52        // 
     53        // 
     54        Variable addEmpBgd=0 
     55         
     56                 
    5257        String funcStr = VCALC_getModelFunctionStr() 
    5358        strswitch(funcStr) 
     
    7681                        tmpInten = VC_BlockedBeam(1,qTot[p][q]) 
    7782                        break 
     83                case "Debye +": 
     84                        tmpInten = VC_Debye(10,300,0.0001,qTot[p][q]) 
     85                        addEmpBgd = 1 
     86                        break 
     87                case "AgBeh +": 
     88                        tmpInten = VC_BroadPeak(1e-9,3,20,100.0,0.1,3,0.1,qTot[p][q]) 
     89                        addEmpBgd = 1 
     90                        break 
     91                case "Empty Cell +": 
     92                        tmpInten = VC_EC_Empirical(2.2e-8,3.346,0.0065,9.0,0.016,qTot[p][q]) 
     93                        tmpInten += VC_BlockedBeam(1,qTot[p][q]) 
     94                        break 
    7895                default: 
    7996                        tmpInten = VC_Debye(10,300,0.1,qTot[p][q]) 
    8097        endswitch 
    8198 
     99 
     100        if(addEmpBgd == 1) 
     101                tmpInten += VC_EC_Empirical(2.2e-8,3.346,0.0065,9.0,0.016,qTot[p][q]) 
     102                tmpInten += VC_BlockedBeam(1,qTot[p][q]) 
     103        endif 
     104 
     105         
    82106// TODO: this is faked to get around the singularity at the center of the back detector 
    83107// 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf

    r999 r1022  
    912912// tab 5 
    913913        String/G gModelFunctionType = "Debye;Sphere;Big Debye;Big Sphere;AgBeh;Vycor;Empty Cell;Blocked Beam;" 
    914  
     914        gModelFunctionType += "Debye +;AgBeh +;Empty Cell +;" 
    915915 
    916916//////////////////// 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf

    r1019 r1022  
    88        return(0) 
    99End 
     10 
     11 
     12// These files are COMMON NCNR FILES 
     13// the first three are necessary for loading and plotting of 1D data sets 
     14// using the PlotManager 
     15#include "PlotUtilsMacro_v40" 
     16#include "PlotManager_v40" 
     17#include "NIST_XML_v40" 
     18 
     19 
     20 
     21// VC designation is for VCALC (mostly) 
     22// and V designation is for VSANS 
     23// no prefix = COMMON procedure files 
     24//  note that the common files are not in the VSANS procedure folder and 
     25//  are not included in the line count 
    1026 
    1127 
     
    5369#include "V_DataPlotting" 
    5470 
    55 // 1D binning, combining 
     71// 1D binning, combining 1D sets 
    5672#include "V_IQ_Utilities" 
    5773 
    58 // testing procedures 
     74// testing procedures, to fill fake data from VCALC simulations 
    5975#include "V_Testing_Data_Procs" 
    6076 
     
    7187 
    7288#include "V_Correct" 
     89#include "V_Detector_Isolate" 
     90 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf

    r999 r1022  
    1313// simple entry procedure 
    1414// 
    15 Function V_PlotData_Panel() 
    16         DoWindow V_1D_Data 
    17         if(V_flag==0) 
    18                 Execute "V_DrawPlotPanel()" 
    19         else 
    20                 SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType 
    21  
    22                 V_QBinAllPanels(type) 
    23  
    24         // TODO: 
    25         // x- "B" detector is currently skipped - Q is not yet calculated 
    26                 Execute ("V_Back_IQ_Graph(\""+type+"\")") 
    27                 Execute ("V_Middle_IQ_Graph(\""+type+"\")") 
    28                 Execute ("V_Front_IQ_Graph(\""+type+"\")") 
    29         endif 
    30 End 
    31  
    32  
    3315// graph with the 1D representation of the VSANS detectors 
    3416// 
     
    4224// -- see Middle_IQ_Graph() and similar for how VCALC does this plot 
    4325// 
    44 Proc V_DrawPlotPanel() 
    45          
    46         String type = root:Packages:NIST:VSANS:Globals:gCurDispType 
    47  
    48         PauseUpdate; Silent 1           // building window... 
    49         Display /W=(277,526,748,938)/N=V_1D_Data 
     26// -- when/if I want to add phi-averaging to this, go gack to AvgGraphics.ipf for the pink panel 
     27//    and to the function Draw_Plot1D() for the drawing of the plot 
     28// 
     29Function V_PlotData_Panel() 
     30 
     31 
     32        DoWindow V_1D_Data 
     33        if(V_flag==0) 
     34         
     35                Display /W=(277,526,748,938)/N=V_1D_Data/K=1 
     36//              Display /W=(476,96,850,429)/N=V_1D_Data/K=1 
     37                ControlBar 70 
     38                 
     39                PopupMenu popup0,pos={16,5},size={71,20},title="Bin Type" 
     40                PopupMenu popup0,help={"This popup selects how the y-axis will be linearized based on the chosen data"} 
     41                PopupMenu popup0,value= "One;Two;Four;Slit Mode;" 
     42                PopupMenu popup0,mode=1,proc=V_BinningModePopup 
     43//              PopupMenu ymodel,pos={16,5},size={71,20},title="y-axis" 
     44//              PopupMenu ymodel,help={"This popup selects how the y-axis will be linearized based on the chosen data"} 
     45//              PopupMenu ymodel,value= #"\"I;log(I);ln(I);1/I;I^a;Iq^a;I^a q^b;1/sqrt(I);ln(Iq);ln(Iq^2)\"" 
     46//              PopupMenu ymodel,mode=NumVarOrDefault("root:myGlobals:Plot_1d:gYMode", 1 ),proc=YMode_PopMenuProc 
     47//              PopupMenu xmodel,pos={150,5},size={74,20},title="x-axis" 
     48//              PopupMenu xmodel,help={"This popup selects how the x-axis will be linearized given the chosen data"} 
     49//              PopupMenu xmodel,value= #"\"q;log(q);q^2;q^c\"" 
     50//              PopupMenu xmodel,mode=NumVarOrDefault("root:myGlobals:Plot_1d:gXMode", 1 ),proc=XMode_PopMenuProc 
     51//              Button Rescale,pos={281,4},size={70,20},proc=Rescale_Plot_1D_ButtonProc,title="Rescale" 
     52//              Button Rescale,help={"Rescale the x and y-axes of the data"},disable=1 
     53 
     54//              SetVariable expa,pos={28,28},size={80,15},title="pow \"a\"" 
     55//              SetVariable expa,help={"This sets the exponent \"a\" for some y-axis formats. The value is ignored if the model does not use an adjustable exponent"} 
     56//              SetVariable expa,limits={-2,10,0},value= root:myGlobals:Plot_1d:gExpA 
     57//              SetVariable expb,pos={27,46},size={80,15},title="pow \"b\"" 
     58//              SetVariable expb,help={"This sets the exponent \"b\" for some x-axis formats. The value is ignored if the model does not use an adjustable exponent"} 
     59//              SetVariable expb,limits={0,10,0},value= root:myGlobals:Plot_1d:gExpB 
     60// 
     61//              SetVariable expc,pos={167,28},size={80,15},title="pow \"c\"" 
     62//              SetVariable expc,help={"This sets the exponent \"c\" for some x-axis formats. The value is ignored if the model does not use \"c\" as an adjustable exponent"} 
     63//              SetVariable expc,limits={-10,10,0},value= root:myGlobals:Plot_1d:gExpC 
     64                 
     65                Button AllQ,pos={281,28},size={70,20},proc=V_AllQ_Plot_1D_ButtonProc,title="All Q" 
     66                Button AllQ,help={"Show the full q-range of the dataset"} 
     67                 
     68        endif 
     69                 
     70         
     71        SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType 
    5072 
    5173        V_QBinAllPanels(type) 
    5274 
    53 // TODO  
     75// TODO: 
    5476// x- "B" detector is currently skipped - Q is not yet calculated 
    55         V_Back_IQ_Graph(type) 
    56         V_Middle_IQ_Graph(type) 
    57         V_Front_IQ_Graph(type) 
    58          
    59 End 
    60  
    61  
     77        Execute ("V_Back_IQ_Graph(\""+type+"\")") 
     78        Execute ("V_Middle_IQ_Graph(\""+type+"\")") 
     79        Execute ("V_Front_IQ_Graph(\""+type+"\")") 
     80         
     81         
     82End 
     83 
     84//function to restore the graph axes to full scale, undoing any zooming 
     85Function V_AllQ_Plot_1D_ButtonProc(ctrlName) : ButtonControl 
     86        String ctrlName 
     87         
     88//      DoWindow/F V_1D_Data 
     89        SetAxis/A 
     90End 
     91 
     92 
     93// 
     94// recalculate the I(q) binning. no need to adjust model function or views 
     95// just rebin 
     96// 
     97Function V_BinningModePopup(ctrlName,popNum,popStr) : PopupMenuControl 
     98        String ctrlName 
     99        Variable popNum // which item is currently selected (1-based) 
     100        String popStr           // contents of current popup item as string 
     101 
     102        SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType 
     103 
     104        V_QBinAllPanels(type) 
     105 
     106        Execute ("V_Back_IQ_Graph(\""+type+"\")") 
     107        Execute ("V_Middle_IQ_Graph(\""+type+"\")") 
     108        Execute ("V_Front_IQ_Graph(\""+type+"\")") 
     109         
     110        return(0)        
     111End 
     112 
     113Function V_GetBinningPopMode() 
     114 
     115        Variable binType 
     116        ControlInfo/W=V_1D_Data popup0 
     117        strswitch(S_Value)      // string switch 
     118                case "One": 
     119                        binType = 1 
     120                        break           // exit from switch 
     121                case "Two": 
     122                        binType = 2 
     123                        break           // exit from switch 
     124                case "Four": 
     125                        binType = 3 
     126                        break           // exit from switch 
     127                case "Slit Mode": 
     128                        binType = 4 
     129                        break           // exit from switch 
     130 
     131                default:                        // optional default expression executed 
     132                        binType = 0 
     133                        Abort "Binning mode not found in        V_QBinAllPanels() "// when no case matches 
     134        endswitch 
     135         
     136        return(binType) 
     137end 
    62138 
    63139// 
     
    68144// 
    69145// TODO 
    70 // -- need to set binType 
    71 // -- currently  hard-wired == 1 
    72 // 
     146// x- need to set binType 
     147// x- currently  hard-wired == 1 
     148// 
     149// input "type" is the data type and defines the folder 
    73150// 
    74151Proc V_Middle_IQ_Graph(type)  
     
    76153 
    77154        Variable binType 
    78          
    79 //      ControlInfo/W=VCALC popup_b 
    80 //      binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4 
    81  
    82         binType = 1 
     155 
     156        binType = V_GetBinningPopMode() 
    83157        SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
    84158 
    85159// clear EVERYTHING 
     160//              ClearAllIQIfDisplayed("MLRTB") 
     161//              ClearAllIQIfDisplayed("MLR") 
     162//              ClearAllIQIfDisplayed("MTB")            //this returns to root: 
     163//              ClearAllIQIfDisplayed("MT")      
     164//              ClearAllIQIfDisplayed("ML")      
     165//              ClearAllIQIfDisplayed("MR")      
     166//              ClearAllIQIfDisplayed("MB")      
     167 
     168        if(binType==1) 
    86169                ClearAllIQIfDisplayed("MLRTB") 
    87170                ClearAllIQIfDisplayed("MLR") 
     
    90173                ClearAllIQIfDisplayed("ML")      
    91174                ClearAllIQIfDisplayed("MR")      
    92                 ClearAllIQIfDisplayed("MB")      
    93  
    94         if(binType==1) 
    95 //              ClearAllIQIfDisplayed("MLRTB") 
    96 //              ClearAllIQIfDisplayed("MLR") 
    97 //              ClearAllIQIfDisplayed("MTB")            //this returns to root: 
    98 //              ClearAllIQIfDisplayed("MT")      
    99 //              ClearAllIQIfDisplayed("ML")      
    100 //              ClearAllIQIfDisplayed("MR")      
    101 //              ClearAllIQIfDisplayed("MB")                      
     175                ClearAllIQIfDisplayed("MB")                      
    102176                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
    103177                CheckDisplayed/W=V_1D_Data iBin_qxqy_ML 
     
    120194         
    121195        if(binType==2) 
    122 //              ClearAllIQIfDisplayed("MLRTB") 
    123 //              ClearAllIQIfDisplayed("MT")      
    124 //              ClearAllIQIfDisplayed("ML")      
    125 //              ClearAllIQIfDisplayed("MR")      
    126 //              ClearAllIQIfDisplayed("MB") 
     196                ClearAllIQIfDisplayed("MLRTB") 
     197                ClearAllIQIfDisplayed("MT")      
     198                ClearAllIQIfDisplayed("ML")      
     199                ClearAllIQIfDisplayed("MR")      
     200                ClearAllIQIfDisplayed("MB") 
    127201         
    128202 
     
    148222         
    149223        if(binType==3) 
    150 //              ClearAllIQIfDisplayed("MLR") 
    151 //              ClearAllIQIfDisplayed("MTB")     
    152 //              ClearAllIQIfDisplayed("MT")      
    153 //              ClearAllIQIfDisplayed("ML")      
    154 //              ClearAllIQIfDisplayed("MR")      
    155 //              ClearAllIQIfDisplayed("MB")      
     224                ClearAllIQIfDisplayed("MLR") 
     225                ClearAllIQIfDisplayed("MTB")     
     226                ClearAllIQIfDisplayed("MT")      
     227                ClearAllIQIfDisplayed("ML")      
     228                ClearAllIQIfDisplayed("MR")      
     229                ClearAllIQIfDisplayed("MB")      
    156230         
    157231                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
     
    173247        endif 
    174248 
    175         if(binType==4)          // slit aperture binning - Mt, ML, MR, MB are averaged 
    176 //              ClearAllIQIfDisplayed("MLRTB") 
    177 //              ClearAllIQIfDisplayed("MLR") 
    178 //              ClearAllIQIfDisplayed("MTB") 
    179                  
    180 //              SetDataFolder root:Packages:NIST:VSANS:VCALC 
     249        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged 
     250                ClearAllIQIfDisplayed("MLRTB") 
     251                ClearAllIQIfDisplayed("MLR") 
     252                ClearAllIQIfDisplayed("MTB") 
     253                 
     254                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
    181255                CheckDisplayed/W=V_1D_Data iBin_qxqy_ML 
    182256                 
    183257                if(V_flag==0) 
    184                         AppendtoGraph/W=V_1D_Data iBin_qxqy_ML vs qBin_qxqy_ML 
     258                        AppendToGraph/W=V_1D_Data iBin_qxqy_ML vs qBin_qxqy_ML 
    185259                        AppendToGraph/W=V_1D_Data iBin_qxqy_MR vs qBin_qxqy_MR 
    186260                        AppendToGraph/W=V_1D_Data iBin_qxqy_MT vs qBin_qxqy_MT 
     
    208282// 
    209283// TODO 
    210 // -- need to set binType 
    211 // -- currently  hard-wired == 1 
     284// x- need to set binType 
     285// x- currently  hard-wired == 1 
    212286// 
    213287// 
     
    216290 
    217291        Variable binType 
    218          
    219 //      ControlInfo/W=VCALC popup_b 
    220 //      binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4 
    221  
    222         binType = 1 
     292 
     293 
     294        binType = V_GetBinningPopMode() 
    223295        SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
    224296 
    225297// clear EVERYTHING 
     298//              ClearAllIQIfDisplayed("FLRTB") 
     299//               
     300//              ClearAllIQIfDisplayed("FLR") 
     301//              ClearAllIQIfDisplayed("FTB") 
     302// 
     303//              ClearAllIQIfDisplayed("FT")      
     304//              ClearAllIQIfDisplayed("FL")      
     305//              ClearAllIQIfDisplayed("FR")      
     306//              ClearAllIQIfDisplayed("FB") 
     307                 
     308        if(binType==1) 
    226309                ClearAllIQIfDisplayed("FLRTB") 
    227310                 
     
    233316                ClearAllIQIfDisplayed("FR")      
    234317                ClearAllIQIfDisplayed("FB") 
    235                  
    236         if(binType==1) 
    237 //              ClearAllIQIfDisplayed("FLRTB") 
    238 //               
    239 //              ClearAllIQIfDisplayed("FLR") 
    240 //              ClearAllIQIfDisplayed("FTB") 
    241 // 
    242 //              ClearAllIQIfDisplayed("FT")      
    243 //              ClearAllIQIfDisplayed("FL")      
    244 //              ClearAllIQIfDisplayed("FR")      
    245 //              ClearAllIQIfDisplayed("FB") 
    246318                                 
    247319                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
     
    265337         
    266338        if(binType==2) 
    267 //              ClearAllIQIfDisplayed("FLRTB") 
    268 //              ClearAllIQIfDisplayed("FT")      
    269 //              ClearAllIQIfDisplayed("FL")      
    270 //              ClearAllIQIfDisplayed("FR")      
    271 //              ClearAllIQIfDisplayed("FB") 
    272 //       
     339                ClearAllIQIfDisplayed("FLRTB") 
     340                ClearAllIQIfDisplayed("FT")      
     341                ClearAllIQIfDisplayed("FL")      
     342                ClearAllIQIfDisplayed("FR")      
     343                ClearAllIQIfDisplayed("FB")      
    273344 
    274345                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
     
    293364         
    294365        if(binType==3) 
    295 //              ClearAllIQIfDisplayed("FLR") 
    296 //              ClearAllIQIfDisplayed("FTB")     
    297 //              ClearAllIQIfDisplayed("FT")      
    298 //              ClearAllIQIfDisplayed("FL")      
    299 //              ClearAllIQIfDisplayed("FR")      
    300 //              ClearAllIQIfDisplayed("FB")      
     366                ClearAllIQIfDisplayed("FLR") 
     367                ClearAllIQIfDisplayed("FTB")     
     368                ClearAllIQIfDisplayed("FT")      
     369                ClearAllIQIfDisplayed("FL")      
     370                ClearAllIQIfDisplayed("FR")      
     371                ClearAllIQIfDisplayed("FB")      
    301372         
    302373                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
     
    318389        endif 
    319390 
    320         if(binType==4)          // slit aperture binning - Mt, ML, MR, MB are averaged 
    321 //              ClearAllIQIfDisplayed("FLRTB") 
    322 //              ClearAllIQIfDisplayed("FLR") 
    323 //              ClearAllIQIfDisplayed("FTB") 
    324                  
    325 //              SetDataFolder root:Packages:NIST:VSANS:VCALC 
     391        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged 
     392                ClearAllIQIfDisplayed("FLRTB") 
     393                ClearAllIQIfDisplayed("FLR") 
     394                ClearAllIQIfDisplayed("FTB") 
     395                 
     396                SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
    326397                CheckDisplayed/W=V_1D_Data iBin_qxqy_FL 
    327398                 
     
    348419 
    349420// TODO 
    350 // -- need to set binType 
    351 // -- currently  hard-wired == 1 
     421// x- need to set binType 
     422// x- currently  hard-wired == 1 
    352423// 
    353424////////////to plot the back panel I(q) 
     
    358429 
    359430        Variable binType 
    360          
    361 //      ControlInfo/W=VCALC popup_b 
    362 //      binType = V_Value               // V_value counts menu items from 1, so 1=1, 2=2, 3=4 
    363  
    364         bintype = 1 
    365          
    366                 SetDataFolder $("root:Packages:NIST:VSANS:"+type)        
     431 
     432        binType = V_GetBinningPopMode() 
     433         
     434        SetDataFolder $("root:Packages:NIST:VSANS:"+type)        
    367435 
    368436        if(binType==1 || binType==2 || binType==3) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf

    r1019 r1022  
    22962296 
    22972297//group ID 
    2298 // TODO -- is this duplicated? 
     2298// DONE 
     2299// x- is this duplicated? 
     2300// x- yes, this is a duplicated field in the /entry/sample block (and is probably more appropriate there) 
     2301// x- so pick a single location, rather than needing to duplicate. 
     2302// 
    22992303Function V_getSample_group_ID(fname) 
    23002304        String fname 
    2301          
    2302         String path = "entry:reduction:group_id"         
     2305 
     2306// do not use the entry/reduction location 
     2307//      String path = "entry:reduction:group_id"  
     2308        String path = "entry:sample:group_id"    
     2309 
    23032310        return(V_getRealValueFromHDF5(fname,path)) 
    23042311end 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf

    r1005 r1022  
    58065806end 
    58075807 
    5808 // TODO -- do  I need to make sure that this is an integer? 
     5808 
     5809// 
     5810// TODO -- I need to make sure that this is an integer in the JSON definition 
     5811//              -- currently a text value in the data file - see trac ticket 
     5812// x- this is also a duplicated field in the reduction block (reductio/group_id is no longer used) 
     5813// 
    58095814// group ID !!! very important for matching up files 
    58105815// integer value 
     5816// 
    58115817Function V_writeSample_GroupID(fname,val) 
    58125818        String fname 
     
    65946600End 
    65956601 
    6596 // TODO -- is this duplicated? 
    6597 Function V_writeReduction_group_ID(fname,val) 
    6598         String fname 
    6599         Variable val 
    6600          
    6601 //      String path = "entry:reduction:box_count_error"  
    6602          
    6603         Make/O/D/N=1 wTmpWrite 
    6604 //      Make/O/R/N=1 wTmpWrite 
    6605         String groupName = "/entry/reduction" 
    6606         String varName = "group_id" 
    6607         wTmpWrite[0] = val 
    6608  
    6609         variable err 
    6610         err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
    6611         if(err) 
    6612                 Print "HDF write err = ",err 
    6613         endif 
    6614         // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
    6615 //      err = V_KillNamedDataFolder(fname) 
    6616 //      if(err) 
    6617 //              Print "DataFolder kill err = ",err 
    6618 //      endif 
    6619         return(err) 
    6620 end 
     6602// DONE x- commented out, not to be used 
     6603//  x- is this duplicated? - yes - this is duplicated in /entry/sample 
     6604//  x- so I need to pick a location, or be sure to fix it in both places 
     6605//Function V_writeReduction_group_ID(fname,val) 
     6606//      String fname 
     6607//      Variable val 
     6608//       
     6609////    String path = "entry:reduction:group_id"         
     6610//       
     6611//      Make/O/D/N=1 wTmpWrite 
     6612////    Make/O/R/N=1 wTmpWrite 
     6613//      String groupName = "/entry/reduction" 
     6614//      String varName = "group_id" 
     6615//      wTmpWrite[0] = val 
     6616// 
     6617//      variable err 
     6618//      err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
     6619//      if(err) 
     6620//              Print "HDF write err = ",err 
     6621//      endif 
     6622//      // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     6623////    err = V_KillNamedDataFolder(fname) 
     6624////    if(err) 
     6625////            Print "DataFolder kill err = ",err 
     6626////    endif 
     6627//      return(err) 
     6628//end 
    66216629 
    66226630Function V_writeReductionIntent(fname,str) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf

    r1002 r1022  
    22#pragma rtGlobals=3             // Use modern global access method and strict wave access. 
    33 
    4  
    5 // 
    64// 
    75// does no scaling, only the basic (default) trim of the ends, concatenate, sort, and save 
    8 // 
    9 // TODO: 
    10 // -- fill in all of the details... 
    116// 
    127 
     
    1712// 
    1813// TODO  
     14// 
     15// -- verify the binning for slit mode. Looks correct, but verify 
     16// -- DOCUMENT 
     17// 
    1918// x- detector "B" is currently skipped since the calibration waves are not faked 
    2019//    when the raw data is loaded. Then the qxqyqz waves are not generated. 
    2120// 
    22 // -- REDO the logic here. It's a mess, and will get the calculation wrong  
    23 // 
    24 // -- figure out the binning type (where is it set for VSANS?) 
    25 // -- don't know, so currently VSANS binning type is HARD-WIRED 
    26 // -- figure out when this needs to be called to (force) re-calculate I vs Q 
    27 // 
     21// x- REDO the logic here. It's a mess, and will get the calculation wrong  
     22// 
     23// x- figure out the binning type (where is it set for VSANS?) 
     24// x- don't know, so currently VSANS binning type is HARD-WIRED 
     25// x- figure out when this needs to be called to (force) re-calculate I vs Q 
     26// 
     27 
     28 
     29 
     30 
    2831Function V_QBinAllPanels(folderStr) 
    2932        String folderStr 
     
    3437        Variable binType,ii,delQ 
    3538        String detStr 
    36         binType = 1 
    37          
    38          
     39 
     40        binType = V_GetBinningPopMode() 
    3941 
    4042//// TODO: 
     
    9496        return(0) 
    9597End 
    96  
    9798 
    9899 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf

    r1003 r1022  
    138138        //check platform, so Angstrom can be drawn correctly 
    139139 
    140         //TODO  - this is different on Igor 7 
     140        //TODO  - this is different on Igor 7. Macintosh # has been updated, but Windows has not 
     141        // use Print char2num("à
     142") to find the magic number 
    141143        if(cmpstr("Macintosh",IgorInfo(2)) == 0) 
    142                 String/G root:Packages:NIST:VSANS:Globals:gAngstStr = num2char(-127) 
     144                String/G root:Packages:NIST:VSANS:Globals:gAngstStr = num2char(197) 
     145                String/G root:Packages:NIST:gAngstStr = num2char(197) 
    143146                Variable/G root:Packages:NIST:VSANS:Globals:gIsMac = 1 
    144147        else 
    145148                //either Windows or Windows NT 
    146149                String/G root:Packages:NIST:VSANS:Globals:gAngstStr = num2char(-59) 
     150                String/G root:Packages:NIST:gAngstStr = num2char(-59) 
    147151                Variable/G root:Packages:NIST:VSANS:Globals:gIsMac = 0 
    148152                //SetIgorOption to keep some PC's (graphics cards?) from smoothing the 2D image 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf

    r1021 r1022  
    2424                "Patch Beam Center XY",V_PatchDet_xyCenters_Panel() 
    2525                "Patch Detector Deadtime",V_PatchDetectorDeadtimePanel() 
     26                "Patch Detector Calibration",V_PatchDetectorCalibrationPanel() 
    2627        End 
    2728        Submenu "Work Files" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf

    r1021 r1022  
    1414// 
    1515/////////////////////////////// 
    16  
    17 // 
    18 // Updated for use with VSANS (in process) 
    19 // -- currently very crude, and needs to be changed to accomodate the  
    20 //   large number of parameters in the file that may/will need to be patched. 
    21 // -- if this turns out to be too crude or too difficult to work with for what  
    22 //   VSANS needs, I may ditch the entire procedure and start fresh 
    23 // 
    24 // June 2016 SRK 
    25 // 
    2616 
    2717// TODOs have been inserted to comment out all of the calls that don't compile and need to be replaced 
     
    4131//               different, and this may lead to different interface choices 
    4232// 
     33// -- need to add some mechanism (new panel?) to enter: 
     34//    -- box coordinates 
     35//    -- ABS parameters 
     36//    -- averaging options -- these will have new options versus SANS (binning panels, slit mode, etc.) 
    4337// 
    4438 
    4539 
    4640//************************** 
    47 // Vers. 1.2 092101 
    48 // 
    49 //procedures required to allow patching of raw SANS data headers 
    50 //only a limited number of fields are allowable for changes, although the list could 
    51 //be enhanced quite easily, at the expense of a larger, more complex panel 
     41// 
     42//procedures required to allow patching of raw vSANS data headers 
    5243//information for the Patch Panel is stored in the root:Packages:NIST:VSANS:Globals:Patch subfolder 
    5344// 
     
    7263 
    7364//initialization of the panel, creating the necessary data folder and global 
    74 //variables if necessary - simultaneously initialize the globals for the Trans 
    75 //panel at this time, to make sure they all exist 
     65//variables if necessary -  
    7666// 
    7767// root:Packages:NIST:VSANS:Globals: 
     
    9181        //ok, create the globals 
    9282        String/G root:Packages:NIST:VSANS:Globals:Patch:gPatchMatchStr = "*" 
     83        String/G root:Packages:NIST:VSANS:Globals:Patch:gPatchCurLabel = "no file selected" 
     84         
    9385        PathInfo catPathName 
    9486        If(V_flag==1) 
     
    9991        endif 
    10092        String/G root:Packages:NIST:VSANS:Globals:Patch:gPatchList = "none" 
    101 //      String/G root:Packages:NIST:VSANS:Globals:Patch:gPS1 = "no file selected" 
    102 //      String/G root:Packages:NIST:VSANS:Globals:Patch:gPS2 = "no file selected" 
    103 //      String/G root:Packages:NIST:VSANS:Globals:Patch:gPS3 = "no box selected" 
    104 //      String/G root:Packages:NIST:VSANS:Globals:Patch:gPS4 = "no file selected" 
    105 //      String/G root:Packages:NIST:VSANS:Globals:Patch:gPS5 = "no file selected" 
    106 //      String/G root:Packages:NIST:VSANS:Globals:Patch:gPS6 = "no file selected" 
    107 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV1 =0 
    108 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV2 = 0 
    109 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV3 = 0 
    110 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV4 = 0 
    111 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV5 = 0 
    112 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV6 = 0 
    113 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV7 = 0 
    114 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV8 = 0 
    115 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV9 = 0 
    116 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV10 = 0 
    117 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV11 = 0 
    118 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV12 = 0 
    119 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV13 = 0 
    120 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV14 = 0 
    121 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV15 = 0 
    122 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV16 = 0 
    123 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV17 = 0 
    124 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV18 = 0 
    125 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gPV19 = 0 
    126 //      Variable/G root:Packages:NIST:VSANS:Globals:Patch:gTransCts = 0 
     93 
    12794        Variable/G root:Packages:NIST:VSANS:Globals:Patch:gRadioVal = 1 
    12895         
     
    171138        PopupMenu PatchPopup,help={"The displayed file is the one that will be edited. The entire list will be edited if \"Change All..\" is selected. \r If no items, or the wrong items appear, click on the popup to refresh. \r List items are selected from the file based on MatchString"} 
    172139        PopupMenu PatchPopup,mode=1,popvalue="none",value= #"root:Packages:NIST:VSANS:Globals:Patch:gPatchList" 
    173 //      Button SHButton,pos={324,37},size={100,20},proc=ShowHeaderButtonProc,title="Show Header" 
    174 //      Button SHButton,help={"This will display the header of the file indicated in the popup menu."} 
     140 
    175141        Button CHButton,pos={314,37},size={110,20},proc=V_ChangeHeaderButtonProc,title="Change Header" 
    176142        Button CHButton,help={"This will change the checked values (ONLY) in the single file selected in the popup."} 
     
    181147        Button ChAllButton,pos={245,60},size={180,20},proc=V_ChAllHeadersButtonProc,title="Change All Headers in List" 
    182148        Button ChAllButton,help={"This will change the checked values (ONLY) in ALL of the files in the popup list, not just the top file. If the \"change\" checkbox for the item is not checked, nothing will be changed for that item."} 
    183         Button DoneButton,pos={314,85},size={110,20},proc=V_DoneButtonProc,title="Done Patching" 
     149        Button DoneButton,pos={450,60},size={110,20},proc=V_DoneButtonProc,title="Done Patching" 
    184150        Button DoneButton,help={"When done Patching files, this will close this control panel."} 
    185151        CheckBox check0,pos={18,80},size={40,15},title="Run #",value= 1,mode=1,proc=V_MatchCheckProc 
    186152        CheckBox check1,pos={78,80},size={40,15},title="Text",value= 0,mode=1,proc=V_MatchCheckProc 
    187         CheckBox check2,pos={138,80},size={40,15},title="SDD",value= 0,mode=1,proc=V_MatchCheckProc 
    188  
    189         PopupMenu popup_0,pos={450,85},size={109,20},title="Detector Panel",proc=V_PatchPopMenuProc 
     153        CheckBox check2,pos={138,80},size={40,15},title="Group_ID",value= 0,mode=1,proc=V_MatchCheckProc 
     154 
     155        SetVariable curStr,pos={50,112},size={350,20},title="File Label:" 
     156        SetVariable curStr,help={"Label of current file in popup list"} 
     157        SetVariable curStr,font="Courier",fSize=10 
     158        SetVariable curStr,limits={-Inf,Inf,0},value= root:Packages:NIST:VSANS:Globals:Patch:gPatchCurLabel 
     159         
     160        PopupMenu popup_0,pos={450,112},size={109,20},title="Detector Panel",proc=V_PatchPopMenuProc 
    190161        PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;ML;MR;MT;MB;B;\"" 
    191162 
    192163 
    193         TabControl PatchTab,pos={20,120},size={570,400} 
     164        TabControl PatchTab,pos={20,140},size={570,380} 
    194165        TabControl PatchTab,tabLabel(0)="Control",tabLabel(1)="Reduction",tabLabel(2)="Sample" 
    195166        TabControl PatchTab,tabLabel(3)="Instrument",tabLabel(4)="Detectors",tabLabel(5)="PolSANS" 
     
    197168 
    198169 
    199         ListBox list0,pos={30,150.00},size={550.00,350},proc=V_PatchListBoxProc,frame=1 
     170        ListBox list0,pos={30,170.00},size={550.00,330},proc=V_PatchListBoxProc,frame=1 
    200171        ListBox list0,fSize=10,userColumnResize= 1,listWave=PP_ListWave,selWave=PP_SelWave,titleWave=PP_TitleWave 
    201172        ListBox list0,mode=2,widths={30,200} 
     
    236207        switch(tab)      
    237208                case 0:  
    238                         //Print "tab 0" 
     209                        //Print "tab 0 = CONTROL" 
    239210                         
    240211                        V_FillListBox0(PP_ListWave,PP_SelWave) 
    241212                        break            
    242213                case 1:  
    243                         //Print "tab 1" 
     214                        //Print "tab 1 = REDUCTION" 
    244215                         
    245216                        V_FillListBox1(PP_ListWave,PP_SelWave) 
    246217                        break 
    247218                case 2:  
    248                         //Print "tab 2" 
     219                        //Print "tab 2 = SAMPLE" 
    249220                         
    250221                        V_FillListBox2(PP_ListWave,PP_SelWave) 
    251222                        break 
    252223                case 3:  
    253                         //Print "tab 3" 
     224                        //Print "tab 3 = INSTRUMENT" 
    254225                         
    255226                        V_FillListBox3(PP_ListWave,PP_SelWave) 
    256227                        break 
    257228                case 4:  
    258                         //Print "tab 4" 
     229                        //Print "tab 4 = DETECTORS" 
    259230                         
    260231                        V_FillListBox4(PP_ListWave,PP_SelWave) 
    261232                        break 
    262233                case 5:  
    263                         //Print "tab 5" 
     234                        //Print "tab 5 = POL_SANS" 
    264235 
    265236                        V_FillListBox5(PP_ListWave,PP_SelWave) 
     
    276247 
    277248// fill list boxes based on the tab 
     249// 
     250// *** if the number of elements is changed, then be sure that the variable nRows is updated 
     251//    * this is the same procedure for all of the tabs 
     252//    * then be sure that the new listWave assignments are properly indexed 
    278253// 
    279254// CONTROL 
     
    320295// fill list boxes based on the tab 
    321296// 
    322 // Reduction items 
     297// REDUCTION items 
    323298// 
    324299Function V_FillListBox1(listWave,selWave) 
     
    495470// fill list boxes based on the tab 
    496471// 
    497 // TODO -- 
     472// TODO -- is this all of the fields that I want to edit? 
     473// 
    498474// DETECTORS 
    499475// 
     
    574550// fill list boxes based on the tab 
    575551// 
    576 // TODO -- 
     552// TODO -- this all needs to be filled in, once I figure out what is needed 
     553// 
    577554// PolSANS 
    578555// 
     
    610587 
    611588 
    612 // TODO - determine if I really need this --- I don't  
     589// TODO -- determine if I really need this --- I don't  
    613590//  think I really have any reason to respond to events from list box actions 
    614 // or edits. the final action of patching is done with the button 
     591//  or edits. the final action of patching is done with the button 
    615592// 
    616593Function V_PatchListBoxProc(lba) : ListBoxControl 
     
    649626 
    650627//button action procedure to select the local path to the folder that 
    651 //contains the SANS data 
     628//contains the vSANS data 
    652629//sets catPathName, updates the path display and the popup of files (in that folder) 
    653630// 
     
    655632        String PathButton 
    656633         
     634        // call the main procedure to set the data path 
     635        V_PickPath() 
     636         
    657637        //set the global string to the selected pathname 
    658         V_PickPath() 
    659638        //set a local copy of the path for Patch 
    660639        PathInfo/S catPathName 
    661         String dum = S_path 
     640   String dum = S_path 
    662641        if (V_flag == 0) 
    663642                //path does not exist - no folder selected 
     
    675654        V_SetMatchStrProc("",0,"*","")          //this is equivalent to finding everything, typical startup case 
    676655 
    677 End 
    678  
    679  
     656        return(0) 
     657End 
     658 
     659// 
    680660//returns a list of valid files (raw data, no version numbers, no averaged files) 
    681661//that is semicolon delimited, and is suitable for display in a popup menu 
     
    706686End 
    707687 
     688 
     689 
     690// 
     691// TODO: 
     692// -- test all of the filters to be sure they actually work properly. 
     693//   Run # filter works 
     694//   Text filter works 
     695// 
     696// -- SDD filter does not apply -- what is a better filter choice? 
     697// -- can I filter intent? group_id? 
     698// -- can't just search for "sample" - this returns everything 
     699// 
     700// 
     701// 
     702// 
     703// 
    708704//returns a list of valid files (raw data, no version numbers, no averaged files) 
    709705//that is semicolon delimited, and is suitable for display in a popup menu 
     
    751747         
    752748        String list="",item="",fname,runList="",numStr="" 
    753         Variable ii,num=ItemsInList(newList),val,sdd 
     749        Variable ii,num=ItemsInList(newList),val,group_id 
    754750        NVAR gRadioVal= root:Packages:NIST:VSANS:Globals:Patch:gRadioVal 
    755751         
     
    786782        endif 
    787783         
    788         // SDD 
     784        // group_id 
     785        // replace this with: V_getSample_GroupID(fname) 
    789786        Variable pos 
    790         String SDDStr="" 
     787        String IDStr="" 
    791788        if(gRadioVal == 3) 
    792789                pos = strsearch(match, "*", 0) 
     
    801798                        item=StringFromList(ii, newList , ";") 
    802799                        fname = path + item 
    803 // TODO -- replace call -- this is hard-wired for "FL" 
    804                         sdd = V_getDet_ActualDistance(fname,"FL") 
    805                         if(pos == -1) 
    806                                 //no wildcard 
    807                                 if(abs(val - sdd) < 0.01        )               //if numerically within 0.01 meter, they're the same 
    808                                         list += item + ";" 
    809                                 endif 
    810                         else 
    811                                 //yes, wildcard, try a string match? 
    812                                 // string match doesn't work -- 1* returns 1m and 13m data 
    813                                 // round the value (or truncate?) 
    814                                  
    815                                 //SDDStr = num2str(sdd) 
    816                                 //if(strsearch(SDDStr,match[0,pos-1],0) != -1) 
    817                                 //      list += item + ";" 
    818                                 //endif 
    819                                  
    820                                 if(abs(val - round(sdd)) < 0.01 )               //if numerically within 0.01 meter, they're the same 
    821                                         list += item + ";" 
    822                                 endif 
    823          
     800                        group_id = V_getSample_GroupID(fname) 
     801                        if(group_id == val) 
     802                                list += item + ";" 
    824803                        endif 
     804         
    825805                endfor 
    826806                 
     
    847827        String popStr 
    848828 
    849         //change the contents of gPatchList that is displayed 
    850         //based on selected Path, match str, and 
    851         //further trim list to include only RAW SANS files 
    852829         
    853830//      String/G root:Packages:NIST:VSANS:Globals:Patch:gPatchList = list 
    854831//      ControlUpdate PatchPopup 
    855832        V_ShowHeaderButtonProc("SHButton") 
     833         
     834        return(0) 
    856835End 
    857836 
     
    881860                V_ShowHeaderButtonProc("SHButton") 
    882861        endif 
     862        return(0) 
    883863End 
    884864 
     
    927907        ControlUpdate/A/W=V_Patch_Panel 
    928908         
     909        // no matter what tab is selected, show the file label 
     910        SVAR fileLabel = root:Packages:NIST:VSANS:Globals:Patch:gPatchCurLabel 
     911        fileLabel = V_getSampleDescription(tempName) 
     912         
     913        return(0) 
    929914End 
    930915 
     
    10521037         
    10531038 
    1054 // 
    1055 //      ControlInfo checkPS1            //change the sample label ? 
    1056 //      if(V_Value == 1) 
    1057 //              SVAR gPS1 = root:Packages:NIST:VSANS:Globals:Patch:gPS1 
    1058 //              V_writeSampleDescription(fname,gPS1) 
    1059 //      endif 
    1060 //       
    1061 //      ControlInfo checkPV1 
    1062 //      if(V_Value == 1)                //sample transmission 
    1063 //              ControlInfo PV1 
    1064 //              V_writeSampleTransmission(fname,V_value) 
    1065 //      Endif 
    1066 //       
    1067 //      ControlInfo checkPV2 
    1068 //      if(V_Value == 1)                //sample thickness 
    1069 //              ControlInfo PV2 
    1070 //              V_writeSampleThickness(fname,V_Value) 
    1071 //      Endif 
    1072 //       
    1073 //      ControlInfo checkPV5 
    1074 //      if(V_Value == 1)                //attenuator number 
    1075 //              ControlInfo PV5 
    1076 //              V_writeAttenThickness(fname,V_value) 
    1077 //      Endif 
    1078 // 
    1079 //      ControlInfo checkPV6            // count time 
    1080 //      if(V_Value == 1) 
    1081 //              ControlInfo PV6 
    1082 //              V_writeCount_time(fname,V_Value) 
    1083 //      Endif 
    1084 // 
    1085 //      ControlInfo checkPV7     
    1086 //      if(V_Value == 1)    //monitor count 
    1087 //              ControlInfo PV7  
    1088 //              V_writeMonitorCount(fname,V_Value) 
    1089 //      Endif 
    1090 // 
    1091 //      ControlInfo checkPV10    
    1092 //      if(V_Value == 1)      //wavelength 
    1093 //              ControlInfo PV10 
    1094 //              V_writeWavelength(fname,V_Value) 
    1095 //      Endif 
    1096 // 
    1097 //      ControlInfo checkPV11            
    1098 //      if(V_Value == 1)      //wavelength spread 
    1099 //              ControlInfo PV11 
    1100 //              V_writeWavelength_spread(fname,V_Value) 
    1101 //      Endif    
    1102 // 
    1103 //      ControlInfo checkPV14            
    1104 //      if(V_Value == 1)      //source aperture 
    1105 //              ControlInfo PV14 
    1106 //              textStr = num2str(V_Value) 
    1107 //              V_writeSourceAp_size(fname,textStr)             //this is expecting a string 
    1108 //      Endif 
    1109 //       
    1110 //      ControlInfo checkPV15            
    1111 //      if(V_Value == 1)      //sample aperture 
    1112 //              ControlInfo PV15 
    1113 //              V_writeSampleAp2_size(fname,V_Value)            //TODO -- not sure if this is correct call 
    1114 //      Endif 
    1115 // 
    1116 //      ControlInfo checkPV16 
    1117 //      if(V_Value == 1)      //source-sam dist 
    1118 //              ControlInfo PV16 
    1119 //// TODO -- replace call 
    1120 ////            WriteSrcToSamDistToHeader(fname,num) 
    1121 //      Endif 
    1122 // 
    1123 //      ControlInfo checkPV18 
    1124 //      if(V_Value == 1)      //beamstop diam 
    1125 //              ControlInfo PV18 
    1126 //              V_writeBeamStopC2_size(fname,V_Value)                   //TODO depends on which det carriage I'm working with (2) or (3) 
    1127 //      Endif    
    1128 // 
    1129 //      ControlInfo checkPS2            //change the DIV file name? 
    1130 //      if(V_Value == 1) 
    1131 //              SVAR gPS2 = root:Packages:NIST:VSANS:Globals:Patch:gPS2 
    1132 //              V_writeSensitivityFileName(fname,gPS2) 
    1133 //      endif    
    1134 //       
    1135 //      ControlInfo checkPS3            //change the sample intent? 
    1136 //      if(V_Value == 1) 
    1137 //              SVAR gPS3 = root:Packages:NIST:VSANS:Globals:Patch:gPS3 
    1138 //              V_writeReductionIntent(fname,gPS3) 
    1139 //      endif    
    1140 // 
    1141 //       
    1142 //// individual detector values  
    1143 //      ControlInfo checkPV3 
    1144 //      if(V_Value == 1)                //pixel X 
    1145 //              ControlInfo PV3 
    1146 //              V_writeDet_beam_center_x(fname,detStr,V_Value)   
    1147 //      Endif 
    1148 //       
    1149 //      ControlInfo checkPV4 
    1150 //      if(V_Value == 1)                // pixel Y 
    1151 //              ControlInfo PV4 
    1152 //              V_writeDet_beam_center_y(fname,detStr,V_Value)   
    1153 //      Endif 
    1154 //       
    1155 //      ControlInfo checkPV17 
    1156 //      if(V_Value == 1)      //det offset 
    1157 //              ControlInfo PV17 
    1158 //              V_writeDet_LateralOffset(fname,detStr,V_Value)          // TODO lateral or vertical offset, based on detStr 
    1159 //      Endif 
    1160 // 
    1161 //      ControlInfo checkPV19 
    1162 //      if(V_Value == 1)     //SDD 
    1163 //              ControlInfo PV19 
    1164 //              V_writeDet_distance(fname,detStr,V_Value)         
    1165 //      Endif 
    1166 // 
    1167 //      ControlInfo checkPV8     
    1168 //      if(V_Value == 1)     //total detector count 
    1169 //              ControlInfo PV8 
    1170 //              V_writeDet_IntegratedCount(fname,detStr,V_value)                 
    1171 //      Endif 
    11721039 
    11731040 
     
    12301097        if ((selWave[8][0] & 2^4) != 0)         //"group_id (sample)" 
    12311098                val = str2num(listWave[8][2]) 
    1232                 err = V_writeReduction_group_ID(fname,val) 
     1099                err = V_writeSample_GroupID(fname,val) 
    12331100        endif    
    12341101         
     
    14581325//This function will read only the selected values editable in the patch panel 
    14591326// 
    1460 // -- TODO -- 
    1461 // re-write this to be tab-aware. ShowHeaderForPatch() calls this, but does nothing 
    1462 // to update the tab content. Figure out which function is in charge, and update the content. 
     1327// DONE 
     1328// x- re-write this to be tab-aware. ShowHeaderForPatch() calls this, but does nothing 
     1329//    to update the tab content. Figure out which function is in charge, and update the content. 
    14631330// 
    14641331Function V_ReadHeaderForPatch(fname) 
     
    14791346                DoAlert 0,"The VSANS Data Reduction Tutorial Help file could not be found" 
    14801347//      endif 
     1348        return(0) 
    14811349End 
    14821350 
     
    15901458/////////////// 
    15911459// 
    1592 // this is a block to patch waves to the file headers, and can patch multiple files 
     1460// this is a block to patch DEADTIME waves to the file headers, and can patch multiple files 
    15931461//  
    15941462// uses a simple panel to show what the table of values is. 
     
    15991467//        trigger a cleanout. 
    16001468// 
    1601 // TODO - link this to a panel somewhere - a button? menu item? will there be a lot more of these little panels? 
     1469// TODO -- link this to a panel somewhere - a button? menu item? will there be a lot more of these little panels? 
     1470// 
     1471// TODO -- currently, this does not patch the deadtime for the back "B" detector. it is a single 
     1472//        value, not a wave see V_WritePerfectDeadTime(filename) for how the perfect (fake) values is written. 
     1473// 
    16021474// 
    16031475Proc V_PatchDetectorDeadtime(firstFile,lastFile,detStr,deadtimeStr) 
     
    16141486         
    16151487        V_fReadDetectorDeadtime(firstFile,lastFile,detStr) 
     1488         
    16161489End 
    16171490 
    16181491// simple utility to patch the detector deadtime in the file headers 
    1619 // pass in the account name as a string 
    16201492// lo is the first file number 
    16211493// hi is the last file number (inclusive) 
     
    16281500        Variable ii 
    16291501        String fname 
     1502         
     1503        // check the dimensions of the deadtimeW/N=48 
     1504        if (DimSize(deadtimeW, 0) != 48 ) 
     1505                Abort "dead time wave is not of proper dimension (48)" 
     1506        endif 
    16301507         
    16311508        //loop over all files 
     
    16671544 
    16681545Proc V_PatchDetectorDeadtimePanel() 
    1669         DoWindow/F Patch_Deadtime 
     1546        DoWindow/F DeadtimePanel 
    16701547        if(V_flag==0) 
    16711548         
     
    16811558 
    16821559 
    1683 // 
    1684 // TODO - needs some minor adjustment to be of practical use, but a proof of concept 
     1560// TODO: 
     1561// x- add method for generating "perfect" dead time to write 
     1562// x- check deadtime wave dimension before writing (check for bad paste operation) 
     1563// -- load from file? different ways to import? 
     1564// -- Dead time constants for "B" are different, and not handled here (yet) 
     1565// -- add help button/file 
     1566// -- add done button 
     1567// -- adjust after user testing 
    16851568// 
    16861569Proc V_DeadtimePatchPanel() : Panel 
     
    16881571 
    16891572 
    1690         NewPanel /W=(600,400,1000,1000)/N=DeadtimePanel/K=1 
     1573        NewPanel /W=(600,400,1000,1000)/N=DeadtimePanel /K=1 
    16911574//      ShowTools/A 
    1692          
    1693         PopupMenu popup_0,pos={20,20},size={109,20},title="Detector Panel" 
     1575        ModifyPanel cbRGB=(16266,47753,2552,23355) 
     1576 
     1577        SetDrawLayer UserBack 
     1578        DrawText 85,99,"Current Values" 
     1579        DrawText 21,258,"Write to all files (inlcusive)" 
     1580        SetDrawEnv fsize= 14,fstyle= 1 
     1581        DrawText 209,30,"Dead Time Constants" 
     1582        DrawText 20,133,"Run Number(s)" 
     1583         
     1584        PopupMenu popup_0,pos={20,40},size={109,20},title="Detector Panel" 
    16941585        PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;ML;MR;MT;MB;\"" 
    16951586         
    1696         Button button0,pos={22.00,62.00},size={50.00,20.00},proc=V_ReadDTButtonProc,title="Read" 
    1697         Button button0_1,pos={95.00,62.00},size={50.00,20.00},proc=V_WriteDTButtonProc,title="Write" 
    1698         SetVariable setvar0,pos={19.00,128.00},size={100.00,14.00},title="first" 
     1587        Button button0,pos={20,81},size={50.00,20.00},proc=V_ReadDTButtonProc,title="Read" 
     1588        Button button0_1,pos={20,220},size={50.00,20.00},proc=V_WriteDTButtonProc,title="Write" 
     1589        Button button0_2,pos={18.00,336.00},size={140.00,20.00},proc=V_GeneratePerfDTButton,title="Perfect Dead Time" 
     1590         
     1591        SetVariable setvar0,pos={20,141},size={100.00,14.00},title="first" 
    16991592        SetVariable setvar0,value= K0 
    1700         SetVariable setvar1,pos={20.00,154.00},size={100.00,14.00},title="last" 
     1593        SetVariable setvar1,pos={20.00,167},size={100.00,14.00},title="last" 
    17011594        SetVariable setvar1,value= K1 
    17021595 
    1703          
    17041596 
    17051597// display the wave      
    17061598        Edit/W=(180,40,380,550)/HOST=#  root:Packages:NIST:VSANS:Globals:Patch:deadTimeWave 
    1707         ModifyTable width(Point)=0 
     1599        ModifyTable width(Point)=40 
    17081600        ModifyTable width(root:Packages:NIST:VSANS:Globals:Patch:deadTimeWave)=120 
    17091601        RenameWindow #,T0 
     
    17121604         
    17131605EndMacro 
     1606 
     1607 
     1608 
     1609Function V_GeneratePerfDTButton(ba) : ButtonControl 
     1610        STRUCT WMButtonAction &ba 
     1611 
     1612        switch( ba.eventCode ) 
     1613                case 2: // mouse up 
     1614                        // click code here 
     1615 
     1616                        WAVE deadTimeWave = root:Packages:NIST:VSANS:Globals:Patch:deadTimeWave 
     1617                        ControlInfo popup_0 
     1618                        strswitch(S_Value) 
     1619                                case "FR": 
     1620                                case "FL": 
     1621                                case "MR": 
     1622                                case "ML": 
     1623                                case "FT": 
     1624                                case "FB": 
     1625                                case "MT": 
     1626                                case "MB": 
     1627                                        deadTimeWave = 1e-18 
     1628 
     1629                                        break 
     1630                                default: 
     1631                                        Print "Det type not found: V_GeneratePerfDTButton()" 
     1632                        endswitch 
     1633                         
     1634                        break 
     1635                case -1: // control being killed 
     1636                        break 
     1637        endswitch 
     1638 
     1639        return 0 
     1640End 
     1641 
     1642 
    17141643 
    17151644 
     
    17641693////////////////////////////////////////////////////////////////////////////////////////////////// 
    17651694////////////////////////////////////////////////////////////////////////////////////////////////// 
     1695// this is a block to patch CALIBRATION waves to the file headers, and can patch multiple files 
     1696//  
     1697// uses a simple panel to show what the table of values is. 
     1698// "read" will read only the first run number contents. 
     1699// 
     1700// TODO -- need to clear out the contents from RawVSANS, or else re-reading to check the values 
     1701//        will read locally, and it will look like nothing was written. Executing "save" will also  
     1702//        trigger a cleanout. 
     1703// 
     1704// TODO -- link this to a panel somewhere - a button? menu item? will there be a lot more of these little panels? 
     1705// 
     1706// TODO -- currently this does not handle the back detector "B". see V_WritePerfectSpatialCalib(filename) 
     1707//         for how fake data is written to the files 
     1708// 
     1709// TODO -- verify that the calibration waves are not transposed 
     1710// 
     1711Proc V_PatchDetectorCalibration(firstFile,lastFile,detStr,calibStr) 
     1712        Variable firstFile=1,lastFile=100 
     1713        String detStr = "FL",calibStr="calibrationWave" 
     1714 
     1715        V_fPatchDetectorCalibration(firstFile,lastFile,detStr,$calibStr) 
     1716 
     1717End 
     1718 
     1719Proc V_ReadDetectorCalibration(firstFile,lastFile,detStr) 
     1720        Variable firstFile=1,lastFile=100 
     1721        String detStr = "FL" 
     1722         
     1723        V_fReadDetectorCalibration(firstFile,lastFile,detStr) 
     1724End 
     1725 
     1726// simple utility to patch the detector calibration wave in the file headers 
     1727// lo is the first file number 
     1728// hi is the last file number (inclusive) 
     1729// 
     1730Function V_fPatchDetectorCalibration(lo,hi,detStr,calibW) 
     1731        Variable lo,hi 
     1732        String detStr 
     1733        Wave calibW 
     1734         
     1735        Variable ii 
     1736        String fname 
     1737         
     1738        // check the dimensions of the calibW (3,48) 
     1739        if (DimSize(calibW, 0) != 3 || DimSize(calibW, 1) != 48 ) 
     1740                Abort "Calibration wave is not of proper dimension (3,48)" 
     1741        endif 
     1742         
     1743        //loop over all files 
     1744        for(ii=lo;ii<=hi;ii+=1) 
     1745                fname = V_FindFileFromRunNumber(ii) 
     1746                if(strlen(fname) != 0) 
     1747                        V_writeDetTube_spatialCalib(fname,detStr,calibW)                         
     1748                else 
     1749                        printf "run number %d not found\r",ii 
     1750                endif 
     1751        endfor 
     1752         
     1753        return(0) 
     1754End 
     1755 
     1756// simple utility to read the detector deadtime stored in the file header 
     1757Function V_fReadDetectorCalibration(lo,hi,detStr) 
     1758        Variable lo,hi 
     1759        String detStr 
     1760         
     1761        String fname 
     1762        Variable ii 
     1763         
     1764        for(ii=lo;ii<=hi;ii+=1) 
     1765                fname = V_FindFileFromRunNumber(ii) 
     1766                if(strlen(fname) != 0) 
     1767                        Wave calibW = V_getDetTube_spatialCalib(fname,detStr) 
     1768                        Duplicate/O calibW root:Packages:NIST:VSANS:Globals:Patch:calibrationWave 
     1769                else 
     1770                        printf "run number %d not found\r",ii 
     1771                endif 
     1772        endfor 
     1773         
     1774        return(0) 
     1775End 
     1776 
     1777 
     1778Proc V_PatchDetectorCalibrationPanel() 
     1779        DoWindow/F CalibrationPanel 
     1780        if(V_flag==0) 
     1781         
     1782                NewDataFolder/O/S root:Packages:NIST:VSANS:Globals:Patch 
     1783 
     1784                Make/O/D/N=(3,48) calibrationWave 
     1785                 
     1786                SetDataFolder root: 
     1787                 
     1788                Execute "V_CalibrationPatchPanel()" 
     1789        endif 
     1790End 
     1791 
     1792 
     1793// 
     1794// TODO: 
     1795// x- add method for generating "perfect" calibration to write 
     1796// x- check Nx3 dimension before writing (check for bad paste operation) 
     1797// -- load from file? different ways to import? 
     1798// -- calibration constants for "B" are different, and not handled here (yet) 
     1799// -- add help button/file 
     1800// -- add done button 
     1801// -- adjust after user testing 
     1802// 
     1803Proc V_CalibrationPatchPanel() : Panel 
     1804        PauseUpdate; Silent 1           // building window... 
     1805 
     1806 
     1807        NewPanel /W=(600,400,1200,1000)/N=CalibrationPanel /K=1 
     1808//      ShowTools/A 
     1809        ModifyPanel cbRGB=(16266,47753,2552,23355) 
     1810 
     1811        SetDrawLayer UserBack 
     1812        DrawText 85,99,"Current Values" 
     1813        DrawText 21,258,"Write to all files (inlcusive)" 
     1814        SetDrawEnv fsize= 14,fstyle= 1 
     1815        DrawText 227,28,"Quadratic Calibration Constants per Tube" 
     1816        DrawText 20,133,"Run Number(s)" 
     1817                 
     1818        PopupMenu popup_0,pos={20,40},size={109,20},title="Detector Panel" 
     1819        PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;ML;MR;MT;MB;\"" 
     1820         
     1821        Button button0,pos={20,81},size={50.00,20.00},proc=V_ReadCalibButtonProc,title="Read" 
     1822        Button button0_1,pos={20,220},size={50.00,20.00},proc=V_WriteCalibButtonProc,title="Write" 
     1823        Button button0_2,pos={18.00,336.00},size={140.00,20.00},proc=V_GeneratePerfCalibButton,title="Perfect Calibration" 
     1824                 
     1825        SetVariable setvar0,pos={20,141},size={100.00,14.00},title="first" 
     1826        SetVariable setvar0,value= K0 
     1827        SetVariable setvar1,pos={20.00,167},size={100.00,14.00},title="last" 
     1828        SetVariable setvar1,value= K1 
     1829 
     1830 
     1831// display the wave      
     1832        Edit/W=(180,40,580,550)/HOST=#  root:Packages:NIST:VSANS:Globals:Patch:calibrationWave 
     1833        ModifyTable width(Point)=40 
     1834        ModifyTable width(root:Packages:NIST:VSANS:Globals:Patch:calibrationWave)=110 
     1835        // the elements() command transposes the view in the table, but does not transpose the wave 
     1836        ModifyTable elements(root:Packages:NIST:VSANS:Globals:Patch:calibrationWave) = (-3, -2) 
     1837        RenameWindow #,T0 
     1838        SetActiveSubwindow ## 
     1839 
     1840         
     1841EndMacro 
     1842 
     1843 
     1844 
     1845//      // and for the back detector "B" 
     1846//      Make/O/D/N=3 tmpCalib 
     1847//      tmpCalib[0] = 1 
     1848//      tmpCalib[1] = 1 
     1849//      tmpcalib[2] = 10000 
     1850//      V_writeDet_cal_x(filename,"B",tmpCalib) 
     1851//      V_writeDet_cal_y(filename,"B",tmpCalib) 
     1852// 
     1853Function V_GeneratePerfCalibButton(ba) : ButtonControl 
     1854        STRUCT WMButtonAction &ba 
     1855 
     1856        switch( ba.eventCode ) 
     1857                case 2: // mouse up 
     1858                        // click code here 
     1859 
     1860                        WAVE calibrationWave = root:Packages:NIST:VSANS:Globals:Patch:calibrationWave 
     1861                        ControlInfo popup_0 
     1862                        strswitch(S_Value) 
     1863                                case "FR": 
     1864                                case "FL": 
     1865                                case "MR": 
     1866                                case "ML": 
     1867                                        //      // for the "tall" L/R banks 
     1868                                        calibrationWave[0][] = -512 
     1869                                        calibrationWave[1][] = 8 
     1870                                        calibrationWave[2][] = 0 
     1871                                        break 
     1872                                case "FT": 
     1873                                case "FB": 
     1874                                case "MT": 
     1875                                case "MB": 
     1876                                        //      // for the "short" T/B banks 
     1877                                        calibrationWave[0][] = -256 
     1878                                        calibrationWave[1][] = 4 
     1879                                        calibrationWave[2][] = 0 
     1880 
     1881                                        break 
     1882                                default: 
     1883                                        Print "Det type not found: V_GeneratePerfCalibButton()" 
     1884                        endswitch 
     1885 
     1886 
     1887                         
     1888                        break 
     1889                case -1: // control being killed 
     1890                        break 
     1891        endswitch 
     1892 
     1893        return 0 
     1894End 
     1895 
     1896 
     1897Function V_ReadCalibButtonProc(ba) : ButtonControl 
     1898        STRUCT WMButtonAction &ba 
     1899 
     1900        switch( ba.eventCode ) 
     1901                case 2: // mouse up 
     1902                        // click code here 
     1903                         
     1904                        ControlInfo popup_0 
     1905                        String detStr = S_Value 
     1906                        ControlInfo setvar0 
     1907                        Variable lo=V_Value 
     1908                        Variable hi=lo 
     1909                         
     1910                        V_fReadDetectorCalibration(lo,hi,detStr) 
     1911                         
     1912                        break 
     1913                case -1: // control being killed 
     1914                        break 
     1915        endswitch 
     1916 
     1917        return 0 
     1918End 
     1919 
     1920Function V_WriteCalibButtonProc(ba) : ButtonControl 
     1921        STRUCT WMButtonAction &ba 
     1922 
     1923        switch( ba.eventCode ) 
     1924                case 2: // mouse up 
     1925                        // click code here 
     1926                         
     1927                        ControlInfo popup_0 
     1928                        String detStr = S_Value 
     1929                        ControlInfo setvar0 
     1930                        Variable lo=V_Value 
     1931                        ControlInfo setvar1 
     1932                        Variable hi=V_Value 
     1933                        Wave calibW = root:Packages:NIST:VSANS:Globals:Patch:calibrationWave 
     1934                         
     1935                        V_fPatchDetectorCalibration(lo,hi,detStr,calibW) 
     1936                         
     1937                        break 
     1938                case -1: // control being killed 
     1939                        break 
     1940        endswitch 
     1941 
     1942        return 0 
     1943End 
     1944 
     1945 
     1946 
     1947////////////////////////////////////////////////////////////////////////////////////////////////// 
     1948////////////////////////////////////////////////////////////////////////////////////////////////// 
     1949 
    17661950 
    17671951 
     
    18121996        Wave yCtr_pix = root:Packages:NIST:VSANS:Globals:Patch:yCtr_pix 
    18131997        Wave/T panelW = root:Packages:NIST:VSANS:Globals:Patch:panelW 
    1814                  
     1998         
     1999        // check the dimensions of the waves (9) 
     2000        if (DimSize(xCtr_pix, 0) != 9 || DimSize(yCtr_pix, 0) != 9 || DimSize(panelW, 0) != 9) 
     2001                Abort "waves are not of proper dimension (9)" 
     2002        endif 
     2003         
    18152004        //loop over all files 
    18162005        for(jj=lo;jj<=hi;jj+=1) 
     
    18692058 
    18702059Proc V_PatchDet_xyCenters_Panel() 
    1871         DoWindow/F Patch_Deadtime 
     2060        DoWindow/F Patch_XY_Panel 
    18722061        if(V_flag==0) 
    18732062         
     
    18842073 
    18852074 
    1886 // 
    1887 // TODO - document, make setVar controls larger, make cleaner 
    1888 // 
    1889 // TODO - link to main panel? link to Patch Panel? 
     2075// TODO: 
     2076// -- add method to read (import) from beam center panel 
     2077// x- check wave dimensions before writing (check for bad paste operation) 
     2078// -- load from file? different ways to import? 
     2079// -- add help button/file 
     2080// -- add done button 
     2081// -- adjust after user testing 
    18902082// 
    18912083Proc V_Patch_xyCtr_Panel() : Panel 
     
    18932085 
    18942086 
    1895         NewPanel /W=(600,400,1150,800)/N=Patch_XY_Panel/K=1 
     2087        NewPanel /W=(600,400,1150,800)/N=Patch_XY_Panel /K=1 
    18962088//      ShowTools/A 
    18972089         
    1898 //      PopupMenu popup_0,pos={20,20},size={109,20},title="Detector Panel" 
    1899 //      PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;ML;MR;MT;MB;B;\"" 
    1900          
    1901         Button button0,pos={22.00,62.00},size={50.00,20.00},proc=V_ReadXYButtonProc,title="Read" 
    1902         Button button0_1,pos={95.00,62.00},size={50.00,20.00},proc=V_WriteXYButtonProc,title="Write" 
    1903         SetVariable setvar0,pos={19.00,128.00},size={100.00,14.00},title="first" 
     2090        ModifyPanel cbRGB=(16266,47753,2552,23355) 
     2091 
     2092        SetDrawLayer UserBack 
     2093        DrawText 85,99,"Current Values" 
     2094        DrawText 21,258,"Write to all files (inlcusive)" 
     2095        SetDrawEnv fsize= 14,fstyle= 1 
     2096        DrawText 262,30,"Beam Center (pixels)" 
     2097        DrawText 20,133,"Run Number(s)" 
     2098         
     2099        Button button0,pos={20,81},size={50.00,20.00},proc=V_ReadXYButtonProc,title="Read" 
     2100        Button button0_1,pos={20,220},size={50.00,20.00},proc=V_WriteXYButtonProc,title="Write" 
     2101        SetVariable setvar0,pos={20,141},size={100.00,14.00},title="first" 
    19042102        SetVariable setvar0,value= K0 
    1905         SetVariable setvar1,pos={20.00,154.00},size={100.00,14.00},title="last" 
     2103        SetVariable setvar1,pos={20.00,167},size={100.00,14.00},title="last" 
    19062104        SetVariable setvar1,value= K1 
    19072105 
     
    19092107        SetDataFolder root:Packages:NIST:VSANS:Globals:Patch 
    19102108// display the wave      
    1911         Edit/W=(180,40,480,350)/HOST=#  panelW,xCtr_pix,yCtr_pix 
     2109        Edit/W=(180,40,500,370)/HOST=#  panelW,xCtr_pix,yCtr_pix 
    19122110        ModifyTable width(Point)=0 
    19132111        ModifyTable width(panelW)=80 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Test_RAW_Panel.ipf

    r1012 r1022  
    672672End 
    673673 
    674 // TODO 
    675 // 
     674 
     675// See V_Detector_Isolate.ipf 
    676676// isolates a single panel to allow a better view of the details 
    677677// useful for T/B panels which are partially blocked from view 
    678678// 
    679 // will open a separate graph or panel to display the selected detector 
    680 // (lots to do here, depending what is necessary for instrument troubleshooting) 
     679// will open a separate panel to display the selected detector 
     680// (more to do here, depending what is necessary for instrument troubleshooting) 
    681681// - like being able to turn corrections on/off and view with different axes (pix, mm, Q) 
    682682// 
     
    687687                case 2: // mouse up 
    688688                        // click code here 
     689                        V_DetectorIsolate() 
    689690                        break 
    690691                case -1: // control being killed 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Testing_Data_Procs.ipf

    r999 r1022  
    1212// -- decide if it's better to write wholesale, or as individual waves 
    1313// 
    14 Macro Copy_VCALC_to_VSANSFile() 
     14Macro Copy_VCALC_to_VSANSFile(labelStr,intent,group_id) 
     15        String labelStr = "sample label" 
     16        String intent = "SAMPLE" 
     17        variable group_id = 75 
    1518         
    1619        String fileName = V_DoSaveFileDialog("pick the file to write to") 
     
    1821//       
    1922        if(strlen(fileName) > 0) 
    20                 writeVCALC_to_file(fileName) 
     23                writeVCALC_to_file(fileName,labelStr,intent,group_id) 
    2124        endif 
    2225End 
     
    2528// TODO -- fill this in as needed to get fake data that's different 
    2629// 
    27 Function writeVCALC_to_file(fileName) 
    28         String fileName 
     30Function writeVCALC_to_file(fileName,labelStr,intent,group_id) 
     31        String fileName,labelStr,intent 
     32        Variable group_id 
    2933 
    3034 
     
    3438// the middle SDD (correct units) 
    3539// the back SDD (correct units) 
    36         Variable ii,val 
     40        Variable ii,val,sumCts=0 
    3741        String detStr 
    3842        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     
    7377                // V_writeDetector_deadtime(fname,detStr,inW) 
    7478                // TODO: need a new, separate function to write the single deadtime value in/out of "B" 
     79                 
     80                // integrated count value on each detector bank 
     81                sumCts += sum(tmpData) 
     82                V_writeDet_IntegratedCount(fileName,detStr,sum(tmpData)) 
    7583 
    7684        endfor 
     
    8896        V_writeWavelength(fileName,VCALC_getWavelength()) 
    8997 
    90 // description of the sample 
    91  
    92 // sample information 
    93 // name, title, etc 
    9498         
    9599// fake the information about the count setup, so I have different numbers to read 
     
    97101        V_writeCount_time(fileName,100) 
    98102 
    99 // monitor count (= imon) 
    100 // returns the number of neutrons on the sample 
    101 //Function VCALC_getImon() 
     103        // monitor count (= imon) 
     104                // returns the number of neutrons on the sample 
     105                //Function VCALC_getImon() 
     106        V_writeMonitorCount(fileName,VCALC_getImon()) 
     107 
     108        // total detector count (sum of everything) 
     109        V_writeDetector_counts(fileName,sumCts) 
     110 
     111        // sample description 
     112        V_writeSampleDescription(fileName,labelStr) 
     113         
     114        // reduction intent 
     115        V_writeReductionIntent(fileName,intent) 
     116         
     117        // reduction group_id 
     118        // TODO - skip for now. group_id is incorrectly written to the data file as a text value. trac ticket 
     119        //        has been written to fix in the future. 
     120//      V_writeReduction_group_ID(fileName,group_id) 
     121 
     122 
    102123 
    103124// ?? anything else that I'd like to see on the catalog - I could change them here to see different values 
    104125// different collimation types? 
    105126// 
     127 
     128 
    106129 
    107130        return(0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf

    r1012 r1022  
    3030                return(1) 
    3131        else 
    32                 //set the global to the path (as a string) 
    33                 // need 4 \ since it is the escape character 
    34                 if(cmpstr("\\\\",dum[0,1])==0)  //Windows user going through network neighborhood 
    35                         DoAlert 0,alertStr 
    36                         KillPath catPathName 
    37                         return(1) 
    38                 endif 
     32        // SRK 2016, for windows 10, try to eliminate this restriction   
     33        //---- connecting through the network neighborhood seems to be perfectly fine except for  
     34        //     path issues with GBLoadWave, which only affects VAX data sets 
     35                 
     36//              print igorinfo(3) 
     37//              //set the global to the path (as a string) 
     38//              // need 4 \ since it is the escape character 
     39//              if(cmpstr("\\\\",dum[0,1])==0)  //Windows user going through network neighborhood 
     40//                      DoAlert 0,alertStr 
     41//                      KillPath catPathName 
     42//                      return(1) 
     43//              endif 
    3944                String/G root:Packges:NIST:VSANS:Globals:gCatPathStr = dum 
    4045                return(0)               //no error 
    4146        endif 
     47         
    4248End 
    4349 
     
    518524        String fullName="",partialName="",item="" 
    519525        //get list of raw data files in folder that match "num" 
    520 //      if( (num>9999) || (num<=0) ) 
    521 //              Print "error in  FindFileFromRunNumber(num), file number too large or too small" 
    522 //              Return ("") 
    523 //      Endif 
     526 
    524527        String numStr="" 
    525528        numStr = num2str(num) 
    526 //      if(num<10) 
    527 //              numStr = "000"+num2str(num) 
    528 //      else 
    529 //              if(num<100) 
    530 //                      numStr = "00"+num2str(num) 
    531 //              else 
    532 //                      if(num<1000) 
    533 //                              numstr = "0"+num2str(num) 
    534 //                      else 
    535 //                              numStr = num2str(num) 
    536 //                      endif 
    537 //              Endif 
    538 //      Endif 
    539         //Print "numstr = ",numstr 
    540          
     529 
    541530        //make sure that path exists 
    542531        PathInfo catPathName 
     
    667656        else 
    668657                //found, get the characters preceeding it, but still after the "sans" characters 
    669                 if (pos-1 <= 4) 
     658                if (pos-1 < 4) 
    670659                        //not enough characters 
    671660                        return (invalid) 
     
    975964// called by Marquee.ipf, MultipleReduce.ipf, ProtocolAsPanel.ipf 
    976965// 
    977 Function/S ParseRunNumberList(list) 
     966Function/S V_ParseRunNumberList(list) 
    978967        String list 
    979968         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Preferences.ipf

    r999 r1022  
    8787        Variable/G root:Packages:NIST:VSANS:Globals:gDoTubeShadowCor = 1 
    8888         
    89         val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gDoMonitorNormalizaton", 1 ) 
    90         Variable/G root:Packages:NIST:VSANS:Globals:gDoMonitorNormalizaton = 1 
     89        val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization", 1 ) 
     90        Variable/G root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization = 1 
    9191         
    9292 
     
    204204        Variable checked 
    205205         
    206         NVAR gVal = root:Packages:NIST:VSANS:Globals:gDoMonitorNormalizaton 
     206        NVAR gVal = root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization 
    207207        gVal = checked 
    208208End 
     
    273273        CheckBox PrefCtrl_1m value=root:Packages:NIST:VSANS:Globals:gDoTubeShadowCor,pos={255,200},help={"TURN OFF ONLY FOR DEBUGGING."} 
    274274        CheckBox PrefCtrl_1n title="Do Tube Shadow Correction?",size={140,14},proc=V_DoMonitorNormPref 
    275         CheckBox PrefCtrl_1n value=root:Packages:NIST:VSANS:Globals:gDoMonitorNormalizaton,pos={255,220},help={"TURN OFF ONLY FOR DEBUGGING."} 
     275        CheckBox PrefCtrl_1n value=root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization,pos={255,220},help={"TURN OFF ONLY FOR DEBUGGING."} 
    276276                 
    277277         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf

    r1019 r1022  
    562562        // TODO -- what do I really need to save? 
    563563         
    564         NVAR gDoMonitorNormalizaton = root:Packages:NIST:VSANS:Globals:gDoMonitorNormalizaton 
    565         if (gDoMonitorNormalizaton == 1) 
     564        NVAR gDoMonitorNormalization = root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization 
     565        if (gDoMonitorNormalization == 1) 
    566566                Print "(stub)Doing monitor normalization -- INCOMPLETE --"// for "+ detStr 
    567567                 
Note: See TracChangeset for help on using the changeset viewer.