Package mvpa :: Package datasets :: Module eep

[hide private]
[frames] | no frames]

# Source Code for Module mvpa.datasets.eep

     1  # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
     2  # vi: set ft=python sts=4 ts=4 sw=4 et:
     3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
     4  #
     5  #   See COPYING file distributed along with the PyMVPA package for the
     6  #   copyright and license terms.
     7  #
     8  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
     9  """Dataset that gets its samples from an EEP binary file"""
    10
    11  __docformat__ = 'restructuredtext'
    12
    13
    14  import numpy as N
    15
    16  from mvpa.datasets.channel import ChannelDataset
    17  from mvpa.misc.io.eepbin import EEPBin
    18  from mvpa.base.dochelpers import enhancedDocString
    19  from mvpa.base import warning
    20
    21 -class EEPDataset(ChannelDataset):
    22      """Dataset using a EEP binary file as source.
    23
    24      EEP files are used by *eeprobe* a software for analysing even-related
    25      potentials (ERP), which was developed at the Max-Planck Institute for
    26      Cognitive Neuroscience in Leipzig, Germany.
    27
    28        http://www.ant-neuro.com/products/eeprobe
    29      """
    30 -    def __init__(self, samples=None, **kwargs):
    31          """Initialize EEPDataset.
    32
    33          :Parameters:
    34            samples: Filename (string) of a EEP binary file or an `EEPBin`
    35                     object
    36          """
    37          # dataset props defaults
    38          dt = t0 = channelids = None
    39
    40          # default way to use the constructor: with filename
    41          if not samples is None:
    42              if isinstance(samples, str):
    43                  # open the eep file
    44                  try:
    45                      eb = EEPBin(samples)
    46                  except RuntimeError, e:
    47                      warning("ERROR: EEPDatasets: Cannot open samples file %s" \
    48                              % samples) # should we make also error?
    49                      raise e
    50              elif isinstance(samples, EEPBin):
    51                  # nothing special
    52                  eb = samples
    53              else:
    54                  raise ValueError, \
    55                        "EEPDataset constructor takes the filename of an " \
    56                        "EEP file or a EEPBin object as 'samples' argument."
    57              samples = eb.data
    58              dt = eb.dt
    59              channelids = eb.channels
    60              t0 = eb.t0
    61
    62          # init dataset
    63          ChannelDataset.__init__(self,
    64                                  samples=samples,
    65                                  dt=dt, t0=t0, channelids=channelids,
    66                                  **(kwargs))
    67
    68
    69      __doc__ = enhancedDocString('EEPDataset', locals(), ChannelDataset)
    70