cana.function_properties.sensitivity module
Sensitivity
Average sensitivity and edge activities of a Boolean node.
Two equivalent routes:
activities_from_bit_lut()/sensitivity_from_bit_lut()— direct single-input flip counts on a denseBitLut.activities_from_schemata()/sensitivity_from_schemata()— upper edge effectiveness (\(1 - r_i\) withbound="upper") from one-symbol (prime-implicant) schemata. Prefer this when PIs are already available, and whenkis too large to materialize a dense LUT (MAX_DENSE_LUT_K).
The two formulations are bit-exactly equal on the full state space.
High-k sampling reuses the shared exact/sampled two-track
(exact_k_max / n_samples) from
sampling. Percentile bootstrap CIs are
available via bootstrap_activities() and bootstrap_sensitivity().
- cana.function_properties.sensitivity.activities_from_bit_lut(bit_lut)[source]
Activity of each input from a dense LUT: fraction of states where flipping it changes the output.
- Parameters:
bit_lut (BitLut) – Dense truth table;
kis taken frombit_lut.k.- Returns:
The activity of each input.
- Return type:
(list)
- cana.function_properties.sensitivity.sensitivity_from_bit_lut(bit_lut, norm=False)[source]
Average sensitivity from a dense LUT: sum of
activities_from_bit_lut().- Parameters:
bit_lut (BitLut) – Dense truth table;
kis taken frombit_lut.k.norm (bool) – Normalize by the number of inputs
k.
- Returns:
(float)
- Return type:
float
- cana.function_properties.sensitivity.activities_from_schemata(schemata, k=None, *, exact_k_max=14, n_samples=None, rng=None, minterms=None)[source]
Edge activities from one-symbol schemata: upper edge effectiveness.
Equivalent to
1 - r_iwithbound="upper"(seecana.function_properties.redundancy.edge_redundancy()). Use when prime implicants are available, or whenkexceeds the dense-LUT limit.- Parameters:
schemata (Mapping[int, Set[str]]) – Polarity → set of length-
kschemas over{0,1,2}.k (int, optional) – Inferred from schema length when omitted.
exact_k_max (int) – Forwarded to
cana.function_properties.redundancy.edge_redundancy()for the exact/sampled track.n_samples (int | None) – Forwarded to
cana.function_properties.redundancy.edge_redundancy()for the exact/sampled track.rng (Generator | None) – Forwarded to
cana.function_properties.redundancy.edge_redundancy()for the exact/sampled track.minterms (Sequence[str] | None) – Forwarded to
cana.function_properties.redundancy.edge_redundancy()for the exact/sampled track.
- Returns:
The activity of each input.
- Return type:
(list)
- cana.function_properties.sensitivity.sensitivity_from_schemata(schemata, k=None, *, norm=False, exact_k_max=14, n_samples=None, rng=None, minterms=None)[source]
Average sensitivity from one-symbol schemata: sum of
activities_from_schemata().- Parameters:
schemata (Mapping[int, Set[str]]) – Polarity → set of length-
kschemas over{0,1,2}.k (int, optional) – Inferred from schema length when omitted.
norm (bool) – Normalize by the number of inputs
k.exact_k_max (int) – Forwarded to
activities_from_schemata().n_samples (int | None) – Forwarded to
activities_from_schemata().rng (Generator | None) – Forwarded to
activities_from_schemata().minterms (Sequence[str] | None) – Forwarded to
activities_from_schemata().
- Returns:
(float)
- Return type:
float
- cana.function_properties.sensitivity.bootstrap_activities(sampled_or_schemata=None, *, schemata=None, n_samples=None, n_boot=1000, ci=0.95, rng=None, minterms=None)[source]
Estimate per-input activities with percentile bootstrap CIs.
Activities are upper edge effectiveness (\(a_i = 1 - r_i\) with
bound="upper"). Prefer a preservedSampledPiCoverageso primes are not re-matched.- Parameters:
sampled_or_schemata (SampledPiCoverage | Mapping[int, Set[str]] | None)
schemata (Mapping[int, Set[str]] | None)
n_samples (int | None)
n_boot (int)
ci (float)
rng (Generator | None)
minterms (Sequence[str] | None)
- Return type:
List[BootstrapResult]
- cana.function_properties.sensitivity.bootstrap_sensitivity(sampled_or_schemata=None, *, schemata=None, n_samples=None, n_boot=1000, ci=0.95, norm=False, rng=None, minterms=None)[source]
Estimate average sensitivity with a percentile bootstrap CI.
Bootstraps the sum of per-minterm activities (\(s_t = \sum_i (1 - r_{t,i})\) with upper-bound edge contributions), not the sum of per-input CIs. Prefer a preserved
SampledPiCoverage.- Parameters:
sampled_or_schemata (SampledPiCoverage | Mapping[int, Set[str]] | None)
schemata (Mapping[int, Set[str]] | None)
n_samples (int | None)
n_boot (int)
ci (float)
norm (bool)
rng (Generator | None)
minterms (Sequence[str] | None)
- Return type:
- cana.function_properties.sensitivity.activities(outputs, k=None)[source]
Deprecated alias of
activities_from_bit_lut().outputsmay be aBitLutor a length-2**k0/1 sequence.
- cana.function_properties.sensitivity.sensitivity(outputs, k=None, norm=False)[source]
Deprecated alias of
sensitivity_from_bit_lut().outputsmay be aBitLutor a length-2**k0/1 sequence.
- cana.function_properties.sensitivity.activities_old(node)[source]
Deprecated alias of node
activities_from_schemata().
- cana.function_properties.sensitivity.sensitivity_old(node, norm=False)[source]
Deprecated alias of node
sensitivity_from_schemata().