spkit.io
.read_bdf¶
- spkit.io.read_bdf(file_name, verbose=False, readSignal='readSignal', nCh=None, fs_meth='getSampleFrequency', attrs={}, methods={}, channel_axis=-1)¶
Read EDF/BDF File
Read EDF/BDF File EDF/BDF files are generated by medical instruments and other sensing devices.
- Parameters:
- file_namestr
file name with full path, e.g. ‘../../my_signal_recording.bdf’
- readSignalstr, default=’readSignal’
method name to read signal, default ‘readSignal’, which is used as
x = fileObj.readSignal(i) to read ith channel
- nChint,>0, default=None
numnber of channels to read, if None, nCh is extracted from file attributes
as passed attr[‘nCh] = ‘signals_in_file’
- fs_methstr,default =’getSampleFrequency’
method to read sampling frequency from fileObj
- attrs: dict, default =dict()
dict of attributes to read from fileObj
if empty, predefined setting is used
predefined setting: attrs_default = {‘nCh’:’signals_in_file’,’patient’:’patient’}
- methodsdict, default =dict()
dict of methods to use to extract information
if empty, predefined setting is used
- predefined setting: methds_deafult = {‘ch_labels’:’getSignalLabels’, ‘ch_header’:’getSignalHeaders’,
‘gender’:’getGender’,’sex’:’getSex’,’duration’:’getFileDuration’}
- channel_axis: default=-1
default setting is to return channel on axis -1, to be consistent with other function,
To get channels in axis 0, set channel_axis=0.
- Returns:
- Xnp.array
(n,nch) = (number of samples, number of channels,)
- fsfloat/int,
Sampling Frequency
- ch_labels: list,
full list of cahnnel labels
- info: dict
dict of all the attribuates, correspoding to each channel in fileObj
Examples
>>> import spkit as sp >>> file_name = 'full_accessible_path/to_bdf_file.bdf' >>> X,fs,ch_labels,info = sp.io.read_bdf(file_name)