Ignore:
Timestamp:
Jun 7, 2011 4:06:02 PM (12 years ago)
Author:
srkline
Message:

Fixes in HFIR_DataReadWrite (JaeHie? Cho). Now the reader it writes back if attr. entry does not exist in the data file.

File:
1 edited

Legend:

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

    r795 r804  
    757757        String fname 
    758758         
    759         return(getRealValueFromHeader(fname,"",""))  // (Unused, return 0)  
     759        return(getRealValueFromHeader(fname,"//Counters/detector",""))   
    760760end 
    761761 
     
    11541154         
    11551155        val =   XMLstrFmXpath(refNum,wantedterm,"","") 
     1156 
     1157        // Case of no value or zero value, check if written by HFIR Patch 
     1158        if (stringmatch(wantedterm,"//*")>0&& strlen(val) ==0) 
     1159                 wantedterm = "//" +  StringFromList(3, wantedterm,"//") 
     1160                 // if valid wnatedterm 
     1161                 if (strlen(wantedterm) >1) 
     1162                        val =   XMLstrFmXpath(refNum,wantedterm,"","") 
     1163                 endif 
     1164        endif    
    11561165        unitstr =  RemoveAllSpaces(XMLstrFmXpath(refNum,wantedterm+"/@units","","")) 
    11571166         
     
    11971206                //Find the value,unit, and type of the value: a little ugly but faster... 
    11981207                val =   XMLstrFmXpath(refNum,wantedterm,"","") 
     1208                // Case of no value or zero value, check if it written by HFIR Patch 
     1209                if (stringmatch(wantedterm,"//*")>0&& strlen(val) ==0) 
     1210                        wantedterm = "//" +  StringFromList(3, wantedterm,"//") 
     1211                        // if valid wnatedterm 
     1212                        if (strlen(wantedterm) >1) 
     1213                                val =   XMLstrFmXpath(refNum,wantedterm,"","") 
     1214                        endif 
     1215                endif 
    11991216                unitstr =  RemoveAllSpaces(XMLstrFmXpath(refNum,wantedterm+"/@units","","")) 
    12001217                typestr =  RemoveAllSpaces(XMLstrFmXpath(refNum,wantedterm+"/@type","","")) 
     
    13301347                else   //(stringmatch(tempheadhfir,wantedterm)>0)        
    13311348                        val =   XMLstrFmXpath(refNum,wantedterm,"","") 
    1332                  
     1349                        // if no regular entry is found, check patch entry. 
     1350                        if (stringmatch(wantedterm,"//*")>0&& strlen(val) ==0) 
     1351                                wantedterm = "//" +  StringFromList(3, wantedterm,"//") 
     1352                                // if valid wnatedterm 
     1353                                if (strlen(wantedterm) >1) 
     1354                                        val =   XMLstrFmXpath(refNum,wantedterm,"","") 
     1355                                endif 
     1356                        endif 
    13331357                        //Special case starts!!!  
    13341358                        //No unit founds in hfir ("mm") file but needs to convert to meters. Let's give it one. 
     
    13701394                                // remove "/SPICErack/" from wantedterm  
    13711395                                wantedterm = StringFromList(2, wantedterm,"/SPICErack/") 
     1396                        elseif (stringmatch(wantedterm,"//*")>0&& strlen(val) ==0) 
     1397                                nstr = "/SPICErack" 
     1398                                //remove'//' to wantedterm  
     1399                                wantedterm = StringFromList(2, wantedterm,"//") 
    13721400                        else 
    13731401                                XMLsetNodeStr(refNum,wantedterm,"",valstr)      //to set 
Note: See TracChangeset for help on using the changeset viewer.