Xiul109 / eeglib

A library with tools for EEG analysis
MIT License
61 stars 14 forks source link

Getting montage, raw and start and ending times from a EDF helper instance #6

Closed webcluster4u closed 9 months ago

webcluster4u commented 2 years ago

Hi,

I am using an EDF helper like below to extract different channels like below:

helper= EDFHelper("sampleedf",windowSize=1000)
for eeg in helper:
    print(eeg.PFD())

I actually need to get montage of above signals i.e. and subtract two particular samples and then get PFD. Also I need to get the exact raw sample points of the signal along with the starting and its ending times in seconds , for example how to know in which time the first eeg was started?

Can I do above by using eeg?

Xiul109 commented 2 years ago

You can use a hidden method of eeg called _applyFunctionTo2C. This method lets you apply custom functions to the data for two channels. For your example the function should be something like this:

def myfunc(s1, s2):
    return features.PFD(s1-s2)

helper.eeg._applyFunctionTo2C(myfunc, channels = desired_channels)

I hope this helps you.