rsatoolbox.util.rdm_utils module

Collection of helper methods for rdm module

@author: baihan

rsatoolbox.util.rdm_utils.add_pattern_index(rdms, pattern_descriptor)[source]

adds index if pattern_descriptor is None

Parameters

**rdms** (rsatoolbox.rdm.RDMs) – rdms object to be parsed

Returns

pattern_descriptor pattern_select

rsatoolbox.util.rdm_utils.batch_to_matrices(x)[source]

converts a stack of RDMs in vector or matrix form into matrix form

Parameters

**x** – stack of RDMs

Returns

v (np.ndarray): 3D, matrix form of the stack of RDMs

n_rdm (int): number of rdms

n_cond (int): number of conditions

Return type

tuple

rsatoolbox.util.rdm_utils.batch_to_vectors(x)[source]

converts a stack of RDMs in vector or matrix form into vector form

Parameters

x – stack of RDMs

Returns

v (np.ndarray): 2D, vector form of the stack of RDMs

n_rdm (int): number of rdms

n_cond (int): number of conditions

Return type

tuple

rsatoolbox.util.rdm_utils.category_condition_idxs(rdms, category_selector: Union[str, List[int]]) Dict[str, List[int]][source]
Parameters
  • rdms (rsatoolbox.rdm.RDMs) – A reference RDM stack.

  • category_selector (str or List[int]) –

    Either: a string specifying the rdms.pattern_descriptor which

    labels categories for each condition.

    Or: a list of ints specifying the category label for each condition

    in rdms.

Returns

A dictionary mapping the strings in category_names to lists of integer indices of categories within the RDMs.

Return type

categories (Dict[str, List[int]])

@author: caiw