wonambi.ioeeg.text module

Class to import straight text records.

class wonambi.ioeeg.text.Text(rec_dir)[source]

Bases: object

Class to read text format records. The record consists of a directory containing txt files. Each file is a channel. The first line of each file is the sampling rate, and the following lines are single data points, in scientific notation. Only supports a single sampling rate for all channels.

Parameters:

rec_dir (path to record directory) – the folder containing the record

Notes

Text is a very slow format for reading data. It is best to use this class to import the record, then to export is as a Wonambi (.won) file, and use that for reading.

return_dat(chan, begsam, endsam)[source]

Return the data as 2D numpy.ndarray.

Parameters:
  • chan (list of int) – index (indices) of the channels to read

  • begsam (int) – index of the first sample (inclusively)

  • endsam (int) – index of the last sample (exclusively)

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) – the full header

return_markers()[source]

There are no markers in this format.