Read ZeMA dataset and preprocess data

[13]:
import json

import h5py
from pooch import retrieve
[14]:
def local_path_to_dataset_after_download_if_required():
    ZEMA_DATASET_URL = (
        "https://zenodo.org/record/5185953/files/axis11_2kHz_ZeMA_PTB_SI.h5"
    )
    return retrieve(
        url=ZEMA_DATASET_URL,
        known_hash=None,
        progressbar=True,
    )
[17]:
def print_attrs(h5py_dataset_or_group):
    for key in h5py_dataset_or_group.attrs:
        print(key)
        val = json.loads(h5py_dataset_or_group.attrs[key])
        if isinstance(val, dict):
            for subkey, subval in val.items():
                print(f"   {subkey}  : {subval}")
        else:
            print(f"   {val}")
[18]:
with h5py.File(local_path_to_dataset_after_download_if_required(), "r") as h5f:
    print_attrs(h5f)
Experiment
   date  : 2021-03-29/2021-04-15
   DUT  : Festo ESBF cylinder
   identifier  : axis11
   label  : Electromechanical cylinder no. 11
Person
   dc:author  : ['Tanja Dorst', 'Maximilian Gruber', 'Anupam Prasad Vedurmudi']
   e-mail  : ['t.dorst@zema.de', 'maximilian.gruber@ptb.de', 'anupam.vedurmudi@ptb.de']
   affiliation  : ['ZeMA gGmbH', 'Physikalisch-Technische Bundesanstalt', 'Physikalisch-Technische Bundesanstalt']
Project
   fullTitle  : Metrology for the Factory of the Future
   acronym  : Met4FoF
   websiteLink  : www.met4fof.eu
   fundingSource  : European Commission (EC)
   fundingAdministrator  : EURAMET
   funding programme  : EMPIR
   fundingNumber  : 17IND12
   acknowledgementText  : This work has received funding within the project 17IND12 Met4FoF from the EMPIR program co-financed by the Participating States and from the European Union's Horizon 2020 research and innovation program. The authors want to thank Clifford Brown, Daniel Hutzschenreuter, Holger Israel, Giacomo Lanza, Björn Ludwig, and Julia Neumann fromPhysikalisch-Technische Bundesanstalt (PTB) for their helpful suggestions and support.
Publication
   dc:identifier  : 10.5281/zenodo.5185953
   dc:license  : Creative Commons Attribution 4.0 International (CC-BY-4.0)
   dc:title  : Sensor data set of one electromechanical cylinder at ZeMA testbed (ZeMA DAQ and Smart-Up Unit)
   dc:description  : The data set was generated with two different measurement systems at the ZeMA testbed. The ZeMA DAQ unit consists of 11 sensors and the SmartUp-Unit has 13 differentsignals. A typical working cycle lasts 2.8s and consists of a forward stroke, a waiting time and a return stroke of the electromechanical cylinder. The data set does not consist of the entire working cycles. Only one second of the return stroke of every 100rd working cycle is included. The dataset consists of 4776 cycles. One row represents one second of the return stroke of one working cycle.
   dc:subject  : ['dynamic measurement', 'measurement uncertainty', 'sensor network', 'digital sensors', 'MEMS', 'machine learning', 'European Union (EU)', 'Horizon 2020', 'EMPIR']
   dc:SizeOrDuration  : 24 sensors, 4776 cycles and 2000 datapoints each
   dc:type  : Dataset
   dc:issued  : 2021-09-10
   dc:bibliographicCitation  : T. Dorst, M. Gruber and A. P. Vedurmudi : Sensor data set of one electromechanical cylinder at ZeMA testbed (ZeMA DAQ and Smart-Up Unit), Zenodo [data set], https://doi.org/10.5281/zenodo.5185953, 2021.
[19]:
with h5py.File(local_path_to_dataset_after_download_if_required(), "r") as h5f:
    my_uncertainty = h5f["PTB_SUU"]["MPU_9250"]["Acceleration"][
        "qudt:standardUncertainty"
    ]
    print("qudt:standardUncertainty" in my_uncertainty.name)
    print_attrs(my_uncertainty)
    print(my_uncertainty)
    print(list(h5f["PTB_SUU"]))
True
si:label
   ['X acceleration uncertainty', 'Y acceleration uncertainty', 'Z acceleration uncertainty']
<HDF5 dataset "qudt:standardUncertainty": shape (3, 1000, 4766), type "<f8">
['BMA_280', 'MPU_9250']