Ignore:
Timestamp:
May 21, 2014 3:52:02 PM (9 years ago)
Author:
srkline
Message:

Updated the reduction Read/Write? and corresponding factility stubs to accomodate detector dead time written to the VAX header. It is currently not written to the header, but may be with NICE (hopefully).

With the move of NG3 SANS to CGB(upper), the NG3 designation in the account name [NGxSANSxx] has been replaced with CGB. Folders on charlotte and radio button on SASCALC are labeled "NGB30" to be more obvious which instrument it is.

FFT routines have minor typos cleaned up.

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Fit_3Cyl_KR.ipf

    r838 r940  
    181181// do the calculation (use the binned if only one SLD, or bin+SLD if the model requires this) 
    182182        fDoCalc(xw,yw,FFT_T,12,0)               //the binned calculation 
     183//      fDoCalc(xw,yw,FFT_T,13,0)               //the binned + multiple SLD calculation 
    183184 
    184185// reset the volume fraction to get the proper scaling 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_GenericModel.ipf

    r936 r940  
    88// the "model function" is nothing but a scale and background on top of 
    99// whatever is calculated from the FFT 
     10// 
     11// Unlike other "FFT" fit functions, this one actually uses FFT for the calculation 
     12// since it's used for SASCALC and only needs to be pretty close - so an iterpolation of 
     13// the faster FFT calculation is most appropriate 
    1014// 
    1115// 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_KR_Parser.ipf

    r923 r940  
    171171        NVAR FFT_T = root:FFT_T 
    172172//      FFT_T = sbp[0] 
    173         sbp[0] = FFT_T 
     173//      sbp[0] = FFT_T 
     174        sbp = FFT_T 
    174175         
    175176        variable npts,cyl 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ANSTO_DataReadWrite.ipf

    r800 r940  
    565565// end April 2011 additions 
    566566 
     567// read the detector deadtime (in seconds) 
     568Function getDetectorDeadtime(fname) 
     569        String fname 
     570         
     571        return(0) 
     572end 
     573 
     574 
    567575//whole transmission is NCNR-specific right now 
    568576// leave this stub empty 
     
    774782End 
    775783 
     784// Write the detector deadtime to the file header (in seconds) 
     785Function WriteDeadtimeToHeader(fname,num) 
     786        String fname 
     787        Variable num 
     788         
     789        return(0) 
     790End 
    776791 
    777792 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/FACILITY_DataReadWrite.ipf

    r795 r940  
    764764End 
    765765 
    766  
     766// Write the detector deadtime to the file header (in seconds) 
     767Function WriteDeadtimeToHeader(fname,num) 
     768        String fname 
     769        Variable num 
     770         
     771        return(0) 
     772End 
    767773 
    768774//////// ACCESSORS FOR READING DATA FROM THE HEADER  ////////////// 
     
    11121118         
    11131119        return(value) 
     1120end 
     1121 
     1122// read the detector deadtime (in seconds) 
     1123Function getDetectorDeadtime(fname) 
     1124        String fname 
     1125         
     1126        return(0) 
    11141127end 
    11151128 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_DataReadWrite.ipf

    r804 r940  
    785785        return(mtime) 
    786786end 
     787 
     788 
     789// read the detector deadtime (in seconds) 
     790Function getDetectorDeadtime(fname) 
     791        String fname 
     792         
     793        return(0) 
     794end 
     795 
    787796 
    788797//////  integer values 
     
    17551764End 
    17561765 
     1766// Write the detector deadtime to the file header (in seconds) 
     1767Function WriteDeadtimeToHeader(fname,num) 
     1768        String fname 
     1769        Variable num 
     1770         
     1771        return(0) 
     1772End 
     1773 
    17571774// sample label 
    17581775// limit to 60 characters 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Utils.ipf

    r795 r940  
    166166// [dateAndTimeStr] is optional, and could be used as a switch for  
    167167// different historical detector configurations 
    168 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr]) 
     168Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 
    169169        String fileStr,detStr,dateAndTimeStr 
     170        Variable dtime 
    170171         
    171172        Variable deadtime 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_DataReadWrite.ipf

    r795 r940  
    920920End 
    921921 
     922// Write the detector deadtime to the file header (in seconds) 
     923Function WriteDeadtimeToHeader(fname,num) 
     924        String fname 
     925        Variable num 
     926         
     927        return(0) 
     928End 
    922929 
    923930 
     
    13861393end 
    13871394 
     1395// read the detector deadtime (in seconds) 
     1396Function getDetectorDeadtime(fname) 
     1397        String fname 
     1398         
     1399        return(0) 
     1400end 
    13881401 
    13891402//reads the wavelength from a reduced data file (not very reliable) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_Utils.ipf

    r857 r940  
    177177// [dateAndTimeStr] is optional, and could be used as a switch for  
    178178// different historical detector configurations 
    179 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr]) 
     179Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 
    180180        String fileStr,detStr,dateAndTimeStr 
     181        Variable dtime 
    181182         
    182183        Variable deadtime 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/KIST_DataReadWrite.ipf

    r810 r940  
    764764End 
    765765 
    766  
     766// Write the detector deadtime to the file header (in seconds) 
     767Function WriteDeadtimeToHeader(fname,num) 
     768        String fname 
     769        Variable num 
     770         
     771        return(0) 
     772End 
    767773 
    768774//////// ACCESSORS FOR READING DATA FROM THE HEADER  ////////////// 
     
    11121118         
    11131119        return(value) 
     1120end 
     1121 
     1122// read the detector deadtime (in seconds) 
     1123Function getDetectorDeadtime(fname) 
     1124        String fname 
     1125         
     1126        return(0) 
    11141127end 
    11151128 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MC_SimulationScripting.ipf

    r924 r940  
    653653End 
    654654 
    655 // instrName = "checkNG3" or "checkNG7" or "checkNGB" 
     655// instrName = "checkCGB" or "checkNG7" or "checkNGB" (checkNG3 has been removed) 
    656656// these are the only allowable choices 
    657657Function Sim_SetInstrument(instrName) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf

    r926 r940  
    13151315End 
    13161316 
     1317// Write the detector deadtime to the file header (in seconds) @ byte 498 
     1318Function WriteDeadtimeToHeader(fname,num) 
     1319        String fname 
     1320        Variable num 
     1321         
     1322        WriteVAXReal(fname,num,498) 
     1323        return(0) 
     1324End 
     1325 
     1326 
     1327 
    13171328//rewrite a text field back to the header 
    13181329// fname is the full path:name 
     
    16931704 
    16941705end 
     1706 
     1707// read the detector deadtime (in seconds) 
     1708Function getDetectorDeadtime(fname) 
     1709        String fname 
     1710         
     1711        return(getRealValueFromHeader(fname,498)) 
     1712end 
     1713 
     1714 
     1715 
    16951716 
    16961717//////  integer values 
     
    29012922 
    29022923 
     2924// May 2014 - SRK 
     2925// Detector Deadtime (possibly) written to file by ICE 
     2926 
     2927Proc PatchDetectorDeadtime(firstFile,lastFile,deadtime) 
     2928        Variable firstFile=1,lastFile=100,deadtime 
     2929 
     2930        fPatchDetectorDeadtime(firstFile,lastFile,deadtime) 
     2931 
     2932End 
     2933 
     2934Proc ReadDetectorDeadtime(firstFile,lastFile) 
     2935        Variable firstFile=1,lastFile=100 
     2936         
     2937        fReadDetectorDeadtime(firstFile,lastFile) 
     2938End 
     2939 
     2940// simple utility to patch the detector deadtime in the file headers 
     2941// pass in the account name as a string 
     2942// lo is the first file number 
     2943// hi is the last file number (inclusive) 
     2944// 
     2945Function fPatchDetectorDeadtime(lo,hi,deadtime) 
     2946        Variable lo,hi,deadtime 
     2947         
     2948        Variable ii 
     2949        String file 
     2950         
     2951        //loop over all files 
     2952        for(ii=lo;ii<=hi;ii+=1) 
     2953                file = FindFileFromRunNumber(ii) 
     2954                if(strlen(file) != 0) 
     2955                        WriteDeadtimeToHeader(file,deadtime)                     
     2956                else 
     2957                        printf "run number %d not found\r",ii 
     2958                endif 
     2959        endfor 
     2960         
     2961        return(0) 
     2962End 
     2963 
     2964// simple utility to read the detector deadtime stored in the file header 
     2965Function fReadDetectorDeadtime(lo,hi) 
     2966        Variable lo,hi 
     2967         
     2968        String file 
     2969        Variable ii,deadtime 
     2970         
     2971        for(ii=lo;ii<=hi;ii+=1) 
     2972                file = FindFileFromRunNumber(ii) 
     2973                if(strlen(file) != 0) 
     2974                        deadtime = getDetectorDeadtime(file) 
     2975                        printf "File %d:  Detector Dead time (s) = %g\r",ii,deadtime 
     2976                else 
     2977                        printf "run number %d not found\r",ii 
     2978                endif 
     2979        endfor 
     2980         
     2981        return(0) 
     2982End 
     2983 
     2984 
     2985 
    29032986///// 
    29042987Proc ReadDetectorCount(firstFile,lastFile) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r925 r940  
    480480//      Instrument                              Date measured                           deadtime constant 
    481481//      NG3                                                     DECEMBER 2009                           1.5 microseconds 
    482 //      NG7                                                     APRIL2010                                       2.3 microseconds 
     482//      NG7                                                     APRIL 2010                              2.3 microseconds 
    483483//      NGB                                                     JAN 2013                                        4 microseconds 
    484484// 
     
    490490// data collection date. 
    491491// 
    492 // 
    493 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr]) 
     492// May 2014 SRK -- optional parameter dtime is the dead time as read in from the file 
     493// -- if if is non-zero, use it. If it's zero, go through tree and pick from the global constants 
     494// 
     495// MAY 2014 -- if the beam is CGB (now that the NG3 SANS has been moved to NGB), the logic 
     496//     drops to select the values from NG3, since nothing has changed. When it does, I'll add in specifics for CGB 
     497// 
     498Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 
    494499        String fileStr,detStr,dateAndTimeStr 
     500        Variable dtime 
    495501         
    496502        Variable deadtime 
     
    509515        NVAR DeadtimeNGB_ORNL_ICE = root:myGlobals:DeadtimeNGB_ORNL_ICE 
    510516        NVAR DeadtimeDefault = root:myGlobals:DeadtimeDefault 
     517         
     518        // if the deadtime passed in is good, return it and get out. MAY 2014 
     519        if(dtime > 0) 
     520                Print "Deadtime from the file = ",dtime 
     521                return(dtime) 
     522        endif 
     523         
    511524         
    512525        // if no date string is passed, default to the ICE values 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/QKK_ANSTO_DataReadWrite.ipf

    r908 r940  
    20712071end 
    20722072 
     2073// read the detector deadtime (in seconds) 
     2074Function getDetectorDeadtime(fname) 
     2075        String fname 
     2076         
     2077        return(0) 
     2078end 
     2079 
     2080// Write the detector deadtime to the file header (in seconds) 
     2081Function WriteDeadtimeToHeader(fname,num) 
     2082        String fname 
     2083        Variable num 
     2084         
     2085        return(0) 
     2086End 
    20732087 
    20742088//reads the wavelength from a reduced data file (not very reliable) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r933 r940  
    3232//                                                      Configurations are outputted to text using command "SaveNICEConfigs()" 
    3333// 
     34//  MAY 2014 SRK -- changed nomenclature of NG3 to be CGB (shows on button as NGB30) - Nothing changes in the simulation 
     35//                  so this change is nothing but cosmetic. I will need to update the flux calibration, but there is no need to keep the old. 
     36// 
     37// 
     38// 
    3439// 
    3540// calculate what q-values you get based on the instruments settings 
     
    5358//              the global -- root:Packages:NIST:SAS:instrument (search for it everywhere...) 
    5459//              x- repair the naming/numbering scheme to look for the string "NGx" and switch on that, not a number, which is unreliable and confusing. 
     60// 
     61// 
     62//      TODO_CGB: 
     63//  For the moved NG3 instrument: 
     64//   -- update the flux values once some measurements have been done 
     65//   -- update the wavelength spread values once they have been measured 
     66//   -- be sure that no other dimensions have been changed after the move 
     67//   -- polarizer is gone now. Be sure apertures are correct in UpdateControls() 
     68//   -- any other changes??? 
    5569// 
    5670// use str2hex(str) (my function) to convert "A" to 10 
     
    118132        // for the panel 
    119133//      Variable/G root:Packages:NIST:SAS:gInst=3               //or 7 for NG7 
    120         String/G root:Packages:NIST:SAS:gInstStr="NG3"          //or "NG7" or "NGB"=10m or "CGB"=NG3 moved 
     134//      String/G root:Packages:NIST:SAS:gInstStr="NG3"          //or "NG7" or "NGB"=10m or "CGB"=NG3 moved 
     135        String/G root:Packages:NIST:SAS:gInstStr="CGB"          //or "NG7" or "NGB"=10m or "CGB"=NG3 moved 
    121136        Variable/G root:Packages:NIST:SAS:gNg=0 
    122137        Variable/G root:Packages:NIST:SAS:gTable=2              //2=chamber, 1=table 
     
    208223        SetDataFolder root:Packages:NIST:SAS 
    209224         
    210         String/G gSelectedInstrument="checkNG3" 
    211         String/G gInstStr = "NG3" 
     225//      String/G gSelectedInstrument="checkNG3" 
     226//      String/G gInstStr = "NG3" 
     227        String/G gSelectedInstrument="checkCGB" 
     228        String/G gInstStr = "CGB" 
    212229         
    213230        Variable/G s12 = 54.8 
     
    340357/// this is the (incomplete) definition of the 10m SANS instrument 
    341358// on NG-B, which will be referred to as NGB here to keep the NG(number) notation 
    342 // reserving NGB for the moved NG3 instrument 
     359// reserving CGB for the moved NG3 instrument 
    343360// which may be simpler here to keep functions from breaking... 
    344361// 
     
    519536        Slider SC_Slider_2,pos={394,21},size={47,65},proc=OffsetSliderProc,live=0,ticks=4 
    520537        Slider SC_Slider_2,limits={0,25,1},variable= root:Packages:NIST:SAS:gOffset//,thumbColor= (1,16019,65535) 
    521         CheckBox checkNG3,pos={20,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG3" 
    522         CheckBox checkNG3,value=1,mode=1 
    523         CheckBox checkNG7,pos={66,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG7" 
     538//      CheckBox checkNG3,pos={20,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG3" 
     539//      CheckBox checkNG3,value=1,mode=1 
     540        CheckBox checkCGB,pos={17,19},size={36,14},proc=SelectInstrumentCheckProc,title="NGB30" 
     541        CheckBox checkCGB,value=1,mode=1 
     542        CheckBox checkNG7,pos={70,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG7" 
    524543        CheckBox checkNG7,value=0,mode=1 
    525544 
     
    530549//      -- hide/unhide the 10m SANS 
    531550        if(show10mSANS) 
    532                 CheckBox checkNGB,pos={110,19},size={40,14},proc=SelectInstrumentCheckProc,title="NGB" 
     551                CheckBox checkNGB,pos={114,19},size={40,14},proc=SelectInstrumentCheckProc,title="NGB" 
    533552                CheckBox checkNGB,value=0,mode=1 
    534553        endif 
     
    551570        Button ClearButton proc=S_ClearButtonProc 
    552571//      GroupBox group0,pos={6,1},size={108,36},title="Instrument" 
    553         GroupBox group0,pos={6,1},size={160,36},title="Instrument" 
     572        GroupBox group0,pos={6,1},size={160,39},title="Instrument" 
    554573        SetDataFolder fldrSav0 
    555574         
     
    614633 
    615634        strswitch(selInstr)     // string switch 
     635                case "CGB": 
    616636                case "NG3":                     //  
    617637                        switch(ng)       
     
    830850 
    831851        strswitch(ctrlName)     // string switch 
    832                 case "checkNG3":                        //  
    833                         checkBox checkNG3,win=SASCALC, value=1 
     852                case "checkCGB":                        //  
     853                        checkBox checkCGB,win=SASCALC, value=1 
    834854                        checkBox checkNG7,win=SASCALC, value=0 
    835855                        checkBox checkNGB,win=SASCALC, value=0 
    836856                        initNG3() 
    837                         break                                            
     857                        break    
     858//              case "checkNG3":                        //  
     859//                      checkBox checkNG3,win=SASCALC, value=1 
     860//                      checkBox checkNG7,win=SASCALC, value=0 
     861//                      checkBox checkNGB,win=SASCALC, value=0 
     862//                      initNG3() 
     863//                      break                                            
    838864                case "checkNG7":                        //  
    839                         checkBox checkNG3,win=SASCALC, value=0 
     865//                      checkBox checkNG3,win=SASCALC, value=0 
     866                        checkBox checkCGB,win=SASCALC, value=0 
    840867                        checkBox checkNG7,win=SASCALC, value=1 
    841868                        checkBox checkNGB,win=SASCALC, value=0  
     
    843870                        break 
    844871                case "checkNGB":                // 10m SANS 
    845                         checkBox checkNG3,win=SASCALC, value=0 
     872//                      checkBox checkNG3,win=SASCALC, value=0 
     873                        checkBox checkCGB,win=SASCALC, value=0 
    846874                        checkBox checkNG7,win=SASCALC, value=0  
    847875                        checkBox checkNGB,win=SASCALC, value=1 
     
    922950                lens = checked   
    923951                strswitch(selInstr)     // string switch 
     952                        case "CGB": 
    924953                        case "NG3": 
    925954                                dist = 1317 
     
    9901019         
    9911020                // instrument specific distance requirements 
    992                 if(cmpstr(selInstr,"NG3") == 0 && dist != 1317) 
     1021//              if(cmpstr(selInstr,"NG3") == 0 && dist != 1317) 
     1022                if(cmpstr(selInstr,"CGB") == 0 && dist != 1317) 
    9931023                        lensNotAllowed=1 
    9941024                endif 
     
    9991029                 
    10001030                // instrument specific wavelength requirements 
    1001                 if(cmpstr(selInstr,"NG3") == 0 && !(lam == 8.4 || lam == 17.2) ) 
     1031//              if(cmpstr(selInstr,"NG3") == 0 && !(lam == 8.4 || lam == 17.2) ) 
     1032                if(cmpstr(selInstr,"CGB") == 0 && !(lam == 8.4 || lam == 17.2) ) 
    10021033                        lensNotAllowed=1 
    10031034                endif 
     
    21812212         
    21822213        strswitch(selInstr)     // string switch 
     2214                case "CGB": 
    21832215                case "NG3": 
    21842216                case "NG7": 
     
    22222254 
    22232255        strswitch(selInstr)     // string switch 
     2256                case "CGB": 
    22242257                case "NG3": 
    22252258                case "NG7": 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf

    r916 r940  
    146146         
    147147        //deadtime corrections to raw data 
    148         deadTime = DetectorDeadtime(raw_text[3],raw_text[9],dateAndTimeStr=raw_text[1])         //pick the correct detector deadtime, switch on date too 
     148        deadTime = DetectorDeadtime(raw_text[3],raw_text[9],dateAndTimeStr=raw_text[1],dtime=raw_reals[48])             //pick the correct detector deadtime, switch on date too 
    149149        itim = raw_ints[2] 
    150150        cntrate = sum(raw_data,-inf,inf)/itim           //080802 use data sum, rather than scaler value 
     
    334334        itim = integersread[2] 
    335335        cntrate = sum(data,-inf,inf)/itim               //use sum of detector counts rather than scaler value 
    336         deadtime = DetectorDeadtime(textread[3],textread[9],dateAndTimeStr=textRead[1]) //pick the correct deadtime 
     336        deadtime = DetectorDeadtime(textread[3],textread[9],dateAndTimeStr=textRead[1],dtime=realsRead[48])     //pick the correct deadtime 
    337337        dscale = 1/(1-deadTime*cntrate) 
    338338         
Note: See TracChangeset for help on using the changeset viewer.