Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import h5py import numpy fid = h5py.File('myfile.h5m', 'r') # Get the name of the measurements/groups in the file: print(fid.keys) # Get the name of the signals in the measurement: print(fid['measurement'].keys()) # Get the data as numpy array: numpy.array(fid['name of the test']['name of the signal']) # Get the units of the signal: fid['name of the test']['name of the signal'].attrs['unit'] |
For more information regarding h5py, see https://docs.h5py.org/
With pymarin
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import pymarin # Get the groups as list of pymarin.SignalSet: sets_list = pymarin.io.h5m.read(‘afile.h5m’) # Or rather get the groups as a dictionary: sets_dict = pymarin.io.h5m.read(‘afile.h5m’, returnAsDict=True) # Pick some measurement in the list/dict: aset = sets_list[0] another_set = sets_dict[‘100.00 Hz’] # Get a signal using its name: asignal = aset[‘signal_name’] # Or using its index: another_signal = aset[1] # Accessing some attributes of the signal: data = asignal.data name = asignal.key.name unit = asignal.key.unit |
...
Overview
Content Tools