This is an accompanying toolbox for SeizyML to allow conversion of EEG/LFP recordings to the appropriate file format. Briefly, the files will be downsampled (decimated) to 100Hz in 5 second windows and will be converted to HDF5 files (.h5) in the following format:
1st-dimension = nSegments (ie. Number of 5 second segments)
2nd-dimension = win * new_fs (Default is 500 : 100 Hz * 5 seconds)
3rd-dimension = number of channels (Equals to the number of selected channels in the `config.json` file)
- Currently supports the conversion of continuous EDF files containing 1 animal per recording.
pip install numpy, scipy, tables, pyedflib, tqdm
The config.json
file contains the parameters. Usually only the selected_channels
field needs to be edited by user.
- win : window size in seconds, Default = 5
- new_fs : sampling rate after downsampling (samples per second), Default = 100
- scale : signal scaling factor, Default = 1
- selected_channels: Name of channels to be selected.
- selected_channel_idx: Index of channels to be selected. Default is None. Overwrites selected_channels.
-
Modify the
config.json
file to include the correct channel names. Ensure those channel names are present accross all files. Using channel names is usually the best option to ensure that the correct channels are selected. If for some reason channel names can not be edited to be consistent across channels,selected_channel_idx
can be used instead. -
Open anaconda shell and cd to the seizy_convert directory
cd .\seizy_convert
-
Run the main conversion file and follow the prompt
python .\edf_convert.py
If all tests pass and conversion completes successfully an equivalent .h5 file will be created for each .edf file in the folder
There are example .edf files in the \example_data
subfolder that we can use to try the app.
-
For example there is a 2 channel file in
\example_data\edf_2channels
with channel namesChannel_1
andChannel_2
. -
To convert this file to
.h5
follow the instructions from How-to-use section from above to run the app. -
When prompted for the parent directory type enter the full path to the
edf_2channels
folder. -
The converted file can be inspected by running the following:
python .\inspect_h5file.py
When prompted for the file path copy and paste the path of the converted .h5 file, which will print the data shape and plot the first segment of each channel.
Depending on demand new features will be added such as:
- Multiple Animals per EDF file.
- Addition of other file format.
We welcome all project contributions including raising issues and pull requests!