9.2.8. On-the-fly¶
Utilities for on-the-fly analyses.
- junifer.onthefly.read_transform(storage, transform, feature_name=None, feature_md5=None, nan_policy='bypass', transform_args=None, transform_kw_args=None)¶
Read stored feature and transform to specific statistical output.
- Parameters:
- storagestorage-like
The storage class, for example, SQLiteFeatureStorage.
- transform
str The kind of transform formatted as
<package>_<function>, for example,bctpy_degrees_und.- feature_name
str, optional Name of the feature to read (default None).
- feature_md5
str, optional MD5 hash of the feature to read (default None).
- nan_policy
str, optional The policy to handle NaN values (default “ignore”). Options are:
“bypass”: Do nothing and pass NaN values to the transform function.
“drop_element”: Drop (skip) elements with NaN values.
“drop_rows”: Drop (skip) rows with NaN values.
“drop_columns”: Drop (skip) columns with NaN values.
“drop_symmetric”: Drop (skip) symmetric pairs with NaN values.
- transform_args
tuple, optional The positional arguments for the callable of
transform(default None).- transform_kw_args
dict, optional The keyword arguments for the callable of
transform(default None).
- Returns:
pandas.DataFrameThe transformed feature as a dataframe.
- Raises:
ValueErrorIf
nan_policyis invalid or if package is invalid.RuntimeErrorIf package is
bctpyand stored data kind is notmatrix.ImportErrorIf
bctpycannot be imported.AttributeErrorIf function to be invoked in invalid.
Notes
This function has been only tested for:
bct.degrees_undbct.strengths_undbct.clustering_coef_wubct.eigenvector_centrality_und
Using other functions may fail and require tweaking.
Provide onthefly functions for BrainPrint post-analysis.
- junifer.onthefly._brainprint.normalize(storage, features, kind)¶
Read stored brainprint data and normalize either surfaces or volumes.
- Parameters:
- storagestorage-like
The storage class, for example,
HDF5FeatureStorage.- features
dict, optional The feature names or MD5 hashes to read as dict. The dict should have the keys:
"areas"(ifkind="surface")"volumes"(ifkind="volume")"eigenvalues"
and the corresponding value for each of the keys is again a dict with the keys:
"feature_name": str or None"feature_md5": str or None
Either one of
"feature_name"or"feature_md5"needs to be not None for each first-level key, but both keys are mandatory.- kind{“surface”, “volume”}
The kind of normalization.
- Returns:
pandas.DataFrameThe transformed feature as a
pandas.DataFrame.
- Raises:
ValueErrorIf
kindis invalid.
- junifer.onthefly._brainprint.reweight(storage, feature_name=None, feature_md5=None)¶
Read stored brainprint data and reweight eigenvalues.
- Parameters:
- storagestorage-like
The storage class, for example,
HDF5FeatureStorage.- feature_name
str, optional Name of the feature to read (default None).
- feature_md5
str, optional MD5 hash of the feature to read (default None).
- Returns:
pandas.DataFrameThe transformed feature as a
pandas.DataFrame.