/usr/share/pyshared/mvpa2/datasets/channel.py is in python-mvpa2 2.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""Dataset handling data structured in channels."""
__docformat__ = 'restructuredtext'
#
#
# THIS CODE IS OBSOLETE!
#
# PLEASE PORT substract_baseline() AND resample() TO WORK WITH ANY DATASET.
#
raise DeprecationWarning("ChannelDataset is obsolete and might vanish any "
"second.")
if False: # just to please Python so it could parse the file
##REF: Name was automagically refactored
def substract_baseline(self, t=None):
"""Substract mean baseline signal from the each timepoint.
The baseline is determined by computing the mean over all timepoints
specified by `t`.
The samples of the dataset are modified in-place and nothing is
returned.
Parameters
----------
t : int or float or None
If an integer, `t` denotes the number of timepoints in the from the
start of each sample to be used to compute the baseline signal.
If a floating point value, `t` is the duration of the baseline
window from the start of each sample in whatever unit
corresponding to the datasets `samplingrate`. Finally, if `None`
the `t0` property of the dataset is used to determine `t` as it
would have been specified as duration.
"""
# if no baseline length is given, use t0
if t is None:
t = np.abs(self.t0)
# determine length of baseline in samples
if isinstance(t, float):
t = np.round(t * self.samplingrate)
# get original data
data = self.O
# compute baseline
# XXX: shouldn't this be done per chunk?
baseline = np.mean(data[:, :, :t], axis=2)
# remove baseline
data -= baseline[..., np.newaxis]
# put data back into dataset
self.samples[:] = self.mapForward(data)
|