pythonnumpyeuropean-data-format

Converting .edf to .npy


I'm attempting to convert a .edf file to .npy file. I'm new to coding, but my basic understanding is that both files are arrays and I should be able create a script in python to convert the data.


Solution

  • Do you mean the European Data Format? If so, you can use the mne-python library:

    import mne.io
    edf_raw = mne.io.read_raw_edf(edf_fname, preload=True)
    hz = 1 / (edf_raw.times[1] - edf_raw.times[0])
    # If you wish to get specific channels and time:
    edf_data, times = edf_raw[channels_indices, int(from_t * hz): int(to_t * hz]
    # Or to get all the data:
    edf_data, times = edf_raw[:, :]