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.

File:
1 edited

Legend:

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