wonambi.ioeeg.fieldtrip module
- class wonambi.ioeeg.fieldtrip.FieldTrip(filename)[source]
Bases:
object
Basic class to read the data.
- Parameters:
filename (path to file) – the name of the filename or directory
- return_dat(chan, begsam, endsam)[source]
Return the data as 2D numpy.ndarray.
- Parameters:
chan (int or list) – index (indices) of the channels to read
begsam (int) – index of the first sample
endsam (int) – index of the last sample
- Returns:
numpy.ndarray – A 2d matrix, with dimension chan X samples
- return_hdr()[source]
Return the header for further use.
- Returns:
subj_id (str) – subject identification code
start_time (datetime) – start time of the dataset
s_freq (float) – sampling frequency
chan_name (list of str) – list of all the channels
n_samples (int) – number of samples in the dataset
orig (dict) – additional information taken directly from the header
Notes
It only reads hdf5 matlab files and the VARiable needs to be called ‘data’
h5py is necessary for this function
- return_markers()[source]
Return all the markers (also called triggers or events).
- Returns:
list of dict – where each dict contains ‘name’ as str, ‘start’ and ‘end’ as float in seconds from the start of the recordings, and ‘chan’ as list of str with the channels involved (if not of relevance, it’s None).
Todo
How to read markers / events from fieldtrip file
- wonambi.ioeeg.fieldtrip.write_fieldtrip(data, filename)[source]
Export data to FieldTrip.
- Parameters:
data (instance of ChanTime) – data with only one trial
filename (path to file) – file to export to (include ‘.mat’)
Notes
It saves mat file using Version 6 (‘-v7’) because it relies on scipy.io functions. Therefore it cannot store data larger than 2 GB.