Skip to content

A Python program for lazily reading in all data from an HDF5 file

Notifications You must be signed in to change notification settings

sterry24/h5Reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

h5Reader

Small python tools for reading and viewing data in an HDF5 data format.

readHDF5.py

This program will lazily read in all data in an HDF5 file.
Groups and Datasets are accessible through dot notation.
Attributes can be printed as key,value pairs with .attributes() or .showAttributes()
Attributes are also accessible through dot notation (.attributes.KEYNAME will return VALUE for KEYNAME)

REQUIREMENTS:
Python 3.x
pandas
numpy
h5py

Functions

GROUP OBJECTS:

  • .showAttributes(): prints out all attributes attached to the group object

DATASET OBJECTS:

  • .shape(): prints the shape of the dataset object
  • .size(): prints the size of the dataset object
  • .getType(): prints the data type of the data in the dataset
  • .getDType(): prints the dtype of the data in the dataset (for numpy arrays)
  • .setData(): this function will access the data in the HDF5 file and store it to the DATASET.data attribute.
    the DATASET.data attribute will return NONE until setData() is called
  • .delData(): this function will set the DATASET.data attribute to None
  • .showAttributes(): prints out all the attributes attached to the dataset object
  • .showAsDataFrame(): this function will attempt to show the dataset object as a pandas DataFrame object
    If not possible, will print an error message
  • .saveAsDataFrame(): this function will attempt to save the dataset object as a pandas DataFrame to the DATASET.data attribute
    If not possible, will print an error message

ATTRIBUTE OBJECTS:

  • .showAttributes(): prints out all the attributes

Dump the contents of the HDF5 file to the screen in a tree-like format with .dump()
- This will dump the entire content of the file
- Can provide a specific GROUP OBJECT to dump only on that GROUP (.dump(.GROUPNAME))

 EXAMPLE: h5 = readHDF5File.READ_H5_FILE(filename)<br>
          h5.dump() ## dumps the contents of the entire file to screen<br>
          h5.dump(h5.GROUPNAME) ## Dumps the contents of the GROUPNAME to the screen<br>

h5Viewer.py

A GUI for displaying the contents of a HDF5 file. Note that this currently only shows the names of the Group/Dataset/Attributes.
There is currently no direct acces to the data through this GUI.

REQUIREMENTS:
Python 3.x
PyQt5

About

A Python program for lazily reading in all data from an HDF5 file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages