wonambi.ioeeg.egimff module

class wonambi.ioeeg.egimff.EgiMff(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 (list) – 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

Notes

This format is tricky for both channels and samples. For the samples, we just use the boundaries in the block header. For the channels, we assume that there are max two signals, one EEG and one PIB box. We just use the boundary between them to define if a channel belongs to the first group or to the second.

Todo

use wonambi.ioeeg.utils._select_blocks here, but you need to test it with a PIB box.

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

return_markers()[source]
return_videos(begtime, endtime)[source]

It returns the videos and beginning and end time of the video segment. The MFF video format is not well documented. As far as I can see, the manual 20150805 says that there might be multiple .mp4 files but I only see one .mov file (and no way to specify which video file to read). In addition, there is a file “po_videoSyncups.xml” which seems to contain some time information, but the sampleTime does not start at zero, but at a large number. I don’t know how to use the info in po_videoSyncups.xml.

Parameters:
  • begtime (float) – start time of the period of interest

  • endtime (float) – end time of the period of interest

Returns:

  • list of one path – list with only one element

  • float – start time of the video

  • float – end time of the video

wonambi.ioeeg.egimff.ns(s)[source]

remove namespace, but only it there is a namespace to begin with

wonambi.ioeeg.egimff.parse_xml(xml_file)[source]
wonambi.ioeeg.egimff.read_all_block_hdr(filename)[source]
wonambi.ioeeg.egimff.read_block_hdr(f)[source]
wonambi.ioeeg.egimff.xml2dict(root)[source]

Use functions instead of Class and remove namespace based on: http://stackoverflow.com/questions/2148119

wonambi.ioeeg.egimff.xml2list(root)[source]