Ignore:
Timestamp:
May 2, 2017 1:09:17 PM (6 years ago)
Author:
srkline
Message:

changes to streamline the data plotting of 1D data, in preparation for different modes of combining detector panels. Also will allow better integration with protocols to combine 1D data, which can now be part of the protocol.

Other changes, but I can't remember whtat they were...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf

    r1032 r1035  
    4747//              NAME=string             string from set {Auto,Manual} = Automatic name generation or Manual(dialog) 
    4848// 
    49 //    BINTYPE=string (VSANS binning type) "One;Two;Four;Slit Mode;" 
     49//    BINTYPE=string (VSANS binning type) "One;Two;Four;Slit Mode;", defined by ksBinTypeStr 
    5050// 
    5151//              For work.DRK usage: 
     
    12591259//      Prompt Qctr, "q-value of center of annulus" 
    12601260//      Prompt Qdelta,"Pixel width of annulus" 
    1261         Prompt binType,"Binning Type?",popup,"One;Two;Four;Slit Mode;" 
     1261        Prompt binType,"Binning Type?",popup,ksBinTypeStr 
    12621262 
    12631263        //assign results of dialog to key=value string, semicolon separated 
     
    21672167// 
    21682168// TODO -- incomplete 
    2169 //       
    2170 //mask data if desired (this is done automatically  in the average step) and is 
    2171 //not done explicitly here (if no mask in MSK folder, a null mask is created and "used") 
     2169//              -- fill in the "ask" step 
     2170//  -- none is OK, except if the kill fails for any reason 
     2171// -- the regular case of the file name specified by the protocol works correctly 
     2172// -- don't create a null mask if not used, it will handle the error and print out that the mask is missing 
     2173 
     2174//mask data if desired (this is done automatically in the average step) and is 
     2175//not done explicitly here 
    21722176         
    21732177        //check for mask 
     
    21782182                If(cmpstr("ask",prot[3])==0) 
    21792183                        //get file from user 
     2184                        // TODO -- fill in the get file prompt, and handle the result 
    21802185//                      junkStr = PromptForPath("Select Mask file") 
    21812186                        DoAlert 0,"Mask step incomplete" 
    21822187 
    21832188                        If(strlen(junkStr)==0) 
    2184                                 //no selection of mask file is not a fatal error, keep going, and let cirave() 
    2185                                 //make a "null" mask  
    21862189                                //if none desired, make sure that the old mask is deleted 
    21872190                                //junkStr = GetDataFolder(1) 
    21882191                                //SetDataFolder root:Packages:NIST:MSK 
    2189                                 KillWaves/Z root:Packages:NIST:MSK:data 
     2192                                KillDataFolder/Z root:Packages:NIST:VSANS:MSK: 
     2193                                NewDataFolder/O root:Packages:NIST:VSANS:MSK 
    21902194                                //SetDataFolder junkStr 
    21912195                                DoAlert 0,"No Mask file selected, data not masked" 
    21922196                        else 
    21932197                                //read in the file from the dialog 
    2194                                 V_LoadHDF5Data("","MSK") 
     2198                                V_LoadHDF5Data(junkStr,"MSK") 
    21952199                        Endif 
    21962200                else 
     
    22082212// 
    22092213                KillDataFolder/Z root:Packages:NIST:VSANS:MSK: 
     2214                NewDataFolder/O root:Packages:NIST:VSANS:MSK 
     2215 
    22102216        Endif 
    22112217         
     
    22372243        // (not needed for VSANS, data is always linear scale) 
    22382244 
     2245        // bin and plot the data 
     2246        // TODO 
     2247        // x- currently this bins and plots based on the V_1D_Data panel, NOT the selections above 
     2248        // now takes the the binType from the protocol, and uses two steps to bin and average 
     2249        String binTypeStr = StringByKey("BINTYPE",prot[5],"=",";") 
     2250        // plotting is not really necessary, and the graph may not be open - so skip for now? 
     2251        Variable binType 
     2252        binType = V_BinTypeStr2Num(binTypeStr) 
     2253        if(binType == 0) 
     2254                        Abort "Binning mode not found in V_QBinAllPanels() "// when no case matches 
     2255        endif 
     2256 
     2257 
     2258 
    22392259// TODO 
    22402260// -- this switch does nothing -- fill it in 
    2241 //       
     2261//       -- need to convert BINTYPE keyword into a numerical value to pass 
     2262//    ?? define a global string and use WhichListItem() to get a number back? 
     2263// 
     2264         
    22422265        strswitch(av_type)      //dispatch to the proper routine to average to 1D data 
    22432266                case "none":             
     
    22612284                case "Circular": 
    22622285//                      CircularAverageTo1D(activeType) 
     2286                        V_QBinAllPanels(activeType,binType)             // this does a default circular average 
    22632287                        break 
    22642288                case "Sector": 
     
    22712295                        //do nothing 
    22722296        endswitch 
    2273         // bin and plot the data 
    2274         // TODO 
    2275         // x- currently this bins and plots based on the V_1D_Data panel, NOT the selections above 
    2276         // now takes the the binType from the protocol, and uses two steps to bin and average 
    2277         String binTypeStr = StringByKey("BINTYPE",prot[5],"=",";") 
    2278         // plotting is not really necessary, and the graph may not be open - so skip for now? 
    2279         Variable binType 
    2280         strswitch(binTypeStr)   // string switch 
    2281                 case "One": 
    2282                         binType = 1 
    2283                         break           // exit from switch 
    2284                 case "Two": 
    2285                         binType = 2 
    2286                         break           // exit from switch 
    2287                 case "Four": 
    2288                         binType = 3 
    2289                         break           // exit from switch 
    2290                 case "Slit Mode": 
    2291                         binType = 4 
    2292                         break           // exit from switch 
    2293  
    2294                 default:                        // optional default expression executed 
    2295                         binType = 0 
    2296                         Abort "Binning mode not found in V_QBinAllPanels() "// when no case matches 
    2297         endswitch 
    2298          
    2299         V_PlotData_Panel(binType)               //this bins and plots the *currently displayed* data 
    2300         V_QBinAllPanels(activeType,binType)             //bin the active reduction data 
    2301  
    2302 // TODO: 
    2303 // x- "B" detector is currently skipped - Q is not yet calculated 
    2304  
    2305         String str,winStr="V_1D_Data" 
    2306         sprintf str,"(\"%s\",%d,\"%s\")",activeType,binType,winStr 
    2307  
    2308          
    2309         Execute ("V_Back_IQ_Graph"+str) 
    2310 //      Print "V_Back_IQ_Graph"+str 
    2311         Execute ("V_Middle_IQ_Graph"+str) 
    2312         Execute ("V_Front_IQ_Graph"+str) 
    2313  
     2297 
     2298// TODO -- this call will bin the active type, then the next call bins the active type 
     2299// -- then later, I dispatch to bin the active type...   
     2300// -- !!!need to split out the panel draw and the binning calls from V_PlotData_Panel 
     2301// 
     2302        V_PlotData_Panel()              //this brings the plot window to the front, or draws it (ONLY) 
     2303        V_Update1D_Graph(activeType,binType)            //update the graph, data was already binned 
    23142304         
    23152305///// end of averaging dispatch 
     
    23622352                        //auto-generate name and prepend path - won't put up any dialogs since it has all it needs 
    23632353                        //use autoname if present 
    2364 //                      if (cmpstr(autoname,"") != 0) 
    2365 //                              fullPath = S_Path + autoname + "." +exten 
    2366 //                      else 
    2367 //                              fullPath = S_Path + newFileName+"." + exten 
    2368 //                      endif    
     2354                        if (cmpstr(autoname,"") != 0) 
     2355                                fullPath = S_Path + autoname + "." +exten 
     2356                        else 
     2357                                fullPath = S_Path + newFileName+"." + exten 
     2358                        endif    
    23692359                Endif 
    23702360                // 
     
    23962386                endswitch 
    23972387                 
    2398                 //Print "data written to:  "+ fullpath 
     2388                Print "data written to:  "+ newFileName+"."+exten 
    23992389        Endif 
    24002390         
     
    24092399// 
    24102400Proc V_AskForAbsoluteParams(c2,c3,c4,c5,I_err) 
    2411         Variable c2=0.95,c3=0.1,c4=1,c5=32.0,I_err=0.32 
     2401        Variable c2=1,c3=1,c4=1e8,c5=1,I_err=1 
    24122402        Prompt c2, "Standard Transmission" 
    24132403        Prompt c3, "Standard Thickness (cm)" 
Note: See TracChangeset for help on using the changeset viewer.