convert eye-tracking .edf file to ASC/CSV format

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

I have a recording of tracking data in .edf format (SR-RESEARCH eyelink). I want to convert it to ASC/CSV format in python. I have the GUI application but I want to do it programmatically (in Python). I found the package pyEDFlib but couldn't find an example to how convert the eye-tracking .edf file to .asc or .csv.

What will the best best way to do it?

Thanks

回答1:

If I trust the page here: http://pyedflib.readthedocs.io/en/latest, you can run through all the signals in the file this way:

import pyedflib import numpy as np  f = pyedflib.EdfReader("data/test_generator.edf") n = f.signals_in_file signal_labels = f.getSignalLabels() sigbufs = np.zeros((n, f.getNSamples()[0])) for i in np.arange(n):     sigbufs[i, :] = f.readSignal(i) 

The pyEDFlib library simply reads the file into an EdfReader object. Then you just need to go through and make row for each.

I assume that signal_labels (in the code above) will be an array with all the labels so make a comma separated string out of them

signal_labels_row = ",".join(signal_labels) 

Then do the same for each signal, 1 comma separated String for each

Then simply write them in a file.

I can see they provide an example of how to read a file and extract all the data you need here https://github.com/holgern/pyedflib/blob/master/demo/readEDFFile.py



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!