neurotools.stats.covalign module

Covariance alignment routines related to

neurotools.stats.covalign.keeprank(Σ, eps=0.1)[source]

Return all eigenvectors with eigenvalues greater than epsilon times the largest eigenvalue.

Parameters:

Σ (2D square array-like (positive semidefinite matrix)) – Covariance matrix

Return type:

Leading eigenvectors of Σ.

neurotools.stats.covalign.expected_intersection_rank1(Δμ, Σ, N=100)[source]

Rank-1 approximation of average overlap. Uses only the largest eigenvector.

Parameters:
  • Δμ (1D array-like (vector)) – Direction of shift in mean activity

  • Σ (2D square array-like (positive semidefinite matrix)) – Covariance matrix of distribution of single-sessiona activity

neurotools.stats.covalign.expected_intersection(Δμ, Σ)[source]

Unnormalized expected intersection.

Parameters:
  • Δμ (1D array-like (vector)) – Direction of shift in mean activity

  • Σ (2D square array-like (positive semidefinite matrix)) – Covariance matrix of distribution of single-sessiona activity

neurotools.stats.covalign.expected_intersection_enormed(Δμ, Σ)[source]

Normalized expected intersection.

Parameters:
  • Δμ (1D array-like (vector)) – Direction of shift in mean activity

  • Σ (2D square array-like (positive semidefinite matrix)) – Covariance matrix of distribution of single-sessiona activity

Returns:

  • Root-mean-square normalized magnitude of the dot-product between the

  • vector Δμ and unit vector directions of random variables sampled from

  • a Gaussian with covariance Σ.

neurotools.stats.covalign.expected_intersection_enormed_chance(Δμ, Σ, N=300, pct=95)[source]

Normalized expected intersection chance level.

Parameters:
  • Δμ (1D array-like (vector)) – Direction of shift in mean activity

  • Σ (2D square array-like (positive semidefinite matrix)) – Covariance matrix of distribution of single-sessiona activity

  • N (int, defaults to 300) – The number of random Monte-Carlo samples to use to asses chance level.

  • pct (numeric in (0,100), defaults to 90) – The chance-level percentile to report

Returns:

  • The pct percentile chance level, via Monte-Carlo sampling, for the

  • null hypothesis that Δμ has no more than chance alignment with the

  • structure of Σ.

neurotools.stats.covalign.rebuild_unit_quality_caches()[source]

Rebuilds a disk cache of which units are “good” units (have viable recordings on a given session).

neurotools.stats.covalign.orthnormedcovariance(C)[source]

Given covariance Σ Computes I-Σ/λmax

neurotools.stats.covalign.get_orthogonal_alignment(animal, CUE, PREV, verbose=True, **kwargs)[source]

Compute orthogonal complement drift alignment statistics for the given animal, previous cue, and current cue.

neurotools.stats.covalign.alignment_angle(Δμ, Σ)[source]

Computed generalzation of alignment angle between a vector and a covariance matrix

neurotools.stats.covalign.sample_alignment_angle(Σ, K=10)[source]

Computed generalzation of alignment angle between a vector and a covariance matrix

neurotools.stats.covalign.sample_alignment_self(Σ, K=10)[source]

Self-alignment of distribution Sanity check for baseline

neurotools.stats.covalign.sample_alignment_cross(Σ, Σother, K=10)[source]

Self-alignment of distribution Sanity check for baseline

neurotools.stats.covalign.sample_alignment_complement(Σ, K=10)[source]

Self-alignment of distribution Sanity check for baseline

neurotools.stats.covalign.alignment_angle_unnormalized(Δμ, Σ)[source]
neurotools.stats.covalign.alignment_angle_normalized(Δμ, Σ)[source]
neurotools.stats.covalign.sample_alignment_angle_unnormalized(Σ, K=10)[source]
neurotools.stats.covalign.sample_alignment_angle_normalized(Σ, K=10)[source]
neurotools.stats.covalign.sample_alignment_self_unnormalized(Σ, K=10)[source]
neurotools.stats.covalign.sample_alignment_self_unnormalized_nounit(Σ, K=10)[source]
neurotools.stats.covalign.sample_alignment_self_normalized(Σ, K=10)[source]
neurotools.stats.covalign.sample_alignment_cross_normalized(Σ, Σother, K=10)[source]
neurotools.stats.covalign.sample_alignment_complement_normalized(Σ, K=10)[source]
neurotools.stats.covalign.new_alignment_normalized(Δμ, Σ)[source]