edges.load_whitened_pcs
edges.load_whitened_pcs(
volume_file,
atlas=None,
exclude_acronyms=DEFAULT_EXCLUDE_ACRONYMS,
variance_threshold=DEFAULT_VARIANCE_THRESHOLD,
)Whitened PCA of an encoding volume.
PCs are computed on the voxels inside the atlas mask, outside the excluded regions and with data (all-zero voxels are the volume’s “no probe coverage” sentinel). Each PC is signed so that its largest-magnitude loading is positive.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| volume_file | str or Path | Encoding volume .npz (brainwide_ephys_atlas_{res_um}um.npz). |
required |
| atlas | iblatlas.atlas.BrainAtlas | Atlas at the volume’s resolution. Defaults to AllenAtlas(res_um). |
None |
| exclude_acronyms | iterable of str | Regions left out of the PCA and of the valid mask. | DEFAULT_EXCLUDE_ACRONYMS |
| variance_threshold | float | Fraction of the variance the retained PCs must explain. | DEFAULT_VARIANCE_THRESHOLD |
Returns
| Name | Type | Description |
|---|---|---|
| dict | pcs : (AP, ML, DV, k) float32 whitened PCs, NaN outside valid valid : (AP, ML, DV) bool mask of the voxels used explained : (k,) explained variance ratio loadings : pandas.DataFrame (k, n_features) feature_names : (n_features,) array project : callable mapping raw (n, n_features) values to whitened PCs res_um : int |