Using h5py to import HDF5 files
The file 'LIGO_data.hdf5' is already in your working directory.
In this exercise, you'll import it using the h5py library.
You'll also print out its datatype to confirm you have imported
it correctly. You'll then study the structure of the file in order
to see precisely what HDF groups it contains.
You can find the LIGO data plus loads of documentation and tutorials here. There is also a great tutorial on Signal Processing with the data here.
Latihan ini adalah bagian dari kursus
Introduction to Importing Data in Python
Petunjuk latihan
- Import the package
h5py. - Assign the name of the file to the variable
file. - Load the file as read only into the variable
data. - Print the datatype of
data. - Print the names of the groups in the HDF5 file
'LIGO_data.hdf5'.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Import packages
import numpy as np
import ____
# Assign filename: file
# Load file: data
data = h5py.File(____, ____)
# Print the datatype of the loaded file
# Print the keys of the file
for key in ____:
print(____)