To read in data from an h5 file using Matlab, you need to know the data structure inside of it - the text strings specifying datasets in the h5 file. A good way to know the data structure is to open the h5 file first in HDFview (which is free, available for both Mac and Windows, and can be downloaded from the web).

Here is a demo on how to read in information from h5 files, and fit the surface to annular or standard Zernikes.

h5demo.m

on Matlab command line, run

>> h5demo(1)

or 

>> h5demo(3)

where there is only one input parameter: 1 is for M1 and 3 is for M3. Line#10 and #14 will need to be changed to point to the h5 files one intends to analyze.

In this demo, we

  1. read in the surface map, display it
  2. read in the data needed to define the pixel grid (number of rows, columns, pixel size)
  3. read in the forces, actuator positions and ID numbers, and display them
  4. read in temperature and thermal couple (TC) locations, and display them
  5. read in SOML force and thermal compensation annular Zernike coefficients, and reorder them to conform with Noll/Mahajan convention.
  6. define the normalized pixel grid
  7. synthesize the SOML force and thermal compensation maps using the annular Zernike coefficients, and display the maps
  8. decompose the synthesized surfaces back to annular Zernike coefficients, to demonstrate consistency.

The subroutines that are needed:

ZernikeAnnularEval.m

ZernikeAnnularFit.m

If standard Zernikes are desired instead of the annular Zernikes, the following subroutines should be used accordingly.

ZernikeEval.m

ZernikeFit.m