Skip to content

Implement saving to `hdf5` format

Max Lalleman requested to merge max.lalleman/pygwb:Baseline_save_function into master

This merge request solves Issue #36 (closed).

I have implemented the saving to 'hdf5' format.

I added the functionality for saving to hdf5 both for the estimates and the psds/csd in the same as I did for the other data types. If the person who runs the pipeline chooses the hdf5 format, everything will be saved in a file called 'filename.h5' in the hdf5 format.

Here is how it works: for the (frequency-dependent and overall) estimate and error bars, I made a file with all separate datasets in the hdf5 file, so you can read it in using the hf.get('Y_pygwb') or hf.get('Y_f') function with hf = h5py.File('filename', 'r').

For the psds and csd, I have implemented a slightly different structure. Since hdf5 cannot save spectrograms (or I did not find a way online), I split those spectrograms into 'freqs' and then two groups in the hdf5 datafile. One group is called 'csd_group', where in you can find the csd data 'csd' and the corresponding times 'csd_times'. The psds are saved in a group 'psds_group' in which you have two subgroups 'psds_group/psd_1' and 'psds_group/psd_2'. In these subgroups, you can find the psd with 'psd_i' and times with 'psd_i_times' with i = {1,2}.

Edited by Arianna Renzini

Merge request reports