fixed peak period calculation
fixed some bugs in hdf5 codes