Multivariate Pattern Analysis in Python

# mvpa2.mappers.detrend.poly_detrend

`mvpa2.mappers.detrend.``poly_detrend`(ds, **kwargs)

  In-place polynomial detrending.

  This function behaves identical to the `PolyDetrendMapper`. The only difference is that the actual detrending is done in-place – potentially causing a significant reduction of the memory demands.

  Parameters:

  ds : Dataset

  > The dataset that will be detrended in-place.

  space : str or None

  > If not None, a samples attribute of the same name is added to the mapped dataset that stores the coordinates of each sample in the space that is spanned by the polynomials. If an attribute of that name is already present in the input dataset its values are interpreted as sample coordinates in the space that should be spanned by the polynomials.

  polyord : int, optional

  > Order of the Legendre polynomial to remove from the data. This will remove every polynomial up to and including the provided value. For example, 3 will remove 0th, 1st, 2nd, and 3rd order polynomials from the data. np.B.: The 0th polynomial is the baseline shift, the 1st is the linear trend. If you specify a single int and the `chunks_attr` parameter is not None, then this value is used for each chunk. You can also specify a different polyord value for each chunk by providing a list or ndarray of polyord values with the length equal to the number of chunks. Constraints: value must be convertible to type ‘int’. [Default: 1]

  chunks_attr : None or str, optional

  > If None, the whole dataset is detrended at once. Otherwise, the given samples attribute (given by its name) is used to define chunks of the dataset that are processed individually. In that case, all the samples within a chunk should be in contiguous order and the chunks should be sorted in order from low to high – unless the dataset provides information about the coordinate of each sample in the space that should be spanned be the polynomials (see `space` argument). Constraints: value must be `None`, or value must be a string. [Default: None]

  opt_regs : None or list(str), optional

  > List of sample attribute names that should be used as additional regressors. An example use would be to regress out motion parameters. Constraints: value must be `None`, or value must be convertible to list(str). [Default: None]

  enable_ca : None or list of str

  > Names of the conditional attributes which should be enabled in addition to the default ones

  disable_ca : None or list of str

  > Names of the conditional attributes which should be disabled

  auto_train : bool

  > Flag whether the learner will automatically train itself on the input dataset when called untrained.

  force_train : bool

  > Flag whether the learner will enforce training on the input dataset upon every call.

  pass_attr : str, list of str|tuple, optional

  > Additional attributes to pass on to an output dataset. Attributes can be taken from all three attribute collections of an input dataset (sa, fa, a – see `Dataset.get_attr()`), or from the collection of conditional attributes (ca) of a node instance. Corresponding collection name prefixes should be used to identify attributes, e.g. ‘ca.null_prob’ for the conditional attribute ‘null_prob’, or ‘fa.stats’ for the feature attribute stats. In addition to a plain attribute identifier it is possible to use a tuple to trigger more complex operations. The first tuple element is the attribute identifier, as described before. The second element is the name of the target attribute collection (sa, fa, or a). The third element is the axis number of a multidimensional array that shall be swapped with the current first axis. The fourth element is a new name that shall be used for an attribute in the output dataset. Example: (‘ca.null_prob’, ‘fa’, 1, ‘pvalues’) will take the conditional attribute ‘null_prob’ and store it as a feature attribute ‘pvalues’, while swapping the first and second axes. Simplified instructions can be given by leaving out consecutive tuple elements starting from the end.

  postproc : Node instance, optional

  > Node to perform post-processing of results. This node is applied in `__call__()` to perform a final processing step on the to be result dataset. If None, nothing is done.

  descr : str

  > Description of the instance