visualdynamics.core.partial_coherence¶
partial_coherence
¶
Partial, reference and virtual coherence of a multiple-input record.
In a test with several drives, the multiple coherence says how much of a response the drives account for together. It does not say which drive does, and it does not say whether the drives were independent enough for the identification to separate them. Three readings of the same cross-spectral matrix answer those questions:
- The reference coherence is the ordinary coherence between every
pair of references. Two drives coherent near one cannot be told apart
at that line: the reference matrix
G_rris nearly singular there, and an FRF computed from it is whichever of many answers the pseudo-inverse picks. -
The partial coherence of a response with one reference is the ordinary coherence between the two after the linear effect of every other reference has been removed from both: the coherence of the conditioned spectra. With references
x_iand the restr,G_ab·r = G_ab − G_ar G_rr⁻¹ G_rb γ²_iy·r = |G_iy·r|² / (G_ii·r G_yy·r)
It says how much of what the others leave of the response this
reference explains. With one reference it is the ordinary coherence.
For two, 1 − γ²_y:x = (1 − γ²_1y)(1 − γ²_2y·1): the multiple
coherence is built from an ordinary and a partial coherence.
- The virtual coherence is the coherence of a response with each
principal reference: the uncorrelated combinations of the references
given by the eigenvectors of G_rr, G_rr = U Λ Uᴴ. The principal
references have autospectra Λ and cross spectra Uᴴ G_ry with the
response, and their coherences with it sum to the multiple
coherence. A principal reference whose eigenvalue is small next to
the first is a direction the drives hardly excited, so the count of
large eigenvalues is how many independent drives the test really
had.
The spectra follow the convention of the rest of the package,
G_ab = E[A* B], so G_ba is the conjugate of G_ab and every matrix
is Hermitian.
A conditioned autospectrum that is nothing next to the one it came from is a channel the other references explain completely, and its partial coherence is undefined, not a number; so are the coherences of a channel that recorded nothing and of a line holding a value that is not a finite number. A dead channel or a line nobody drove is not a coherence of zero.
References
The partial and multiple coherence functions and the conditioned spectra they are read from are standard; this is where they are set out.
- Bendat, J. S., & Piersol, A. G. (2010). Random Data: Analysis and Measurement Procedures, 4th ed. Wiley. Multiple-input systems: conditioned spectral density functions, the partial coherence function of an output with one input when the other inputs are removed, and the multiple coherence function written as a product of ordinary and partial coherences.
Classes:
| Name | Description |
|---|---|
PartialCoherencePoint |
The coherences of one response at one line. |
PartialCoherence |
The partial, reference and virtual coherence of a multiple-input |
Functions:
| Name | Description |
|---|---|
multiple_coherence |
The multiple coherence of each response with a set of references, |
conditioned |
The conditioned cross-spectral matrix of the channels |
read_partial_coherence |
Read the partial, reference and virtual coherence from a |
Classes¶
PartialCoherencePoint
dataclass
¶
PartialCoherencePoint(frequency: float, multiple: float, ordinary: ndarray, partial: ndarray, virtual: ndarray, principal: ndarray)
The coherences of one response at one line.
Attributes:
| Name | Type | Description |
|---|---|---|
frequency |
float
|
The line, Hz. |
multiple |
float
|
The multiple coherence with every reference. |
ordinary, partial, virtual |
ndarray
|
One value per reference (per principal reference for
|
principal |
ndarray
|
The principal references' autospectra, largest first, as shares of the first. |
PartialCoherence
dataclass
¶
PartialCoherence(frequency: ndarray, references: list[str], responses: list[str], multiple: ndarray, ordinary: ndarray, partial: ndarray, virtual: ndarray, reference: ndarray, principal: ndarray, averages: int = 0, notes: list[str] = list())
The partial, reference and virtual coherence of a multiple-input record, at every line.
Attributes:
| Name | Type | Description |
|---|---|---|
frequency |
ndarray
|
The lines, Hz. |
references, responses |
list of str
|
The channels, by DOF (with the quantity where a DOF carries two). |
multiple |
ndarray
|
|
ordinary, partial, virtual |
ndarray
|
|
reference |
ndarray
|
|
principal |
ndarray
|
|
averages |
int
|
The frames the spectra were averaged over. |
notes |
list of str
|
What the numbers should be read with. |
Methods:
| Name | Description |
|---|---|
index |
A response's row, by position or by name. |
at |
The coherences of one response at the line nearest |
coupled |
The pairs of references whose coherence passes |
effective_references |
How many principal references carry at least |
describe |
One line about a response: which reference explains most of |
Methods:¶
index
¶
A response's row, by position or by name.
Source code in src/visualdynamics/core/partial_coherence.py
at
¶
at(frequency: float, response: int | str = 0) -> PartialCoherencePoint
The coherences of one response at the line nearest
frequency.
Source code in src/visualdynamics/core/partial_coherence.py
coupled
¶
The pairs of references whose coherence passes limit at any
line, as (one, other, share of the lines past it, the largest),
the most coupled first.
Source code in src/visualdynamics/core/partial_coherence.py
effective_references
¶
How many principal references carry at least floor of the
first one's power, at every line: the number of drives the test
had in effect.
Source code in src/visualdynamics/core/partial_coherence.py
describe
¶
One line about a response: which reference explains most of it once the others are removed, and the drives' worst coupling.
Source code in src/visualdynamics/core/partial_coherence.py
Functions:¶
multiple_coherence
¶
The multiple coherence of each response with a set of references,
γ² = g_ryᴴ G_rr⁺ g_ry / G_yy, at every line.
The one statement of the multiple coherence:
TimeHistory.compute_multiple_coherence and read_partial_coherence
both read it here. A pseudo-inverse is used rather than a solve,
because two drives can be nearly the same and G_rr is then close
to singular. Limited to 0 to 1; not a number where the response's
autospectrum is not above zero or a value is not finite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grr
|
ndarray
|
|
required |
gry
|
ndarray
|
|
required |
gyy
|
ndarray
|
|
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Source code in src/visualdynamics/core/partial_coherence.py
conditioned
¶
The conditioned cross-spectral matrix of the channels keep with
the linear effect of the channels given removed from them,
G_kk·g = G_kk − G_kg G_gg⁺ G_gk, at every line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
|
required |
keep
|
sequence of int
|
Channel indices; |
required |
given
|
sequence of int
|
Channel indices; |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Source code in src/visualdynamics/core/partial_coherence.py
read_partial_coherence
¶
read_partial_coherence(frequency: ndarray, matrix: ndarray, references: Sequence[str], responses: Sequence[str], *, averages: int = 0) -> PartialCoherence
Read the partial, reference and virtual coherence from a cross-spectral matrix whose first channels are the references.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
ndarray
|
The lines, Hz. |
required |
matrix
|
ndarray
|
|
required |
references
|
sequence of str
|
The channels' names, in the matrix's order. |
required |
responses
|
sequence of str
|
The channels' names, in the matrix's order. |
required |
averages
|
int
|
The frames averaged, carried for the notes. |
0
|
Returns:
| Type | Description |
|---|---|
PartialCoherence
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When there is no reference or no response, or the matrix's shape does not match the names. |
Source code in src/visualdynamics/core/partial_coherence.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |