Ignore:
Timestamp:
Nov 16, 2017 10:57:32 AM (5 years ago)
Author:
srkline
Message:

lots of changes here:
many little fixes to clean up TODO items and marke them DONE

changed the handling of the panel "gap" to split the gap evenly. Q-calculations have been re-verified with this change.

re-named the list of "bin Type" values, and added a few more choices. Streamlined how the averaging and plotting works with this list so that it can be more easily modified as different combinations of binning are envisioned. This resulted in a lot of excess code being cut out and replaced with cleaner logic. This change has also been verified to work as intended.

Attenuation is now always calculated from the table. The table also by (NEW) definition has values for the white beam (one waelength) and graphite (multiple possible wavelengths) where the wavelengths are artificially scaled (*1000) or *1e6) so that the interpolations can be done internally without the need for multiple attenuator tables.

File:
1 edited

Legend:

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

    r1072 r1073  
    22162216 
    22172217//////////////////////////////////////////////////////// 
    2218  
    2219 // TODO: 
    2220 // -- calculation works, needs proper inputs (solid angle aware) 
    2221 // --   Open beam method needs to be verified in V_AskForAbsoluteParams_Quest() 
     2218// Absolute scale 
     2219 
     2220// x- calculation works, needs proper inputs (solid angle aware) 
     2221// x-   Open beam method needs to be verified in V_AskForAbsoluteParams_Quest() 
    22222222        Variable c2,c3,c4,c5,kappa_err 
    22232223        //do absolute scaling if desired 
     
    22732273                If(cmpstr("ask",prot[3])==0) 
    22742274                        //get file from user 
    2275                         // TODO 
    22762275                        // x- fill in the get file prompt, and handle the result 
    22772276                        Prompt mskFileName,"MASK File",popup,V_PickMASKButton("") 
     
    23342333        // bin and plot the data 
    23352334         
    2336         // TODO 
    2337 // -- this switch does nothing -- fill it in 
     2335// 
    23382336//       x- need to convert BINTYPE keyword into a numerical value to pass 
    23392337// 
     
    23512349// TODO: 
    23522350// -- do I calculate the proper resolution here? I've already decoded the binning type 
    2353 //   and the averaging type has been specified by the protocol 
     2351//   and the averaging type has been specified by the protocol. 
     2352// 
     2353// currently, the resolution is calculated every time that the data is averaged (in VC_fDoBinning_QxQy2D) 
     2354// 
    23542355// -- if I calculate the resolution here, then the Trimming routines must be updated 
    2355 //    to trim the resolution waves also. This positioning may work for  
     2356//    to trim the resolution waves also. This will work for the columns present in 
    23562357//    pinhole resolution, but anything using the matrix method - it won't work - and I'll need  
    23572358//    a different solution 
     
    24102411 
    24112412 
    2412 // TODO 
     2413//  
    24132414// x- how do I get the sample file name? 
    24142415//    local variable samFileLoaded is the file name loaded (contains the extension) 
    24152416//       
    2416         //save data if desired 
     2417        //save data if desired - dispatch as needed 
    24172418        String fullpath = "", newfileName="" 
    24182419        String saveType = StringByKey("SAVE",prot[5],"=",";")           //does user want to save data? 
     2420 
    24192421        If( (cmpstr(saveType[0,2],"Yes")==0) && (cmpstr(av_type,"none") != 0) )          
    24202422                //then save 
     
    24442446                //if this doesn't exist, a dialog will be presented by setting dialog = 1 
    24452447                // 
    2446                 // 
    24472448                Variable dialog = 0 
    24482449 
    2449 // TODO 
    2450 // -- need to define nBeg and nEnd somewhere 
    2451 // -- currently hard-wired 
    2452 // --do I need to define these "per-panel"?              
    2453                  
    24542450                PathInfo/S catPathName 
    24552451                String item = StringByKey("NAME",prot[5],"=",";")               //Auto or Manual naming 
     
    24852481//                              SaveAsPNG(activeType,fullpath,dialog) 
    24862482                                break 
    2487                         default: 
     2483                        case "Circular":                //in SANS, this was the default, but is dangerous, so make it explicit here 
    24882484//                              if (useXMLOutput == 1) 
    24892485//                                      WriteXMLWaves_W_Protocol(activeType,fullPath,dialog) 
     
    24922488//                              endif 
    24932489// 
    2494 // TODO: 
    2495 // -- fill in all of the cases, default is only the "standard" circular average I(q) 
    2496 // -- get the trim strings from somewhere-- from the file or from the protocol?? 
     2490// x- get the trim strings from somewhere-- from the file or from the protocol?? 
    24972491//   then replace the null strings being passed 
    24982492 
    24992493                                if(cmpstr(saveType,"Yes - Concatenate")==0) 
    2500                                         V_Trim1DDataStr(activeType,binType,prot[7],prot[8])                     // TODO -- passing null strings uses global or default trim values 
    2501 //                                      V_Trim1DData(activeType,binType,nBeg,nEnd) 
     2494                                        V_Trim1DDataStr(activeType,binType,prot[7],prot[8])                     // x- passing null strings uses global or default trim values 
     2495 
    25022496                                        V_ConcatenateForSave("root:Packages:NIST:VSANS:",activeType,"",binType)         // this removes q=0 point, concatenates, sorts 
    25032497                                        V_Write1DData("root:Packages:NIST:VSANS:",activeType,newFileName+"."+exten)             //don't pass the full path, just the name 
     
    25092503                                endif 
    25102504                                Print "data written to:  "+ newFileName+"."+exten 
     2505 
     2506                                break 
     2507                        default: 
     2508                                DoAlert 0, "av_type not found in dispatch to write file" 
    25112509 
    25122510                endswitch 
     
    26602658                // store these locally 
    26612659                 
    2662                 // TODO 
     2660 
    26632661                // x- need to get the panel string for the sum. 
    26642662                // x- the detector string is currently hard-wired 
     
    26702668                Print "empty err/counts = ",empty_ct_err/emptyCts 
    26712669 
    2672                 //              TODO 
    2673                 // -- get all of the proper values for the calculation 
     2670// 
     2671                // x- get all of the proper values for the calculation 
    26742672                // -x currently the attenuation is incorrect 
    26752673                //   such that kappa_err = 1*kappa 
    2676                 // -- verify the calculation (no solid angle needed??) 
    2677                  
    2678                 DoAlert 0,"This calculation is not reliable - something is wrong" 
    2679                  
     2674                // x- verify the calculation (no solid angle needed??) 
     2675                                 
    26802676                // get the attenuation factor for the empty beam 
    2681                 // TODO -- the attenuation is not written by NICE to the file 
     2677                // -- the attenuation is not written by NICE to the file 
    26822678                //  so I need to calculate it myself from the tables 
    26832679                //  
     
    27062702                kappa_err = sqrt(kappa_err) * kappa 
    27072703                 
    2708                 // TODO 
    2709                 // -- set the parameters in the global string 
     2704                // x- set the parameters in the global string 
    27102705                junkStr = num2str(kappa) 
    27112706                errStr = num2Str(kappa_err) 
     
    27132708                 
    27142709 
    2715                 Printf "Kappa was (maybe) successfully calculated as = %g +/- %g (%g %)\r",kappa,kappa_err,(kappa_err/kappa)*100 
     2710                Printf "Kappa was successfully calculated as = %g +/- %g (%g %)\r",kappa,kappa_err,(kappa_err/kappa)*100 
    27162711         
    27172712                // restore preferences on exit 
Note: See TracChangeset for help on using the changeset viewer.