Changeset 1003 for sans


Ignore:
Timestamp:
Jun 23, 2016 4:26:43 PM (7 years ago)
Author:
srkline
Message:

* updated the detector dead time constants in NCNR_Utils for the new NISTO hardware *

other changes were to the file catalog and patch files, which are still works in progress.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r945 r1003  
    3636 
    3737        Variable/G root:myGlobals:PixelResDefault = 0.5 
    38          
     38 
     39//Very old - ILL/Cerca-style detectors   
    3940        Variable/G root:myGlobals:DeadtimeNG3_ILL = 3.0e-6              //deadtime in seconds 
    4041        Variable/G root:myGlobals:DeadtimeNG5_ILL = 3.0e-6 
    4142        Variable/G root:myGlobals:DeadtimeNG7_ILL = 3.0e-6 
    4243        Variable/G root:myGlobals:DeadtimeNGB_ILL = 4.0e-6              // fictional 
     44// retired NG5 (NG1) 8m-sans instrument 
     45        Variable/G root:myGlobals:DeadtimeNG5_ORNL = 0.6e-6                     //as of 9 MAY 2002 
     46 
     47// NG3 SANS, moved to NGB (currently named as CGB) 
    4348        Variable/G root:myGlobals:DeadtimeNG3_ORNL_VAX = 3.4e-6         //pre - 23-JUL-2009 used VAX 
    4449        Variable/G root:myGlobals:DeadtimeNG3_ORNL_ICE = 1.5e-6         //post - 23-JUL-2009 used ICE 
    45         Variable/G root:myGlobals:DeadtimeNG5_ORNL = 0.6e-6                     //as of 9 MAY 2002 
     50        Variable/G root:myGlobals:DeadtimeNG3_ORNL_NISTO = 1.0e-6       //post - 22-JUN-2016 using new NISTO 
     51         
     52// NG7 SANS      
    4653        Variable/G root:myGlobals:DeadtimeNG7_ORNL_VAX = 3.4e-6         //pre 25-FEB-2010 used VAX 
    4754        Variable/G root:myGlobals:DeadtimeNG7_ORNL_ICE = 2.3e-6         //post 25-FEB-2010 used ICE 
     55        Variable/G root:myGlobals:DeadtimeNG7_ORNL_NISTO = 1.0e-6       //--post 22-JUN-2016 using new NISTO 
     56 
     57// 10m sans @ NGB        
    4858        Variable/G root:myGlobals:DeadtimeNGB_ORNL_ICE = 4.0e-6         //per JGB 16-JAN-2013, best value we have for the oscillating data 
     59        Variable/G root:myGlobals:DeadtimeNGB_ORNL_NISTO = 1.0e-6               // (not a measured value!) per JGB June 2016, using NISTO, match value to NG7 and CGB 30m as of 27-APR-2016 
     60 
    4961 
    5062//      Variable/G root:myGlobals:DeadtimeCGB_ORNL_ICE = 1.5e-6         // fiction 
     
    484496// 
    485497// 
     498// 
    486499// The day of the switch to ICE on NG7 was 25-FEB-2010 (per J. Krzywon)  
    487500// The day of the switch to ICE on NG3 was 23-JUL-2009 (per C. Gagnon) 
     
    495508// MAY 2014 -- if the beam is CGB (now that the NG3 SANS has been moved to NGB), the logic 
    496509//     drops to select the values from NG3, since nothing has changed. When it does, I'll add in specifics for CGB 
     510// 
     511// 
     512// *** JUNE 2016 *** 
     513// instruments are now using new version of NISTO (all using the same hardware now) 
     514// ** the day of the switch is 22-JUN-2016 ** 
     515// CGB 30m (former NG3)  0.96 us == 1.0 us 
     516// NG7 SANS (measured as 1.02 us == 1.0 us) 
     517// 10m, yet unmeasured (use 1.0 us) starting 27-APR-2016 
     518// ************** 
     519// 
    497520// 
    498521Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 
     
    507530        NVAR DeadtimeNG7_ILL = root:myGlobals:DeadtimeNG7_ILL 
    508531        NVAR DeadtimeNGB_ILL = root:myGlobals:DeadtimeNGB_ILL 
     532         
    509533        NVAR DeadtimeNG3_ORNL_VAX = root:myGlobals:DeadtimeNG3_ORNL_VAX 
    510534        NVAR DeadtimeNG3_ORNL_ICE = root:myGlobals:DeadtimeNG3_ORNL_ICE 
     535        NVAR DeadtimeNG3_ORNL_NISTO = root:myGlobals:DeadtimeNG3_ORNL_NISTO 
    511536//      NVAR DeadtimeCGB_ORNL_ICE = root:myGlobals:DeadtimeCGB_ORNL_ICE 
    512537        NVAR DeadtimeNG5_ORNL = root:myGlobals:DeadtimeNG5_ORNL 
    513538        NVAR DeadtimeNG7_ORNL_VAX = root:myGlobals:DeadtimeNG7_ORNL_VAX 
    514539        NVAR DeadtimeNG7_ORNL_ICE = root:myGlobals:DeadtimeNG7_ORNL_ICE 
     540        NVAR DeadtimeNG7_ORNL_NISTO = root:myGlobals:DeadtimeNG7_ORNL_NISTO 
    515541        NVAR DeadtimeNGB_ORNL_ICE = root:myGlobals:DeadtimeNGB_ORNL_ICE 
     542        NVAR DeadtimeNGB_ORNL_NISTO = root:myGlobals:DeadtimeNGB_ORNL_NISTO 
    516543        NVAR DeadtimeDefault = root:myGlobals:DeadtimeDefault 
    517544         
     
    528555        endif 
    529556         
    530          
     557// the switch from VAX to ICE    
    531558        Variable NG3_to_ICE = ConvertVAXDay2secs("23-JUL-2009") 
    532559        Variable NG7_to_ICE = ConvertVAXDay2secs("25-FEB-2010") 
     560 
     561// dates for the new NISTO hardware      
     562        Variable NG3_to_NISTO = ConvertVAXDay2secs("22-JUN-2016") 
     563        Variable NGB_to_NISTO = ConvertVAXDay2secs("22-JUN-2016") 
     564        Variable NG7_to_NISTO = ConvertVAXDay2secs("27-APR-2016")               //one cycle earlier on 10m 
     565 
     566         
    533567        Variable fileTime = ConvertVAXDay2secs(dateAndTimeStr) 
    534568 
     
    540574                                deadtime= DeadtimeNG3_ILL 
    541575                        else 
    542                                 if(fileTime > NG3_to_ICE) 
     576                                if(fileTime > NG3_to_NISTO) 
     577                                        deadtime = DeadtimeNG3_ORNL_NISTO       //detector is ordella-type, using NISTO hardware 
     578                                endif 
     579                                if(fileTime > NG3_to_ICE && fileTime <= NG3_to_NISTO) 
    543580                                        deadtime = DeadtimeNG3_ORNL_ICE //detector is ordella-type, using ICE hardware 
    544                                 else 
    545                                         deadtime = DeadtimeNG3_ORNL_VAX //detector is ordella-type 
     581                                endif 
     582                                if(fileTime <= NG3_to_ICE) 
     583                                        deadtime = DeadtimeNG3_ORNL_VAX //detector is ordella-type, VAX hardware 
    546584                                endif 
    547585                        endif 
     
    558596                                deadtime= DeadtimeNG7_ILL 
    559597                        else 
    560                                 if(fileTime > NG7_to_ICE) 
     598                                if(fileTime > NG7_to_NISTO) 
     599                                        deadtime = DeadtimeNG7_ORNL_NISTO       //detector is ordella-type, using NISTO hardware 
     600                                endif 
     601                                if(fileTime > NG7_to_ICE && fileTime <= NG7_to_NISTO) 
    561602                                        deadtime = DeadtimeNG7_ORNL_ICE //detector is ordella-type, using ICE hardware 
    562                                 else 
    563                                         deadtime = DeadtimeNG7_ORNL_VAX //detector is ordella-type 
    564603                                endif 
     604                                if(fileTime <= NG7_to_ICE) 
     605                                        deadtime = DeadtimeNG7_ORNL_VAX //detector is ordella-type, VAX hardware 
     606                                endif 
     607                         
    565608                        endif 
    566609                        break 
     
    570613                                deadtime= DeadtimeNGB_ILL 
    571614                        else 
    572                                 deadtime = DeadtimeNGB_ORNL_ICE //detector is ordella-type, using ICE hardware 
     615                                if(fileTime > NGB_to_NISTO) 
     616                                        deadtime = DeadtimeNGB_ORNL_NISTO       //detector is ordella-type, using NISTO hardware 
     617                                else 
     618                                        deadtime = DeadtimeNGB_ORNL_ICE //detector is ordella-type, using ICE hardware 
     619                                endif 
    573620                        endif 
    574621//                      Print "Using fictional values for NGB dead time" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf

    r1002 r1003  
    153153//     But typically, I'd like to see that the disk version really did get updated... 
    154154// 
    155                 V_CleanOutRawVSANS() 
    156  
    157  
     155        //      V_CleanOutRawVSANS() 
     156// This will display a progress bar 
     157        V_CleanupData_w_Progress(0,1) 
    158158 
    159159 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf

    r1002 r1003  
    342342        // TODO -- decide if this is really necessary 
    343343//       
    344         V_CleanOutRawVSANS() 
     344//      V_CleanOutRawVSANS() 
     345// present a progress window 
     346        V_CleanupData_w_Progress(0,1) 
    345347        Printf "Hook cleaned out RawVSANS, experiment saved\r" 
    346348 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf

    r1002 r1003  
    220220        NVAR gRadioVal= root:Packages:NIST:VSANS:Globals:Patch:gRadioVal 
    221221         
    222  
    223  
    224222        // run number list 
    225223        if(gRadioVal == 1) 
    226 //              list = ParseRunNumberList(match)                //slow, file access every time 
    227 //              list = ReplaceString(",", list, ";") 
    228 //              newList = list 
    229  
    230 // cut this 0ct 2014 -- the ListMatch at the bottom returns bad results when certain conditions are met: 
    231 // -- for example OCT14nnn runs will return all of the OCT141nn runs if you try to match run 141 
    232 // 
    233 //               
    234 //              list = ExpandNumRanges(match)           //now simply comma delimited 
    235 //              num=ItemsInList(list,",") 
    236 //              for(ii=0;ii<num;ii+=1) 
    237 //                      item = StringFromList(ii,list,",") 
    238 //                      val=str2num(item) 
    239 //                      //make a three character string of the run number 
    240 //                      if(val<10) 
    241 //                              numStr = "00"+num2str(val) 
    242 //                      else 
    243 //                              if(val<100) 
    244 //                                      numStr = "0"+num2str(val) 
    245 //                              else 
    246 //                                      numStr = num2str(val) 
    247 //                              Endif 
    248 //                      Endif 
    249 //                      runList += ListMatch(newList,"*"+numStr+"*",";") 
    250 //                       
    251 //              endfor           
    252                  
    253 // oct 2014 -- try this way:     
    254 // TODO -- replace call 
    255 //              list = ExpandNumRanges(match)           //now simply comma delimited 
     224                         
     225                list = V_ExpandNumRanges(match)         //now simply comma delimited 
    256226                num=ItemsInList(list,",") 
    257227                for(ii=0;ii<num;ii+=1) 
     
    259229                        val=str2num(item) 
    260230 
    261 // TODO -- replace call 
    262 //                      runList += GetFileNameFromPathNoSemi(FindFileFromRunNumber(val)) + ";" 
    263                          
     231                        runList += V_GetFileNameFromPathNoSemi(V_FindFileFromRunNumber(val)) + ";"               
    264232                endfor 
    265233                newlist = runList 
     
    299267                        item=StringFromList(ii, newList , ";") 
    300268                        fname = path + item 
    301 // TODO -- replace call 
    302 //                      sdd = getSDD(fname) 
     269// TODO -- replace call -- this is hard-wired for "FL" 
     270                        sdd = V_getDet_ActualDistance(fname,"FL") 
    303271                        if(pos == -1) 
    304272                                //no wildcard 
     
    690658Proc V_Patch_Panel() 
    691659        PauseUpdate; Silent 1      // building window... 
    692         NewPanel /W=(519,85,950,608)/K=1 as "Patch Raw VSANS Data Files" 
    693 //      NewPanel /W=(519,85,950,608) as "Patch Raw SANS Data Files" 
     660        NewPanel /W=(519,85,950,608)/K=2 as "Patch Raw VSANS Data Files" 
    694661        DoWindow/C V_Patch_Panel 
    695662        ModifyPanel cbRGB=(1,39321,19939) 
     
    992959 
    993960//simple action for button to close the panel 
     961// 
     962// cleans out the RawVSANS folder on closing  
     963// 
    994964Function DoneButtonProc(ctrlName) : ButtonControl 
    995965        String ctrlName 
    996          
     966 
    997967        DoWindow/K V_Patch_Panel 
    998          
     968 
     969//      V_CleanOutRawVSANS() 
     970// present a progress window 
     971        V_CleanupData_w_Progress(0,1)    
     972         
     973        return(0) 
    999974End 
    1000975 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf

    r1002 r1003  
    110110 
    111111// TODO: 
    112 // -- this still does not quite work. If there are no sub folders present in the RawVSANS folder 
     112// x- this still does not quite work. If there are no sub folders present in the RawVSANS folder 
    113113//    it still thinks there are (1) item there. 
    114114// -- if I replace the semicolon with a comma, it thinks there are two folders present and appears 
    115115//    to delete the RawVSANS folder itself! seems very dangerous...this is because DataFolderDir returns 
    116116//    a comma delimited list, but with a semicolon and \r at the end. need to remove these... 
     117// 
     118// NOTE -- use V_CleanupData_w_Progress(0,1) to get a progress bar - since this will take more than 
     119//     a few seconds to complete, especially if a file catalog was done, or a "batch" patching, etc. 
     120// 
    117121Function V_CleanOutRawVSANS() 
    118122 
     
    151155        return(0) 
    152156End 
     157 
     158// 
     159// examples straight from Wavemetrics help file topic "Progress Windows" 
     160// Try simpletest(0,0) and simpletest(1,0), simpletest(0,1) and simpletest(1,1) 
     161// 
     162// 
     163// look for simpletest() function in Wavemetrics help file topic "Progress Windows" 
     164//  this is a modified version. 
     165// 
     166// call with (1,1) to get the candystripe bar 
     167// call with (0,1) to the the "countdown" bar as they are killed 
     168// 
     169Function V_CleanupData_w_Progress(indefinite, useIgorDraw) 
     170        Variable indefinite 
     171        Variable useIgorDraw            // True to use Igor's own draw method rather than native 
     172         
     173        Variable num 
     174         
     175        // is there anything there to be killed? 
     176        num = V_CleanOutOneRawVSANS() 
     177        if(num <= 0) 
     178                return(0) 
     179        endif 
     180         
     181        // there are some folders to kill, so proceed 
     182         
     183        NewPanel /N=ProgressPanel /W=(285,111,739,193) 
     184        ValDisplay valdisp0,pos={18,32},size={342,18},limits={0,num,0},barmisc={0,0} 
     185        ValDisplay valdisp0,value= _NUM:0 
     186        DrawText 20,24,"Cleaning up old files... Please Wait..." 
     187         
     188        if( indefinite ) 
     189                ValDisplay valdisp0,mode= 4     // candy stripe 
     190        else 
     191                ValDisplay valdisp0,mode= 3     // bar with no fractional part 
     192        endif 
     193        if( useIgorDraw ) 
     194                ValDisplay valdisp0,highColor=(15000,45535,15000)               //(0,65535,0) 
     195        endif 
     196        Button bStop,pos={375,32},size={50,20},title="Stop" 
     197        DoUpdate /W=ProgressPanel /E=1  // mark this as our progress window 
     198 
     199        do 
     200                num = V_CleanOutOneRawVSANS() 
     201                if( V_Flag == 2 || num == 0 || num == -1)       // either "stop" or clean exit, or "done" exit from function 
     202                        break 
     203                endif 
     204                 
     205                ValDisplay valdisp0,value= _NUM:num,win=ProgressPanel 
     206                DoUpdate /W=ProgressPanel 
     207        while(1) 
     208         
     209 
     210        KillWindow ProgressPanel 
     211        return(0) 
     212End 
     213 
     214 
     215// TODO: 
     216// x- this still does not quite work. If there are no sub folders present in the RawVSANS folder 
     217//    it still thinks there are (1) item there. 
     218// -- if I replace the semicolon with a comma, it thinks there are two folders present and appears 
     219//    to delete the RawVSANS folder itself! seems very dangerous...this is because DataFolderDir returns 
     220//    a comma delimited list, but with a semicolon and \r at the end. need to remove these... 
     221// 
     222// -- for use with progress bar, kills only one folder, returns the new number of folders left 
     223// -- if n(in) = n(out), nothing was able to be killed, so return "done" code 
     224Function V_CleanOutOneRawVSANS() 
     225 
     226        SetDataFolder root:Packages:NIST:VSANS:RawVSANS: 
     227         
     228        // get a list of the data folders there 
     229        // kill them all if possible 
     230        String list,item 
     231        Variable numFolders,ii,pt,numIn 
     232         
     233        list = DataFolderDir(1) 
     234        // this has FOLDERS: at the beginning and is comma-delimited 
     235        list = list[8,strlen(list)] 
     236        pt = strsearch(list,";",inf,1) 
     237        list = list[0,pt-1]                     //remove the ";\r" from the end of the string 
     238//      print list 
     239         
     240        numFolders = ItemsInList(list , ",") 
     241        numIn = numFolders 
     242//      Print List 
     243//      print strlen(list) 
     244 
     245        if(numIn > 0) 
     246                item = StringFromList(0, list ,",") 
     247//              Print item 
     248                KillDataFolder/Z $(item) 
     249        endif 
     250 
     251        list = DataFolderDir(1) 
     252        list = list[8,strlen(list)] 
     253        pt = strsearch(list,";",inf,1) 
     254        list = list[0,pt-1] 
     255        numFolders = ItemsInList(list, ",") 
     256         
     257        if(numIn == numFolders) 
     258                Printf "%g RawVSANS folders could not be killed\r",numFolders 
     259                SetDataFolder root: 
     260 
     261                return (-1) 
     262        endif 
     263         
     264        SetDataFolder root:      
     265        return(numFolders) 
     266End 
     267 
     268 
     269 
     270 
    153271 
    154272//given a filename of a SANS data filename of the form 
Note: See TracChangeset for help on using the changeset viewer.