neutrons / PyVDrive

A data reduction and analysis software for (SNS) VULCAN based on PyQt.
2 stars 0 forks source link

Load sample logs by h5py #199

Closed wdzhou closed 5 years ago

wdzhou commented 5 years ago

LoadEventNexus(MetaDataOnly) may have a bad performance (i.e., speed).

Example

nexus_name = '/SNS/VULCAN/IPTS-22862/nexus/VULCAN_172282.nxs.h5'
ws = LoadEventNexus(Filename=nexus_name, MetaDataOnly=True)
....
LoadEventNexus-[Notice] LoadEventNexus successful, Duration 1 minutes 27.30 seconds
def get_log(h5_name):
    ...:     t0 = time.time()
    ...:     h5_file = h5py.File(h5_name)
    ...:     log_entry = h5_file['entry']['DASlogs']['loadframe.furnace1']
    ...:     times = log_entry['time'][:]
    ...:     value = log_entry['value'][:]
    ...:     h5_file.close()
    ...:     tf = time.time()
    ...:     return times, value, tf - t0
    ...: 
 r = get_log('/SNS/VULCAN/IPTS-22862/nexus/VULCAN_172282.nxs.h5')

Out[36]: 0.01972484588623047 (seconds)

Tasks

wdzhou commented 5 years ago

Instead a homemade sample log loader from NeXus file, Mantid algorithm LoadNexusLogs is used and tested for the same purpose and performance.