Ignore:
Timestamp:
Jun 8, 2017 1:27:07 PM (6 years ago)
Author:
srkline
Message:

Significant changes to the base READ of individual data fields from data files. Now, if the field requested is from a WORK file, and it does not exist, an error condition is returned (or a null wave). Calling procedures are responsible for handling errors. This prevents a string of open file dialogs if fields are missing from a file if they were never in the file to begin with (like sensor logs, polarization hardware, etc.)

New get/write calls were added for the updated temperature sensor fields.

group_ID is now only in the sample block, not the duplicated in the reduction block, and is correctly a number not a string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf

    r1042 r1044  
    259259End 
    260260 
    261 // TODO - should be the file name as saved on disk, currently it's not 
    262 Function/S V_getFile_name(fname) 
    263         String fname 
    264          
    265         String path = "entry:file_name"  
    266         Variable num=60 
    267         return(V_getStringFromHDF5(fname,path,num)) 
    268 End 
    269                  
    270 // 
    271 Function/S V_getHDF_version(fname) 
    272         String fname 
    273          
    274         String path = "entry:hdf_version"        
    275         Variable num=60 
    276         return(V_getStringFromHDF5(fname,path,num)) 
    277 End 
     261// cut in JUNE 2017 
     262//// TODO - should be the file name as saved on disk, currently it's not 
     263//Function/S V_getFile_name(fname) 
     264//      String fname 
     265//       
     266//      String path = "entry:file_name"  
     267//      Variable num=60 
     268//      return(V_getStringFromHDF5(fname,path,num)) 
     269//End 
     270 
     271// cut in JUNE 2017              
     272//// 
     273//Function/S V_getHDF_version(fname) 
     274//      String fname 
     275//       
     276//      String path = "entry:hdf_version"        
     277//      Variable num=60 
     278//      return(V_getStringFromHDF5(fname,path,num)) 
     279//End 
    278280 
    279281// TODO -- not mine, added somewhere by Nexus writer? 
     
    328330// TODO -- for the control section, document each of the fields 
    329331 
    330 Function/S V_getCount_end(fname) 
    331         String fname 
    332          
    333         Variable num 
    334         String path = "entry:control:count_end"  
    335         return(V_getStringFromHDF5(fname,path,num)) 
    336 end 
    337  
    338  
    339 Function/S V_getCount_start(fname) 
    340         String fname 
    341          
    342         Variable num 
    343         String path = "entry:control:count_start"        
    344         return(V_getStringFromHDF5(fname,path,num)) 
    345 end 
     332// cut in JUNE 2017 
     333//Function/S V_getCount_end(fname) 
     334//      String fname 
     335//       
     336//      Variable num 
     337//      String path = "entry:control:count_end"  
     338//      return(V_getStringFromHDF5(fname,path,num)) 
     339//end 
     340 
     341// cut in JUNE 2017 
     342// 
     343//Function/S V_getCount_start(fname) 
     344//      String fname 
     345//       
     346//      Variable num 
     347//      String path = "entry:control:count_start"        
     348//      return(V_getStringFromHDF5(fname,path,num)) 
     349//end 
    346350 
    347351 
     
    377381end 
    378382 
    379  
    380 Function V_getIntegral(fname) 
    381         String fname 
    382          
    383         String path = "entry:control:integral"   
    384         return(V_getRealValueFromHDF5(fname,path)) 
    385 end 
     383// cut in JUNE 2017 
     384// 
     385//Function V_getIntegral(fname) 
     386//      String fname 
     387//       
     388//      String path = "entry:control:integral"   
     389//      return(V_getRealValueFromHDF5(fname,path)) 
     390//end 
    386391 
    387392// control mode for data acquisition, "timer" 
     
    411416end 
    412417 
     418// cut in JUNE 2017 
    413419// TODO - what are the enumerated types for this? 
    414 Function/S V_getPreset(fname) 
    415         String fname 
    416          
    417         Variable num 
    418         String path = "entry:control:preset"     
    419         return(V_getStringFromHDF5(fname,path,num)) 
    420 end 
     420//Function/S V_getPreset(fname) 
     421//      String fname 
     422//       
     423//      Variable num 
     424//      String path = "entry:control:preset"     
     425//      return(V_getStringFromHDF5(fname,path,num)) 
     426//end 
    421427 
    422428 
     
    20432049End 
    20442050 
     2051Function V_getSampleTemperature(fname) 
     2052        String fname 
     2053         
     2054        String path = "entry:sample:temperature"         
     2055        return(V_getRealValueFromHDF5(fname,path)) 
     2056end 
     2057 
     2058Function V_getSampleTempSetPoint(fname) 
     2059        String fname 
     2060         
     2061        String path = "entry:sample:temperature_setpoint"        
     2062        return(V_getRealValueFromHDF5(fname,path)) 
     2063end 
     2064 
     2065 
    20452066//Sample Thickness 
    20462067// TODO -- somehow, this is not set correctly in the acquisition, so NaN results 
     
    20772098 
    20782099 
    2079  
     2100// 
     2101// TODO -- this is all a big mess with the changes in the data file structure 
     2102//  in JUNE 2017, which completely wrecks what was decided in 2016. 
     2103// Now, I'm not sure at all what I'll get...or what the field will be called... or what they mean... 
     2104// 
     2105// 
    20802106//// SAMPLE / DATA LOGS 
    20812107// write this generic , call with the name of the environment log desired 
    20822108// 
    2083 // temperature_1 
    2084 // temperature_2 
    2085 // temperature_3 
    2086 // temperature_4 
     2109// 
    20872110// shear_field 
    20882111// pressure 
     
    21182141End 
    21192142 
    2120 // TODO -- this may not exist if it is not a "controlling" sensor, but there still may be logged data present 
    2121 // TODO -- it may also have different names for each sensor (setpoint_1, setpoint_2, etc. which will be a big hassle) 
    2122 Function V_getLog_setPoint(fname,logStr) 
     2143 
     2144 
     2145// for temperature only, logStr = "temperature_env" 
     2146Function/S V_getTemp_ControlSensor(fname,logStr) 
    21232147        String fname,logStr 
    2124          
    2125         String path = "entry:sample:"+logstr+":setpoint_1" 
    2126         return(V_getRealValueFromHDF5(fname,path)) 
    2127 end 
    2128  
    2129 Function/S V_getLog_startTime(fname,logStr) 
     2148 
     2149        String path = "entry:sample:"+logstr+":control_sensor" 
     2150        Variable num=60 
     2151        return(V_getStringFromHDF5(fname,path,num)) 
     2152End 
     2153 
     2154// for temperature only, logStr = "temperature_env" 
     2155Function/S V_getTemp_MonitorSensor(fname,logStr) 
    21302156        String fname,logStr 
    21312157 
    2132         String path = "entry:sample:"+logstr+":start" 
    2133         Variable num=60 
    2134         return(V_getStringFromHDF5(fname,path,num)) 
    2135 End 
    2136  
    2137  
    2138 // TODO -- this may only exist for electric field and magnetic field... 
    2139 // or may be elimnated altogether 
    2140 Function V_getLog_nomValue(fname,logStr) 
     2158        String path = "entry:sample:"+logstr+":monitor_sensor" 
     2159        Variable num=60 
     2160        return(V_getStringFromHDF5(fname,path,num)) 
     2161End 
     2162 
     2163         
     2164 
     2165//// TODO -- this may not exist if it is not a "controlling" sensor, but there still may be logged data present 
     2166//// TODO -- it may also have different names for each sensor (setpoint_1, setpoint_2, etc. which will be a big hassle) 
     2167//Function V_getLog_setPoint(fname,logStr) 
     2168//      String fname,logStr 
     2169//       
     2170//      String path = "entry:sample:"+logstr+":setpoint_1" 
     2171//      return(V_getRealValueFromHDF5(fname,path)) 
     2172//end 
     2173// 
     2174//Function/S V_getLog_startTime(fname,logStr) 
     2175//      String fname,logStr 
     2176// 
     2177//      String path = "entry:sample:"+logstr+":start" 
     2178//      Variable num=60 
     2179//      return(V_getStringFromHDF5(fname,path,num)) 
     2180//End 
     2181// 
     2182// 
     2183//// TODO -- this may only exist for electric field and magnetic field... 
     2184//// or may be eliminated altogether 
     2185//Function V_getLog_nomValue(fname,logStr) 
     2186//      String fname,logStr 
     2187//       
     2188//      String path = "entry:sample:"+logstr+":value" 
     2189//      return(V_getRealValueFromHDF5(fname,path)) 
     2190//end 
     2191 
     2192 
     2193 
     2194/////////// 
     2195// for temperature, the "attached_to", "measurement", and "name" fields 
     2196// are one level down farther than before, and down deeper than for other sensors 
     2197// 
     2198// 
     2199// read the value of V_getTemp_MonitorSensor/ControlSensor to get the name of the sensor level . 
     2200// 
     2201 
     2202Function/S V_getTempLog_attachedTo(fname,logStr) 
    21412203        String fname,logStr 
    2142          
    2143         String path = "entry:sample:"+logstr+":value" 
    2144         return(V_getRealValueFromHDF5(fname,path)) 
    2145 end 
    2146  
     2204 
     2205        String path = "entry:sample:temperature_env:"+logstr+":attached_to" 
     2206        Variable num=60 
     2207        return(V_getStringFromHDF5(fname,path,num)) 
     2208End 
     2209 
     2210Function V_getTempLog_highTrip(fname,logStr) 
     2211        String fname,logStr 
     2212         
     2213        String path = "entry:sample:temperature_env:"+logstr+":high_trip_value" 
     2214        return(V_getRealValueFromHDF5(fname,path)) 
     2215end 
     2216 
     2217Function V_getTempLog_holdTime(fname,logStr) 
     2218        String fname,logStr 
     2219         
     2220        String path = "entry:sample:temperature_env:"+logstr+":hold_time" 
     2221        return(V_getRealValueFromHDF5(fname,path)) 
     2222end 
     2223 
     2224Function V_getTempLog_lowTrip(fname,logStr) 
     2225        String fname,logStr 
     2226         
     2227        String path = "entry:sample:temperature_env:"+logstr+":low_trip_value" 
     2228        return(V_getRealValueFromHDF5(fname,path)) 
     2229end 
     2230 
     2231Function/S V_getTempLog_measurement(fname,logStr) 
     2232        String fname,logStr 
     2233 
     2234        String path = "entry:sample:temperature_env:"+logstr+":measurement" 
     2235        Variable num=60 
     2236        return(V_getStringFromHDF5(fname,path,num)) 
     2237End 
     2238 
     2239 
     2240Function/S V_getTempLog_Model(fname,logStr) 
     2241        String fname,logStr 
     2242 
     2243        String path = "entry:sample:temperature_env:"+logstr+":model" 
     2244        Variable num=60 
     2245        return(V_getStringFromHDF5(fname,path,num)) 
     2246End 
     2247 
     2248Function/S V_getTempLog_Name(fname,logStr) 
     2249        String fname,logStr 
     2250 
     2251        String path = "entry:sample:temperature_env:"+logstr+":name" 
     2252        Variable num=60 
     2253        return(V_getStringFromHDF5(fname,path,num)) 
     2254End 
     2255 
     2256Function V_getTempLog_runControl(fname,logStr) 
     2257        String fname,logStr 
     2258         
     2259        String path = "entry:sample:temperature_env:"+logstr+":run_control" 
     2260        return(V_getRealValueFromHDF5(fname,path)) 
     2261end 
     2262 
     2263Function V_getTempLog_Setpoint(fname,logStr) 
     2264        String fname,logStr 
     2265         
     2266        String path = "entry:sample:temperature_env:"+logstr+":setpoint" 
     2267        return(V_getRealValueFromHDF5(fname,path)) 
     2268end 
     2269 
     2270Function/S V_getTempLog_ShortName(fname,logStr) 
     2271        String fname,logStr 
     2272 
     2273        String path = "entry:sample:temperature_env:"+logstr+":short_name" 
     2274        Variable num=60 
     2275        return(V_getStringFromHDF5(fname,path,num)) 
     2276End 
     2277 
     2278Function V_getTempLog_Timeout(fname,logStr) 
     2279        String fname,logStr 
     2280         
     2281        String path = "entry:sample:temperature_env:"+logstr+":timeout" 
     2282        return(V_getRealValueFromHDF5(fname,path)) 
     2283end 
     2284 
     2285Function V_getTempLog_Tolerance(fname,logStr) 
     2286        String fname,logStr 
     2287         
     2288        String path = "entry:sample:temperature_env:"+logstr+":tolerance" 
     2289        return(V_getRealValueFromHDF5(fname,path)) 
     2290end 
     2291 
     2292Function V_getTempLog_ToleranceBand(fname,logStr) 
     2293        String fname,logStr 
     2294         
     2295        String path = "entry:sample:temperature_env:"+logstr+":tolerance_band_time" 
     2296        return(V_getRealValueFromHDF5(fname,path)) 
     2297end 
     2298 
     2299Function V_getTempLog_Value(fname,logStr) 
     2300        String fname,logStr 
     2301         
     2302        String path = "entry:sample:temperature_env:"+logstr+":value" 
     2303        return(V_getRealValueFromHDF5(fname,path)) 
     2304end 
     2305 
     2306 
     2307 
     2308 
     2309 
     2310 
     2311// 
     2312// temperature_env:temp_Internal_1:value_log 
     2313// 
    21472314////            value_log (data folder) 
    2148  
     2315// 
     2316// TODO: 
     2317// -- be sure that the calling function properly calls for temperture 
     2318// logs which are down an extra layer: 
     2319//      for example, logStr = "temperature_env:temp_Internal_1" 
     2320// 
     2321// read the value of V_getTemp_MonitorSensor to get the name of the sensor the next level down. 
     2322// 
    21492323Function V_getLog_avgValue(fname,logStr) 
    21502324        String fname,logStr 
     
    21842358// DONE -- this needs to be a WAVE reference 
    21852359// DONE -- verify that the field is really read in as "time0" 
    2186 Function V_getLog_time(fname,logStr,outW) 
     2360Function V_getLog_timeWave(fname,logStr,outW) 
    21872361        String fname,logStr 
    21882362        Wave outW 
     
    21962370 
    21972371// DONE -- this needs to be a WAVE reference 
    2198 Function V_getLog_Value(fname,logStr,outW) 
     2372Function V_getLog_ValueWave(fname,logStr,outW) 
    21992373        String fname,logStr 
    22002374        Wave outW 
Note: See TracChangeset for help on using the changeset viewer.