Ignore:
Timestamp:
Jun 23, 2016 4:26:43 PM (6 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/VSANS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.