Table Of Contents

Previous topic

mappers.lle

Next topic

mappers.metric

This content refers to the previous stable release of PyMVPA. Please visit www.pymvpa.org for the most recent version of PyMVPA and its documentation.

mappers.mask

Module: mappers.mask

Inheritance diagram for mvpa.mappers.mask:

Data mapper which applies mask to the data

MaskMapper

class mvpa.mappers.mask.MaskMapper(mask, **kwargs)

Bases: mvpa.mappers.base.Mapper

Mapper which uses a binary mask to select “Features”

See also

Please refer to the documentation of the base class for more information:

Mapper

Initialize MaskMapper

Parameters:
  • mask (array) – an array in the original dataspace and its nonzero elements are used to define the features included in the dataset
  • metric (Metric) – Optional metric
convertOutIds2InMask(outIds)

Returns a boolean mask with all features in ouIds selected.

This method works exactly like Mapper.convertOutIds2OutMask(), but the feature mask is finally (reverse) mapped into in-space.

Parameters:outIds (list or 1d array) – To be selected features ids in out-space.
Return type:ndarray
Returns:All selected features are set to True; False otherwise.
convertOutIds2OutMask(outIds)

Returns a boolean mask with all features in outIds selected.

Parameters:outIds (list or 1d array) – To be selected features ids in out-space.
Return type:ndarray
Returns:All selected features are set to True; False otherwise.
discardOut(outIds)

Listed outIds would be discarded

forward(data)

Map data from the original dataspace into featurespace.

getInId(outId)

Returns a features coordinate in the original data space for a given feature id.

If this method is called with a list of feature ids it returns a 2d-array where the first axis corresponds the dimensions in ‘In’ dataspace and along the second axis are the coordinates of the features on this dimension (like the output of NumPy.array.nonzero()).

XXX it might become __get_item__ access method

getInIds()

Returns a 2d array where each row contains the coordinate of the feature with the corresponding id.

getInSize()

InShape is a shape of original mask

getMask(copy=True)

By default returns a copy of the current mask.

If ‘copy’ is set to False a reference to the mask is returned instead. This shared mask must not be modified!

getOutId(coord)

Translate a feature mask coordinate into a feature ID.

getOutSize()

OutSize is a number of non-0 elements in the mask

isValidInId(inId)
mask
reverse(data)

Reverse map data from featurespace into the original dataspace.

selectOut(outIds)

Only listed outIds would remain.

Function assumes that outIds are sorted. In __debug__ mode selectOut would check if obtained IDs are sorted and would warn the user if they are not.

Note

If you feel strongly that you need to remap features internally (ie to allow Ids with mixed order) please contact developers of mvpa to discuss your use case.

The function used to accept a matrix-mask as the input but now it really has to be a list of IDs

Feature/Bug:
  • Negative outIds would not raise exception - just would be treated ‘from the tail’