Ignore:
Timestamp:
Apr 10, 2007 9:52:03 AM (15 years ago)
Author:
srkline
Message:

cleaned unused code from WorkFileUtils?.ipf
added comments to NCNR_Utils.ipf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf

    r76 r79  
    66// particular facility or data file format 
    77// branched out 29MAR07 - SRK 
    8  
     8// 
     9// functions are either labeled with the procedure file that calls them, 
     10// or noted that they are local to this file 
    911 
    1012 
     
    1315// - pixexl resolution [cm] 
    1416// - detector deadtime constant [s] 
     17// 
     18// called by Initialize.ipf 
     19// 
    1520Function InitFacilityGlobals() 
    1621 
     
    4651// 
    4752// - 21 MAR 07 uses projected BS diameter on the detector 
     53// - APR 07 still need to add resolution with lenses. currently there is no flag in the  
     54//          raw data header to indicate the presence of lenses. 
     55// 
     56// 
     57// - called by CircSectAvg.ipf and RectAnnulAvg.ipf 
    4858// 
    4959Function/S getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,SigmaQ,QBar,fSubS) 
     
    135145//from the file header 
    136146//Global values are set in the Initialize procedure 
     147// 
     148// 
     149// - called by CircSectAvg.ipf, RectAnnulAvg.ipf, and ProtocolAsPanel.ipf 
     150// 
    137151Function DetectorPixelResolution(fileStr,detStr) 
    138152        String fileStr,detStr 
     
    182196//from the file header 
    183197//Global values are set in the Initialize procedure 
     198// 
     199// - called by WorkFileUtils.ipf 
     200// 
     201// 
    184202Function DetectorDeadtime(fileStr,detStr) 
    185203        String fileStr,detStr 
     
    228246 
    229247/////VAX filename/Run number parsing utilities 
    230 //************************** 
    231 // Vers. 1.2 092101 
    232 // 
    233 //this file is a collection of uilities for processing vax filenames 
     248// 
     249// a collection of uilities for processing vax filenames 
    234250//and processing lists (especially for display in popup menus) 
    235251// 
     
    241257// 
    242258//************************** 
    243  
    244  
     259// 
    245260//given a filename of a SANS data filename of the form 
    246261//TTTTTnnn.SAn_TTT_Txxx 
    247262//returns the run number "nnn" as a number 
    248263//returns -1 as an invalid file number 
     264// 
     265// called by several ipfs 
     266// 
     267// 
    249268Function GetRunNumFromFile(item) 
    250269        String item 
     
    283302//returns the run number "nnn" as a STRING of THREE characters 
    284303//returns "ABC" as an invalid file number 
     304// 
     305// local function to aid in locating files by run number 
     306// 
    285307Function/S GetRunNumStrFromFile(item) 
    286308        String item 
     
    306328End 
    307329 
    308 //returns a string containing the full path and file to the file containing the  
     330//returns a string containing the full path to the file containing the  
    309331//run number "num". The null string is returned if no valid file can be found 
    310332//the path "catPathName" used and is hard-wired, will abort if this path does not exist 
    311333//the file returned will be a RAW SANS data file, other types of files are  
    312334//filtered out. 
     335// 
     336// called by Buttons.ipf and Transmission.ipf, and locally by parsing routines 
     337// 
    313338Function/S FindFileFromRunNumber(num) 
    314339        Variable num 
     
    382407//Function then checks the file fname (full path:file) for "RAW" run.type field 
    383408//if not found, the data is not raw data and zero is returned 
     409// 
     410// called by many procedures (both external and local) 
     411// 
    384412Function CheckIfRawData(fname) 
    385413        String fname 
     
    389417         
    390418        Open/R/T="????TEXT" refNum as fname 
    391         //get the total number of bytes in the file, to avoid moving past EOF 
     419        //get the total number of bytes in the file 
    392420        FStatus refNum 
    393421        totalBytes = V_logEOF 
     
    414442//xtol typically set at -5 (cm) - trans runs have bs(x) at -10 to -15 cm  
    415443// function returns 1 if beamstop is out, 0 if beamstop is in 
     444// 
     445// 
     446// called by Transmission.ipf, CatVSTable.ipf, NSORT.ipf 
    416447// 
    417448Function isTransFile(fName,xTol) 
     
    449480// 
    450481//returns a string identical to the original string, except with the interior spaces removed 
     482// 
     483// local function for file name manipulation 
    451484// 
    452485Function/S RemoveAllSpaces(str) 
     
    477510 
    478511 
    479 //Function attempts to find valid filename from partial name that has been stripped of 
    480 //the VAX version number. The partial name is tried first 
    481 //*** the PATH is hard-wired to catPathName (which is assumed to exist) 
    482 //version numers up to ;10 are tried 
    483 //only the "name;vers" is returned. the path is not prepended, hence the return string 
    484 //is not a complete specification of the file 
     512//Function attempts to find valid filename from partial name by checking for 
     513// the existence of the file on disk. 
     514// - checks as is 
     515// - adds ";vers" for possible VAX files 
     516// - strips spaces 
     517// - permutations of upper/lowercase 
    485518// 
    486519// added 11/99 - uppercase and lowercase versions of the file are tried, if necessary 
     
    488521// upper/lowercase letters, while the filename on the server (should) be all caps 
    489522// now makes repeated calls to ValidFileString() 
     523// 
     524// returns a valid filename (No path prepended) or a null string 
     525// 
     526// called by any functions, both external and local 
    490527// 
    491528Function/S FindValidFilename(partialName) 
     
    533570End 
    534571 
    535 //Function attempts to find valid filename from partial name that has been stripped of 
    536 //the VAX version number. The partial name is tried first 
    537 //*** the PATH is hard-wired to catPathName (which is assumed to exist) 
    538 //version numers up to ;10 are tried 
    539 //only the "name;vers" is returned. the path is not prepended, hence the return string 
    540 //is not a complete specification of the file 
     572// Function checks for the existence of a file 
     573// partialName;vers (to account for VAX filenaming conventions) 
     574// The partial name is tried first with no version number 
     575// 
     576// *** the PATH is hard-wired to catPathName (which is assumed to exist) 
     577// version numers up to ;10 are tried 
     578// only the "name;vers" is returned if successful. The path is not prepended 
     579// 
     580// local function 
    541581// 
    542582Function/S ValidFileString(partialName) 
     
    581621End 
    582622 
    583  
    584  
    585  
    586623//returns a string containing filename (WITHOUT the ;vers) 
    587624//the input string is a full path to the file (Mac-style, still works on Win in IGOR) 
    588625//with the folders separated by colons 
     626// 
     627// called by MaskUtils.ipf, ProtocolAsPanel.ipf, WriteQIS.ipf 
     628// 
    589629Function/S GetFileNameFromPathNoSemi(fullPath) 
    590630        String fullPath 
     
    613653//the input string is a full path to the file (Mac-style, still works on Win in IGOR) 
    614654//with the folders separated by colons 
     655// 
     656// local, currently unused 
     657// 
    615658Function/S GetFileNameFromPathKeepSemi(fullPath) 
    616659        String fullPath 
     
    638681//(Mac-style, separated by colons) and returns this path 
    639682//this partial path is the same string that would be returned from PathInfo, for example 
     683// 
     684// - allows the user to save to a different path than catPathName 
     685// 
     686// called by WriteQIS.ipf 
     687// 
    640688Function/S GetPathStrFromfullName(fullPath) 
    641689        String fullPath 
     
    660708//given the VAX filename, pull off the first 8 characters to make a valid 
    661709//file string that can be used for naming averaged 1-d files 
     710// 
     711// called by ProtocolAsPanel.ipf and Tile_2D.ipf 
     712// 
    662713Function/S GetNameFromHeader(fullName) 
    663714        String fullName 
     
    688739 
    689740//list (input) is a list, typically returned from IndexedFile() 
    690 //which is semicolon-delimited, and may contain filesnames from the VAX 
     741//which is semicolon-delimited, and may contain filenames from the VAX 
    691742//that contain version numbers, where the version number appears as a separate list item 
    692743//(and also as a non-existent file) 
     
    695746//the function returns the list, cleaned of version numbers (up to 11) 
    696747//raw data files will typically never have a version number other than 1. 
     748// 
     749// if there are no version numbers in the list, the input list is returned 
     750// 
     751// called by CatVSTable.ipf, NSORT.ipf, Transmission.ipf, WorkFileUtils.ipf  
     752// 
    697753Function/S RemoveVersNumsFromList(list) 
    698754        String list 
     
    716772//output is equivalent to selecting from the CAT table 
    717773//if some or all of the list items are valid filenames, keep them... 
    718 //if an error is encountered, notify of the offending element and return the null list 
     774//if an error is encountered, notify of the offending element and return a null list 
    719775// 
    720776//output is COMMA delimited 
     
    722778// this routine is expecting that the "ask", "none" special cases are handled elsewhere 
    723779//and not passed here 
     780// 
     781// called by Marquee.ipf, MultipleReduce.ipf, ProtocolAsPanel.ipf 
     782// 
    724783Function/S ParseRunNumberList(list) 
    725784        String list 
     
    771830//expands any range of run numbers into a comma-delimited list... 
    772831//and returns the new list - if not a range, return unchanged 
     832// 
     833// local function 
     834// 
    773835Function/S ExpandNumRanges(list) 
    774836        String list 
     
    797859 
    798860//be sure to add a trailing comma to the return string... 
     861// 
     862// local function 
     863// 
    799864Function/S ListFromDash(item) 
    800865        String item 
     
    824889//NG3 and NG7 attenuators are physically different, so the transmissions are slightly different 
    825890//NG1 - (8m SANS) is not supported 
    826  
     891// 
     892// local function 
     893// 
    827894Proc MakeNG3AttenTable() 
    828895 
     
    895962//the wavelength may be any value between 5 and 20 (A), and is interpolated 
    896963//between calibrated wavelengths for a given attenuator 
     964// 
     965// local function 
     966// 
    897967Function LookupAttenNG3(lambda,attenNo) 
    898968        Variable lambda, attenNo 
     
    9351005// 
    9361006// this set of tables is also used for NG5 (NG1) SANS instrument - as the attenuator has yet to be calibrated 
     1007// 
     1008// local function 
     1009// 
    9371010Function LookupAttenNG7(lambda,attenNo) 
    9381011        Variable lambda, attenNo 
     
    9741047//values, and NG5 attenuators have not been calibrated (as of 8/01) 
    9751048//filestr as passed is textread[3], the default directory 
     1049// 
     1050// Attenuation factor as defined here is <= 1 
     1051// 
     1052// called by Correct.ipf, ProtocolAsPanel.ipf, Transmission.ipf 
     1053// 
    9761054Function AttenuationFactor(fileStr,lam,attenNo) 
    9771055        String fileStr 
     
    10001078End 
    10011079 
    1002 //function called byt the popups to get a file list of data that can be sorted 
     1080//function called by the popups to get a file list of data that can be sorted 
    10031081// this procedure simply removes the raw data files from the string - there 
    10041082//can be lots of other junk present, but this is very fast... 
     
    10081086// another possibility is to get a listing of the text files, but is unreliable on  
    10091087// Windows, where the data file must be .txt (and possibly OSX) 
     1088// 
     1089// called by FIT_Ops.ipf, NSORT.ipf, PlotUtils.ipf 
    10101090// 
    10111091Function/S ReducedDataFileList(ctrlName) 
     
    10471127// does it the "cheap" way, simply finding the ".SAn" in the file name 
    10481128// = does not check for proper byte length. 
     1129// 
     1130// called by PatchFiles.ipf, Tile_2D.ipf 
     1131// 
    10491132Function/S GetRawDataFileList() 
    10501133         
Note: See TracChangeset for help on using the changeset viewer.