idelib.importer#

idelib.importer.importFile(filename='', startTime=None, endTime=None, channels=None, updater=None, parserTypes=None, defaults=None, name=None, quiet=False, **kwargs)#

Create a new Dataset object and import the data from a MIDE file. Primarily for testing purposes. The GUI does the file creation and data loading in two discrete steps, as it will need a reference to the new document before the loading starts. :see: readData()

idelib.importer.openFile(stream, updater=None, parserTypes=None, defaults=None, name=None, quiet=False)#

Create a Dataset instance and read the header data (i.e. non-sample- data). When called by a GUI, this function should be considered ‘modal,’ in that it shouldn’t run in a background thread, unlike readData().

Parameters
  • stream – The file or file-like object containing the EBML data.

  • updater – A function (or function-like object) to notify as work is done. It should take four keyword arguments: count (the current line number), total (the total number of samples), error (an unexpected exception, if raised during the import), and done (will be True when the export is complete). If the updater object has a cancelled attribute that is True, the import will be aborted. The default callback is None (nothing will be notified).

  • parserTypes – A collection of parsers.ElementHandler classes.

  • defaults – A nested dictionary containing a default set of sensors, channels, and subchannels. These will only be used if the dataset contains no sensor/channel/subchannel definitions.

  • name – An optional name for the Dataset. Defaults to the base name of the file (if applicable).

  • quiet – If True, non-fatal errors (e.g. schema/file version mismatches) are suppressed.

Returns

The opened (but still ‘empty’) dataset.Dataset

idelib.importer.readData(doc, source=None, startTime=None, endTime=None, channels=None, updater=None, total=None, bytesRead=0, samplesRead=0, parserTypes=None, **kwargs)#

Import the data from a file into a Dataset.

Parameters
  • doc – The Dataset document into which to import the data.

  • source – An alternate Dataset to merge into the main one.

  • startTime – The start of the extraction range, relative to the recording’s start.

  • endTime – The end of the extraction range, relative to the recording’s end.

  • channels – A list of channel IDs to import. If None (the default), all channels are imported.

  • updater – A function (or function-like object) to notify as work is done. It should take four keyword arguments: count (the current line number), total (the total number of samples), error (an unexpected exception, if raised during the import), and done (will be True when the export is complete). If the updater object has a cancelled attribute that is True, the import will be aborted. The default callback is None (nothing will be notified).

  • total – The total number of bytes in the file(s) being imported. Defaults to the size of the current file, but can be used to display an overall progress when merging multiple recordings. For display purposes.

  • bytesRead – The number of bytes already imported. Mainly for merging multiple recordings. For display purposes.

  • samplesRead – The total number of samples imported. Mainly for merging multiple recordings.

  • parserTypes – A collection of parsers.ElementHandler classes.

Returns

The total number of samples read.