diff --git a/AGENTS.md b/AGENTS.md
index ce4ea544..06ca9a60 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -115,7 +115,7 @@ MorphoCoverage does not replace the user's final biological inference workflow,
- **the lab's Plot&Stats cell-level test**: Cohen's d and a randomization test over the observations pooled as provided, on raw values and on values divided by the mean of the same repeat's control, labelled with its chance of p <= 0.05 without an effect, `2·P(Z > 1.96/√(1 + n·s²/2))` (`n` the observations per well, each repeat weighted by its share; `s` the SD between repeats), checked against `data/simulations/test_choice.py` and `unbalanced.py` (`contrast_cells`). When the repeats are unbalanced (one holds more than 25% more observations than another on a side, or the control is pooled from repeats the condition was not imaged in) it is also given balanced: against the control of the condition's own repeats, one permutation test whose d is the median over 100 draws of the same number of observations from every repeat and whose p shuffles the condition and control labels within each repeat, the same statistic on the same draws for each shuffle, `(extreme + 1) / (B + 1)` (owner, 2026-10-05; before, the median p over the draws, which is not the p of one test). A repeat under a quarter of the median repeat (or with fewer than 5 observations) is named and left out of the balanced test only;
- **within each repeat**, Cohen's d and the JCS effect size on objects, field means and technical-repeat means, with a randomization test over whole technical repeats only when its smallest p can reach 0.05 after Bonferroni (4 a side for one contrast), over whole fields only without a technical-repeat column;
- with a `target` column, whether independent reagents for one target are on the same side of the control in every repeat (described, not tested);
-- **one reading per condition** that puts these together (`reading_text`): significant across repeats (the paired test, normalised, q <= 0.05 after Benjamini-Hochberg within the sub-experiment: the conditions sharing their repeats and control, `_experiments`, owner 2026-10-01), same direction in every repeat but not significant (from 6 repeats, `TREND_REPEATS`; with fewer it happens by chance too often, exactly `2^(1-n)`: 25% with 3, 12.5% with 4, 3.1% with 6, so the verdict is not significant across repeats, or not tested with 2; owner, 2026-10-06, audit 8), no consistent direction, or one repeat; then the evidence (with exactly 3 repeats, each repeat's change and the 95% t interval of the change, and "very limited biological replication" said once per section; plan v2, owner 2026-10-06), and when the raw pooled test disagrees, what it does differently;
+- **one reading per condition** that puts these together (`reading_text`): significant across repeats (the paired test, normalised, q <= 0.05 after Benjamini-Hochberg within the sub-experiment: the conditions sharing their repeats and control, `_experiments`, owner 2026-10-01), same direction in every repeat but not significant (from 6 repeats, `TREND_REPEATS`; with fewer it happens by chance too often, exactly `2^(1-n)`: 25% with 3, 12.5% with 4, 3.1% with 6, so the verdict is not significant across repeats, or not tested with 2; owner, 2026-10-06, audit 8), not assessed across repeats when 3 or more repeats give the same change, so the paired test has no variance to test with (never read as not significant, #90), no consistent direction, or one repeat; then the evidence (with exactly 3 repeats, each repeat's change and the 95% t interval of the change, and "very limited biological replication" said once per section; plan v2, owner 2026-10-06), and when the raw pooled test disagrees, what it does differently;
- planning the next experiment at the design the user ran (`repeat_plan`; see "Pilots get advice", section 3);
- **with several features, which of them separate the conditions** (`discovery`, owner decision of 2026-10-01): every feature and condition by the cell-level test in the version the readings trust most (normalised, balanced when unbalanced), Benjamini-Hochberg over all of them within each sub-experiment as the discovery gate, ranked by |d|; the paired t on the repeat means, corrected the same way, beside it as the second gate ("significant across repeats"), and the direction in each repeat. The plots draw the best-ranked (`plots(..., ranking=report.discovery)`), and `embedding_plots` the PCA (the best-ranked as arrows) and UMAP of all the features. The ranking over whole technical repeats (`ranking`) is shown only when there are wells to shuffle.
@@ -174,7 +174,7 @@ Where practical, preserve compatibility with MorphoBricks metadata names such as
| `condition` | string, always | Default analysis group; always part of FOV identity. |
| `biological_repeat` | string, always (`YYYY_MM_DD`, or `single`) | Default analysis group; always part of FOV identity. Any label is accepted; the format is not enforced. Formerly `repeat`, which is refused (below). |
| `repeat_group` | string, beside `biological_repeat` (MorphoBricks-Spec experiment-v1 section 3.4) | The canonical repeat ID: the biological repeat a folder belongs to. **Every pairing of repeats reads it, never `biological_repeat`** (#617; `_repeat_groups.paired_tables`): the paired analyses and the workflows replace each folder label by its repeat group in working copies (unchanged when every label is its group), so `CTRL/rep1` and `DrugA/experiment_23` of one group pair, and `rep1` of two conditions may be two repeats. Absent beside `biological_repeat`, or ambiguous (a folder in two groups, a group with two folders of one condition, an empty value, an observation table that disagrees): the paired analysis raises `PairingRefused` with its `code`; `report` and the figures run what needs no pairing and say why, `optimise` and `benchmark` refuse. No fallback to the folder label. The analyses that pair take `repeat_col="repeat_group"` by default; `repeat_col="biological_repeat"` named explicitly pairs by folder name and is refused while the tables hold `repeat_group` (MC-1). MorphoFeature's coverage export writes it in `coverage//fovs` (MF-5). Never a feature. |
-| `condition_id` | string, beside `condition` (experiment-v1 section 3.4) | The canonical condition ID. With it, the paired analyses and the workflows name every condition by its ID in working copies (`_repeat_groups`), so a control is declared by its ID; a folder label that is not an ID is refused, naming the ID (`condition_named_by_folder_label`), in a control, a positive control, a Setup's `experiment` mapping, comparisons and a contrast table alike; a positive control or an `experiment` key that matches no condition is refused, listing the condition IDs (`condition_not_found`, #628). The source label is never replaced in what the user reads: the condition contrast's per-repeat rows gain `folder` and `control_folder`, the fields to check name their folders and the report and its page say which folder is named by which ID (`settings["repeat_pairing"]`). One ID per folder and one folder per ID, else `PairingRefused`. The analyses that do not pair read conditions by their IDs too, the repeats as given (`_repeat_groups.named_by_id`, #628): `check_tables` (a folder label is a problem naming the ID), `scan_design` (its conditions, control guess and `Setup` use the IDs; its tables keep the folder labels), `dataset_overview`, `plots_of_data`, `pairwise_contrasts` and `fov_clustering`. Never a feature. |
+| `condition_id` | string, beside `condition` (experiment-v1 section 3.4) | The canonical condition ID. With it, the paired analyses and the workflows name every condition by its ID in working copies (`_repeat_groups`), so a control is declared by its ID; a folder label that is not an ID is refused, naming the ID (`condition_named_by_folder_label`), in a control, a positive control, a Setup's `experiment` mapping, comparisons and a contrast table alike; a positive control or an `experiment` key that matches no condition is refused, listing the condition IDs (`condition_not_found`, #628). The source label is never replaced in what the user reads: the condition contrast's per-repeat rows gain `folder` and `control_folder`, the fields to check and the acquisition anomalies' rows name their folders (`folder`, #628) and the report and its page say which folder is named by which ID (`settings["repeat_pairing"]`). One ID per folder and one folder per ID, else `PairingRefused`. The analyses that do not pair read conditions by their IDs too, the repeats as given (`_repeat_groups.named_by_id`, #628): `check_tables` (a folder label is a problem naming the ID), `scan_design` (its conditions, control guess and `Setup` use the IDs; its tables keep the folder labels), `dataset_overview`, `plots_of_data`, `pairwise_contrasts` and `fov_clustering`. Never a feature. |
| `technical_repeat_id` | string, beside `technical_repeat` | The canonical technical-repeat ID: metadata, never a feature, not used for grouping. |
| `technical_repeat` | string, optional | The technical repeat within a biological repeat (a well, a dish, a coverslip); never a biological repeat. When present: a default analysis group and part of FOV identity, counted in the report's overview, the shape of the plots' points and the unit their intervals and the condition contrast and feature ranking resample or shuffle first (the contrast and the ranking take the FOV table's column whatever `group_cols` says), and the sample level of the hierarchy `Setup` derives for "more fields or more technical repeats?". Identified with its `condition` and `biological_repeat`, so well `J23` of two plates is two technical repeats. |
| `image_file` | string, always | Storage provenance; fallback FOV identifier only when one file = one spatial position. |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f648d166..8d7d766e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,29 @@ inventory's, not the Stage 2 MC-1/MC-2 of the experiment description.
### Fixed
+- **#90 (part).** A paired test across repeats that gives no p because 3 or more repeats all
+ give the same change is now "not assessed across repeats" (`reading_text.NOT_ASSESSED`),
+ never "not significant": in the reading, the summary, and the page's table across repeats,
+ where the verdict gives the reason (`contrast_repeats.NO_SPREAD`). Panel C of the figures
+ marks such a pair "=" with its reason, apart from "–" (fewer than 3 repeats imaged both),
+ in the static figure, its legend and the interactive hover, which said "fewer than 3" for
+ both. "Plan the next experiment" keeps a condition whose repeat plan has no estimable
+ answer, as "not assessable" with the plan's status, instead of leaving it out (and then
+ saying every condition was significant). The shared machine-readable status vocabulary of
+ #90 is not part of this change.
+- **#557.** The PCA figure's loading labels are placed beside their own arrows. Labels were
+ moved apart from the lowest up and returned in that order, while the names followed the
+ loadings' order, so a feature's name could sit at another feature's arrow; the positions
+ now come back in the loadings' order (`plots_embedding._spread_labels`).
+- **#555.** `percent` (and `percent_fine`) no longer raises a math domain error for a share
+ just below 100% (1 - 1e-12, or the float just below 1): the gap to 100% was rounded to 0
+ before its log was taken. The gap is now kept to the digits a float holds of it, so such a
+ share reads `99.9999999999%`, never `100%`; ordinary shares read as before.
+- **#628 (item 3).** On exports that name conditions by `condition_id` or pair repeats by
+ `repeat_group`, the acquisition anomalies' rows now name their folders, as the comparison
+ rows and the fields to check do: a `folder` column and the folders in the row's field
+ (`ctrl · repeat rep1 · img0 (folder control/rep1)`), in the report and on its page
+ (`_pairing.with_folder_labels`). A table whose folders are their IDs is unchanged.
- **#642.** `html_report`, `plots` and `plots_of_data` with `group_cols=("condition",
"repeat_group")`, the groups of MorphoFeature's notebooks, no longer raise "group_cols ...
hold ['repeat_group'], which the figure does not place". The figures place `repeat_group`
diff --git a/docs/common/data_format.md b/docs/common/data_format.md
index 0aedf1cb..782b83a9 100644
--- a/docs/common/data_format.md
+++ b/docs/common/data_format.md
@@ -40,7 +40,7 @@ result.
| `condition` | both, or FOV table only | string | Experimental group. A default analysis group and part of field identity. Needed to declare a control (`Setup.control`), to normalise to it, and for the condition contrast. |
| `biological_repeat` | both, or FOV table only | string | Biological repeat, `YYYY_MM_DD` or `single` in MorphoBricks; any label is accepted. A default analysis group and part of field identity. Normalisation and the condition contrast work within each repeat. Formerly named `repeat`: that name is refused (see [The former name `repeat`](#the-former-name-repeat)). |
| `repeat_group` | FOV table (may also be in the observation table) | string | The confirmed biological repeat a folder belongs to: the canonical repeat ID of the MorphoBricks experiment description (MorphoBricks-Spec experiment-v1 section 3.4), written beside the folder label `biological_repeat`, which stays the field's identity. **Repeats are paired by it, never by `biological_repeat`** (#617): the condition contrast, the feature ranking and discovery, the normalisation to the control of the same repeat, the object rule, unusual observations within their sub-experiment and a positive control paired within repeats all read it, so `CTRL/rep1` and `DrugA/experiment_23` in one repeat group are one biological repeat, and `rep1` of two conditions may be two. Required whenever the FOV table has a `biological_repeat` column and an analysis pairs repeats: without it, or when it is ambiguous (a folder in two groups, a group holding two folders of one condition, a field without a value, an observation table that disagrees), the paired analysis is refused with the reason (`PairingRefused`, its `code`); `report` then runs what needs no pairing and says, under question 9, why nothing was compared. Nothing falls back to the folder label. In a table of your own whose folder labels are the repeats, set it to `biological_repeat`; a table with labels equal to their groups gives the same results as before. The analyses that pair repeats take `repeat_col="repeat_group"` by default; `repeat_col="biological_repeat"` named explicitly pairs by folder name and is refused while the tables hold `repeat_group` (`PairingRefused`, code `repeat_col_pairs_by_folder_label`). A column of your own named with `repeat_col` (or `repeat_col=None`, the whole table one repeat) is your explicit declaration and is used as given. Never a feature. |
-| `condition_id` | FOV table (may also be in the observation table) | string | The condition's ID in the MorphoBricks experiment description, beside the folder label `condition`, which stays the field's identity (experiment-v1 section 3.4; `v33`: the folder `control` has the ID `ctrl`). With it, the paired analyses and the workflows name every condition by its ID, so a control is declared by its ID (`Setup(control={"condition": "ctrl"})`); a control named by a folder label that is not an ID is refused with the ID to use (code `condition_named_by_folder_label`), as is a positive control, a Setup `experiment` mapping, comparisons or a contrast table that names one; a positive control or an `experiment` key that matches no condition is refused, listing the IDs (code `condition_not_found`). `check_tables`, `scan_design`, the overview and the plots read conditions by their IDs too. The outputs keep the folder label beside the ID: the per-repeat rows of the condition contrast gain `folder` and `control_folder` (`DrugA/experiment_23`), the fields to check name their folders, and the report and its page say once which folders are named by which ID. Each folder must have one ID in every field and each ID one folder (else `PairingRefused`: `condition_id_empty`, `condition_id_split`, `condition_id_merged`, `condition_id_disagrees`, `condition_id_without_condition`). A table without it names conditions by their folder labels, as before. Never a feature. |
+| `condition_id` | FOV table (may also be in the observation table) | string | The condition's ID in the MorphoBricks experiment description, beside the folder label `condition`, which stays the field's identity (experiment-v1 section 3.4; `v33`: the folder `control` has the ID `ctrl`). With it, the paired analyses and the workflows name every condition by its ID, so a control is declared by its ID (`Setup(control={"condition": "ctrl"})`); a control named by a folder label that is not an ID is refused with the ID to use (code `condition_named_by_folder_label`), as is a positive control, a Setup `experiment` mapping, comparisons or a contrast table that names one; a positive control or an `experiment` key that matches no condition is refused, listing the IDs (code `condition_not_found`). `check_tables`, `scan_design`, the overview and the plots read conditions by their IDs too. The outputs keep the folder label beside the ID: the per-repeat rows of the condition contrast gain `folder` and `control_folder` (`DrugA/experiment_23`), the fields to check and the acquisition anomalies' rows (`folder`) name their folders, and the report and its page say once which folders are named by which ID. Each folder must have one ID in every field and each ID one folder (else `PairingRefused`: `condition_id_empty`, `condition_id_split`, `condition_id_merged`, `condition_id_disagrees`, `condition_id_without_condition`). A table without it names conditions by their folder labels, as before. Never a feature. |
| `technical_repeat` | both, or FOV table only | string | Technical repeat within the biological repeat: a well, a dish, a coverslip. Never a biological repeat. A default analysis group and part of field identity. The overview counts technical repeats. Plots shape points by them and resample them before fields. The contrast shuffles whole technical repeats when its smallest p can reach 0.05 after the Bonferroni correction, 4 a side for one contrast. `Setup` derives the hierarchy "field within technical repeat within repeat" from it, for "more fields or more technical repeats?". `single` means one technical repeat per repeat (see [A level with one member](#a-level-with-one-member-single)). |
| `technical_repeat_id` | FOV table | string | The technical repeat's ID in the MorphoBricks experiment description, beside the folder label `technical_repeat`. A shared column: read as metadata, never a feature, and not used for grouping (the technical repeat is identified with its condition and biological repeat). |
| `target` | FOV table (may also be in the observation table) | string | What each condition acts on, for example the gene two siRNAs silence (`CCT8` for `siCCT8#5` and `siCCT8#8`; `non-targeting` for the control). Not a group column. Question 9 then says, per target with two or more reagents, in how many repeats all of them are on the same side of the control; this is described, not tested. One target per condition, or the contrast raises. |
diff --git a/docs/common/function_duplicates.json b/docs/common/function_duplicates.json
index d3b36ddf..3a1aea29 100644
--- a/docs/common/function_duplicates.json
+++ b/docs/common/function_duplicates.json
@@ -284,6 +284,14 @@
"workflows._html_map_text = f\"Under each map: of each observation's {K} nearest neighbours among the other o",
"workflows._label_control = 64"
],
+ "NOT_ASSESSABLE": [
+ "workflows._enough_features = 'not assessable'",
+ "workflows._html_plan_repeats = 'not assessable'"
+ ],
+ "NOT_ASSESSED": [
+ "_style = '➖'",
+ "sampling_unit.reading_text = 'not assessed across repeats'"
+ ],
"NO_CONTROL": [
"_control = 'no control is declared: comparisons are available only for explicitly requested",
"retrospective.effect_preservation = 'not evaluable: no control fields in this repeat'",
diff --git a/docs/common/function_index.jsonl b/docs/common/function_index.jsonl
index c8adb4fd..2c106cfb 100644
--- a/docs/common/function_index.jsonl
+++ b/docs/common/function_index.jsonl
@@ -414,7 +414,7 @@
{"arguments": 3, "called_by": ["feature_tables:_usable_tables"], "calls": ["_wording:listing", "list"], "complexity": 2, "decorators": [], "hash": "7d4ba7e51414f5b5", "kind": "function", "lines": 11, "module": "_within_identity", "name": "absent_identity_text", "public": true, "signature": "(label: str, absent: Sequence[str], identity: Sequence[str]) -> str", "summary": "Why a table lacking identity columns cannot be matched, naming the within-field ones.", "varargs": []}
{"arguments": 0, "called_by": ["feature_tables:attach_feature_tables"], "calls": [], "complexity": 1, "decorators": [], "hash": "9a5c987bbe7d0e85", "kind": "function", "lines": 4, "module": "_within_identity", "name": "duplicate_identity_text", "public": true, "signature": "() -> str", "summary": "What to do when observations of a field share their identity.", "varargs": []}
{"calls": ["_wording:plural"], "kind": "module", "module": "_wording", "name": "", "public": false, "summary": "Shared wording of the summaries (private): percentages, counts, fields and groups."}
-{"arguments": 1, "called_by": ["_feature_rules:_check_feature_values", "_integrity_selection:_selection", "_style:span", "_wording:percent_fine", "order_check:OrderCheck._coverage", "plots_embedding:embedding_figures", "retrospective._new_states:_reference", "retrospective._value_checks:few_values", "retrospective.calibration:_calibration_row", "retrospective.calibration:_never_cell", "retrospective.calibration:_not_preserved_cell", "retrospective.controls_text:_by_stratum", "retrospective.controls_text:_rate", "retrospective.controls_text:_strata_table", "retrospective.controls_text:_weak", "retrospective.controls_text:cannot_tell", "retrospective.effect_preservation:_summary", "retrospective.effort_text:_allocation_cell", "retrospective.effort_text:_allocation_line", "retrospective.effort_text:_imbalance_line", "retrospective.effort_text:_largest_cell", "retrospective.effort_text:_stratum_lines", "retrospective.frontier_text:_interval", "retrospective.frontier_text:_interval_words", "retrospective.frontier_text:_lapse", "retrospective.frontier_text:_risk", "retrospective.frontier_text:frontier_status", "retrospective.frontier_text:frontier_summary", "retrospective.inspection:_influential", "retrospective.order_text:_cells", "retrospective.protocol_text:_cells", "retrospective.protocol_text:_difficulty", "retrospective.protocol_text:_words", "retrospective.reliability_text:_ceiling_parts", "retrospective.reliability_text:_row_cells", "retrospective.report_enough:detection_line", "retrospective.report_profile:_adjusted_lines", "retrospective.report_profile:_chance_part", "retrospective.report_profile:_detection_adjusted_bounds", "retrospective.report_profile:_detection_words", "retrospective.report_profile:_effort_rows", "retrospective.report_profile:_representation_rows", "retrospective.report_profile:_variability_rows", "retrospective.report_resolved:_columns", "retrospective.report_resolved:_notes", "retrospective.report_resolved:resolved_full", "retrospective.report_sampling:_fields_line", "retrospective.report_sampling:_unusual_share", "retrospective.report_sampling:unusual_alone", "retrospective.report_status:_too_early", "retrospective.report_status:calibration_status", "retrospective.report_status_controls:_recognized", "retrospective.report_status_controls:controls_status", "retrospective.report_status_plan:_reliability_status", "retrospective.report_status_plan:bought_status", "sampling_unit._reading_cells:chance_words", "sampling_unit._state_text:_agreement", "sampling_unit._state_text:_state_cells", "sampling_unit._state_text:_state_columns", "sampling_unit._state_text:_unusual_cautions", "sampling_unit._state_text:_unusual_head", "sampling_unit._state_text:background", "sampling_unit._state_text:unusual_full", "sampling_unit._state_text:unusual_parts", "sampling_unit._unit_text:_single_parts", "sampling_unit._unit_text:variability_full", "sampling_unit._unit_text:variability_parts", "sampling_unit.cells_text:_balance", "sampling_unit.cells_text:_sparse", "sampling_unit.contrast_text:_draw_cells", "sampling_unit.repeat_plan_text:_plan_head", "separation:Separation.comparison", "separation:Separation.line", "strategies.fov_bootstrap:FOVBootstrapEstimator._undefined_reason", "strategies.novelty_null:not_informative", "strategies.novelty_null:uninformative_line", "sufficiency_full:_check_line", "sufficiency_full:_few_line", "sufficiency_full:_needed_line", "sufficiency_full:_next_field_lines", "sufficiency_null:uninformative_sentence", "sufficiency_short:_novelty_cautions", "sufficiency_short:_novelty_lines", "sufficiency_short:_one_more_field", "sufficiency_short:_span", "sufficiency_short:_technical_lines", "sufficiency_text:_chance_line", "sufficiency_text:_few_fovs_lines", "sufficiency_text:_next_fov_answer", "sufficiency_text:_target_lines", "sufficiency_text:_technical_repeats_line", "sufficiency_text:_unseen_line", "workflows._declaration:_positive", "workflows._declaration:_positive_short", "workflows._document:_technical_repeats", "workflows._document:held_back_text", "workflows._document:plan_settings", "workflows._enough_targets:_unjudged_reasons", "workflows._html_map_sets:_held", "workflows._html_map_sets:_pca", "workflows._html_map_text:_row", "workflows._html_map_text:share_lines", "workflows._html_tests:_chance", "workflows._label_control:label_answer", "workflows._population_context:mostly_words", "workflows._population_rule_words:rule_cell", "workflows._population_rule_words:rule_words", "workflows._population_text_parts:no_group_answer", "workflows._population_text_parts:population_assumptions", "workflows._populations:_group_row", "workflows._populations:_label_line", "workflows._result_influence:_found", "workflows._scan_rules:_balance_findings", "workflows.benchmarks:_benchmark_settings", "workflows.benchmarks:_grid_problem", "workflows.guided:Answers.fingerprint", "workflows.guided:Answers.lines"], "calls": ["float", "math.floor", "math.isnan", "math.log10", "max", "round"], "complexity": 5, "decorators": [], "hash": "1df16d887d8ffb5e", "kind": "function", "lines": 13, "module": "_wording", "name": "percent", "public": true, "signature": "(value: float) -> str", "summary": "A share as a short percentage: ``37%``, ``0.3%``, ``99.5%``; ``undefined`` for NaN.", "varargs": []}
+{"arguments": 1, "called_by": ["_feature_rules:_check_feature_values", "_integrity_selection:_selection", "_style:span", "_wording:percent_fine", "order_check:OrderCheck._coverage", "plots_embedding:embedding_figures", "retrospective._new_states:_reference", "retrospective._value_checks:few_values", "retrospective.calibration:_calibration_row", "retrospective.calibration:_never_cell", "retrospective.calibration:_not_preserved_cell", "retrospective.controls_text:_by_stratum", "retrospective.controls_text:_rate", "retrospective.controls_text:_strata_table", "retrospective.controls_text:_weak", "retrospective.controls_text:cannot_tell", "retrospective.effect_preservation:_summary", "retrospective.effort_text:_allocation_cell", "retrospective.effort_text:_allocation_line", "retrospective.effort_text:_imbalance_line", "retrospective.effort_text:_largest_cell", "retrospective.effort_text:_stratum_lines", "retrospective.frontier_text:_interval", "retrospective.frontier_text:_interval_words", "retrospective.frontier_text:_lapse", "retrospective.frontier_text:_risk", "retrospective.frontier_text:frontier_status", "retrospective.frontier_text:frontier_summary", "retrospective.inspection:_influential", "retrospective.order_text:_cells", "retrospective.protocol_text:_cells", "retrospective.protocol_text:_difficulty", "retrospective.protocol_text:_words", "retrospective.reliability_text:_ceiling_parts", "retrospective.reliability_text:_row_cells", "retrospective.report_enough:detection_line", "retrospective.report_profile:_adjusted_lines", "retrospective.report_profile:_chance_part", "retrospective.report_profile:_detection_adjusted_bounds", "retrospective.report_profile:_detection_words", "retrospective.report_profile:_effort_rows", "retrospective.report_profile:_representation_rows", "retrospective.report_profile:_variability_rows", "retrospective.report_resolved:_columns", "retrospective.report_resolved:_notes", "retrospective.report_resolved:resolved_full", "retrospective.report_sampling:_fields_line", "retrospective.report_sampling:_unusual_share", "retrospective.report_sampling:unusual_alone", "retrospective.report_status:_too_early", "retrospective.report_status:calibration_status", "retrospective.report_status_controls:_recognized", "retrospective.report_status_controls:controls_status", "retrospective.report_status_plan:_reliability_status", "retrospective.report_status_plan:bought_status", "sampling_unit._reading_cells:chance_words", "sampling_unit._state_text:_agreement", "sampling_unit._state_text:_state_cells", "sampling_unit._state_text:_state_columns", "sampling_unit._state_text:_unusual_cautions", "sampling_unit._state_text:_unusual_head", "sampling_unit._state_text:background", "sampling_unit._state_text:unusual_full", "sampling_unit._state_text:unusual_parts", "sampling_unit._unit_text:_single_parts", "sampling_unit._unit_text:variability_full", "sampling_unit._unit_text:variability_parts", "sampling_unit.cells_text:_balance", "sampling_unit.cells_text:_sparse", "sampling_unit.contrast_text:_draw_cells", "sampling_unit.repeat_plan_text:_plan_head", "separation:Separation.comparison", "separation:Separation.line", "strategies.fov_bootstrap:FOVBootstrapEstimator._undefined_reason", "strategies.novelty_null:not_informative", "strategies.novelty_null:uninformative_line", "sufficiency_full:_check_line", "sufficiency_full:_few_line", "sufficiency_full:_needed_line", "sufficiency_full:_next_field_lines", "sufficiency_null:uninformative_sentence", "sufficiency_short:_novelty_cautions", "sufficiency_short:_novelty_lines", "sufficiency_short:_one_more_field", "sufficiency_short:_span", "sufficiency_short:_technical_lines", "sufficiency_text:_chance_line", "sufficiency_text:_few_fovs_lines", "sufficiency_text:_next_fov_answer", "sufficiency_text:_target_lines", "sufficiency_text:_technical_repeats_line", "sufficiency_text:_unseen_line", "workflows._declaration:_positive", "workflows._declaration:_positive_short", "workflows._document:_technical_repeats", "workflows._document:held_back_text", "workflows._document:plan_settings", "workflows._enough_targets:_unjudged_reasons", "workflows._html_map_sets:_held", "workflows._html_map_sets:_pca", "workflows._html_map_text:_row", "workflows._html_map_text:share_lines", "workflows._html_tests:_chance", "workflows._label_control:label_answer", "workflows._population_context:mostly_words", "workflows._population_rule_words:rule_cell", "workflows._population_rule_words:rule_words", "workflows._population_text_parts:no_group_answer", "workflows._population_text_parts:population_assumptions", "workflows._populations:_group_row", "workflows._populations:_label_line", "workflows._result_influence:_found", "workflows._scan_rules:_balance_findings", "workflows.benchmarks:_benchmark_settings", "workflows.benchmarks:_grid_problem", "workflows.guided:Answers.fingerprint", "workflows.guided:Answers.lines"], "calls": ["float", "math.floor", "math.isnan", "math.log10", "max", "min"], "complexity": 7, "decorators": [], "hash": "0798f2bf04968e00", "kind": "function", "lines": 20, "module": "_wording", "name": "percent", "public": true, "signature": "(value: float) -> str", "summary": "A share as a short percentage: ``37%``, ``0.3%``, ``99.5%``; ``undefined`` for NaN.", "varargs": []}
{"arguments": 1, "called_by": ["sampling_unit._unit_text:object_rule_full", "sampling_unit.acquisition:difference_words", "sampling_unit.reading_text:change_words", "workflows._html_next:not_rare", "workflows._html_next:populations_next", "workflows._html_plan:_group_goals", "workflows._html_plan:_live_rare", "workflows._populations:_finding", "workflows._populations:_group_lines", "workflows._populations:_group_row", "workflows._populations:_shares_line", "workflows._populations:_versus"], "calls": ["_wording:percent", "float", "math.isnan"], "complexity": 3, "decorators": [], "hash": "a344439e00b21742", "kind": "function", "lines": 4, "module": "_wording", "name": "percent_fine", "public": true, "signature": "(value: float) -> str", "summary": "A share with one decimal below 10% (``6.8%``, ``1.8%``), else as ``percent``: for small", "varargs": []}
{"arguments": 1, "called_by": ["_plots_text:title", "_rule_names:_bound", "_rule_names:_precision_rule", "results:_averaging_cv_note", "retrospective.effect_preservation:_summary", "sampling_unit._unit_text:_rule_cautions", "sampling_unit._unit_text:object_rule_full", "sampling_unit._unit_text:object_rule_parts", "workflows._declaration:_novelty", "workflows._declaration:_novelty_short", "workflows._declaration:_rules", "workflows._declaration:_rules_short", "workflows._declaration:declaration", "workflows._declaration:declaration_short", "workflows._declaration_rare:rare_line", "workflows._declaration_rare:rare_short", "workflows._enough_targets:held_back_note", "workflows._enough_targets:rare_lines", "workflows._html_plan:_difference_goal", "workflows._html_plan:_live_mean", "workflows._html_plan:_live_rare", "workflows._html_plan:_tolerances", "workflows._html_sections:what_checked", "workflows.setup:Setup.criteria"], "calls": ["float"], "complexity": 1, "decorators": [], "hash": "ae371b74e655b0c7", "kind": "function", "lines": 1, "module": "_wording", "name": "rate", "public": true, "signature": "(value: float) -> str", "summary": "A declared rate as it was set: ``2.5%``, ``5%``, ``95%``, ``0.1%`` (never rounded).", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:format_p", "sampling_unit._reading_cells:_cells", "sampling_unit.across_text:_rows", "sampling_unit.cells_text:_test", "sampling_unit.discovery:_q", "sampling_unit.discovery:_screen", "sampling_unit.legend_text:_condition", "sampling_unit.reading_text:_paired", "sampling_unit.repeats_text:_p_cell", "workflows._distribution:_cell", "workflows._distribution:_named", "workflows._html_across:_across", "workflows._html_cards:_candidate", "workflows._html_cards:_significant", "workflows._html_sections:_square", "workflows._html_tests:_beyond", "workflows._html_tests:_cells_rows", "workflows._html_tests:_other_versions", "workflows._populations:_enriched", "workflows._populations:_finding", "workflows._populations:_group_parts", "workflows._result_influence:_effect", "workflows._whole_table:_line", "workflows._whole_table:whole_headline"], "calls": ["float", "math.isnan"], "complexity": 6, "decorators": [], "hash": "1fa92cc7f86bc063", "kind": "function", "lines": 9, "module": "_wording", "name": "p_value", "public": true, "signature": "(value: float) -> str", "summary": "A p- or q-value in a sentence: ``< 0.001``, two significant digits below 0.01, four", "varargs": []}
@@ -809,10 +809,11 @@
{"calls": [], "kind": "module", "module": "plots_embedding", "name": "", "public": true, "summary": "Figures of an ``embedding.Embedding``: the PCA biplot and the UMAP, coloured by condition."}
{"arguments": 3, "called_by": ["plots_embedding:embedding_figures"], "calls": ["_palette:condition_palette", "metadata:sorted_labels"], "complexity": 2, "decorators": [], "hash": "cc093aede9dfb4ae", "kind": "function", "lines": 4, "module": "plots_embedding", "name": "_colours", "public": false, "signature": "(points: pd.DataFrame, control: Any, highlight: Sequence[Any]) -> dict[Any, str]", "summary": "A colour per condition in sorted order, the control first in the palette's first", "varargs": []}
{"arguments": 5, "called_by": ["plots_embedding:embedding_figures"], "calls": ["?.dropna", "?.isin", "?.items", "?.legend", "?.scatter", "any", "bool", "len", "min"], "complexity": 6, "decorators": [], "hash": "cfbca4a9ac2ad6e0", "kind": "function", "lines": 36, "module": "plots_embedding", "name": "_scatter", "public": false, "signature": "(ax: Axes, points: pd.DataFrame, x: str, y: str, colours: dict[Any, str]) -> None", "summary": "The points by condition: the grey ones first, as one entry of the legend.", "varargs": []}
-{"arguments": 3, "called_by": ["plots_embedding:_arrows"], "calls": ["?.append", "abs", "any", "sorted"], "complexity": 4, "decorators": [], "hash": "aa8ee6d95a5fd086", "kind": "function", "lines": 7, "module": "plots_embedding", "name": "_spread_labels", "public": false, "signature": "(positions: list[tuple[float, float]], x_span: float, y_span: float) -> list[tuple[float, float]]", "summary": "Label positions with labels that fall on one another moved apart vertically: arrows of", "varargs": []}
+{"arguments": 3, "called_by": ["plots_embedding:_arrows"], "calls": ["?.append", "abs", "any", "len", "list", "range", "sorted"], "complexity": 4, "decorators": [], "hash": "848a3197ba2e27ce", "kind": "function", "lines": 10, "module": "plots_embedding", "name": "_spread_labels", "public": false, "signature": "(positions: list[tuple[float, float]], x_span: float, y_span: float) -> list[tuple[float, float]]", "summary": "Label positions, in the order of ``positions``, with labels that fall on one another", "varargs": []}
{"arguments": 2, "called_by": ["plots_embedding:embedding_figures"], "calls": ["?.annotate", "?.get_xlim", "?.get_ylim", "?.itertuples", "?.max", "?.set_path_effects", "?.set_xlim", "?.set_ylim", "?.sort_values", "?.text", "float", "len", "matplotlib.patheffects.withStroke", "max", "min", "numpy.hypot", "numpy.nanmax", "plots_embedding:_spread_labels", "str", "zip"], "complexity": 8, "decorators": [], "hash": "f7b09abfad0dca43", "kind": "function", "lines": 60, "module": "plots_embedding", "name": "_arrows", "public": false, "signature": "(ax: Axes, embedding: Embedding) -> None", "summary": "", "varargs": []}
{"arguments": 3, "called_by": ["workflows._html_maps:_static", "workflows.figures:embedding_plots"], "calls": ["?.add_subplot", "?.any", "?.get", "?.notna", "?.set_title", "?.set_xlabel", "?.set_xticks", "?.set_ylabel", "?.set_yticks", "TypeError", "_observation_units:observation_words", "_palette:style_axes", "_wording:count", "_wording:percent", "dict", "embedding:Embedding", "isinstance", "len", "matplotlib.figure.Figure", "plots_embedding:_arrows", "plots_embedding:_colours", "plots_embedding:_scatter"], "complexity": 4, "decorators": [], "hash": "d1838dc161ed21de", "kind": "function", "lines": 42, "module": "plots_embedding", "name": "embedding_figures", "public": true, "signature": "(embedding: Embedding, *, control: Mapping[str, Any] | None=None, highlight: Sequence[Any]=()) -> dict[str, Figure]", "summary": "``{\"pca\": Figure, \"umap\": Figure}`` (UMAP only when it was computed; see the module).", "varargs": []}
{"calls": ["?.replace"], "kind": "module", "module": "plots_pairwise", "name": "", "public": true, "summary": "Every pair of conditions for one feature, as the lab's Plot&Stats notebook shows them"}
+{"arguments": 1, "called_by": ["plots_pairwise:_matrix", "workflows._html_plotly:_paired_panel"], "calls": ["int"], "complexity": 3, "decorators": [], "hash": "25c521970303443e", "kind": "function", "lines": 9, "module": "plots_pairwise", "name": "unpaired_words", "public": true, "signature": "(pair: Any) -> tuple[str, str]", "summary": "Panel C's mark and words for a pair with no paired p (#90): ``APART_MARK`` normalised to", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:add_pairwise", "workflows._html_figures:_verdict_paragraph"], "calls": ["?.items", "?.join", "numpy.isfinite", "plots_pairwise:format_p"], "complexity": 3, "decorators": [], "hash": "aede0a62b2ffa447", "kind": "function", "lines": 6, "module": "plots_pairwise", "name": "verdict_note", "public": true, "signature": "(verdicts: Mapping[Any, float]) -> str", "summary": "The verdict's q of each condition against its control, the feature's family (audit", "varargs": []}
{"arguments": 3, "called_by": ["plots_pairwise:_pair"], "calls": ["_repeat_statistics:paired_t", "_repeat_statistics:repeat_values", "len", "numpy.array", "numpy.mean"], "complexity": 2, "decorators": [], "hash": "cb3cd1ebb5bdc512", "kind": "function", "lines": 7, "module": "plots_pairwise", "name": "_paired", "public": false, "signature": "(first: dict, second: dict, log: bool | None=None) -> tuple[float, str, int]", "summary": "The paired t-test of two conditions on the repeats they share, on the feature's scale", "varargs": []}
{"arguments": 12, "called_by": ["workflows.figures:_add_pairwise"], "calls": ["?.append", "?.feature_values", "?.get", "?.groupby", "?.reset_index", "?.to_numpy", "_checks:as_count", "_checks:check_seed", "_repeat_groups:named_by_id", "_repeat_groups:repeat_level", "_repeat_statistics:log_scale", "data_check:validate_input_tables", "itertools.combinations", "len", "list", "metadata:sorted_labels", "numpy.isnan", "pandas.DataFrame", "plots_pairwise:_apart", "plots_pairwise:_pair", "repr", "schema:fov_positions", "statistics:benjamini_hochberg"], "complexity": 12, "decorators": [], "hash": "9e4be987a069295c", "kind": "function", "lines": 44, "module": "plots_pairwise", "name": "pairwise_contrasts", "public": true, "signature": "(objects: pd.DataFrame, fovs: pd.DataFrame, *, feature: str, conditions: Sequence[Any] | None=None, control: Any=None, fov_col: str | None=None, group_cols: Sequence[str] | None=None, observation_unit: str | None=None, n_permutations: int=N_PERMUTATIONS, random_state: int=0, references: Mapping[Any, Any] | None=None, scale: str | None=None) -> pd.DataFrame", "summary": "One row per pair of ``conditions`` (all, the ``control`` first, by default); see the", "varargs": []}
@@ -821,13 +822,13 @@
{"arguments": 3, "called_by": ["plots_pairwise:d_colour", "plots_pairwise:p_colour"], "calls": ["tuple", "zip"], "complexity": 1, "decorators": [], "hash": "51f2e0c38d40ad63", "kind": "function", "lines": 1, "module": "plots_pairwise", "name": "_mix", "public": false, "signature": "(start: tuple, end: tuple, share: float) -> tuple[float, float, float]", "summary": "", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:_cells_d"], "calls": ["abs", "min", "numpy.isfinite", "plots_pairwise:_mix"], "complexity": 3, "decorators": [], "hash": "bebac3998572eaac", "kind": "function", "lines": 3, "module": "plots_pairwise", "name": "d_colour", "public": true, "signature": "(d: float) -> tuple[float, float, float]", "summary": "The colour of ``d``: the middle at 0, blue lower, red higher, full at ``D_CAP``.", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:p_colour", "workflows._html_plotly:_paired_panel", "workflows._html_plotly:_q_cell"], "calls": ["max", "min", "numpy.isfinite", "numpy.log10"], "complexity": 3, "decorators": [], "hash": "b5e0aaf35efa9284", "kind": "function", "lines": 4, "module": "plots_pairwise", "name": "p_shade", "public": true, "signature": "(p: float) -> float", "summary": "How strongly a corrected p is shaded: 0 above ``ALPHA`` (so a p that does not pass is", "varargs": []}
-{"arguments": 1, "called_by": ["plots_pairwise:_cells_p"], "calls": ["plots_pairwise:_mix", "plots_pairwise:p_shade"], "complexity": 1, "decorators": [], "hash": "2e74b1b05db96907", "kind": "function", "lines": 1, "module": "plots_pairwise", "name": "p_colour", "public": true, "signature": "(p: float) -> tuple[float, float, float]", "summary": "The colour of a corrected p (``p_shade``): grey when it does not pass, green when it", "varargs": []}
+{"arguments": 1, "called_by": ["plots_pairwise:_cells_p", "plots_pairwise:_matrix"], "calls": ["plots_pairwise:_mix", "plots_pairwise:p_shade"], "complexity": 1, "decorators": [], "hash": "2e74b1b05db96907", "kind": "function", "lines": 1, "module": "plots_pairwise", "name": "p_colour", "public": true, "signature": "(p: float) -> tuple[float, float, float]", "summary": "The colour of a corrected p (``p_shade``): grey when it does not pass, green when it", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:_cells_p", "plots_pairwise:verdict_note", "workflows._html_plotly:_paired_panel", "workflows._html_plotly:_q_cell"], "calls": ["_wording:p_value"], "complexity": 1, "decorators": [], "hash": "34179904872226ac", "kind": "function", "lines": 1, "module": "plots_pairwise", "name": "format_p", "public": true, "signature": "(p: float) -> str", "summary": "A p-value in a cell, written as in a sentence (``_wording.p_value``: ``< 0.001``, two", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:_matrix"], "calls": ["sum"], "complexity": 2, "decorators": [], "hash": "90bdb5c4bfe31605", "kind": "function", "lines": 1, "module": "plots_pairwise", "name": "_ink", "public": false, "signature": "(colour: tuple[float, float, float]) -> str", "summary": "", "varargs": []}
{"arguments": 2, "called_by": ["plots_pairwise:_matrix"], "calls": ["numpy.isfinite", "plots_pairwise:d_colour"], "complexity": 6, "decorators": [], "hash": "5a7c5e8ce5945646", "kind": "function", "lines": 7, "module": "plots_pairwise", "name": "_cells_d", "public": false, "signature": "(pair: Any, row: Any) -> tuple[str, tuple, str]", "summary": "Panel B, lower left: d of the row's condition minus the column's.", "varargs": []}
{"arguments": 1, "called_by": ["plots_pairwise:_matrix"], "calls": ["numpy.isfinite", "plots_pairwise:format_p", "plots_pairwise:p_colour"], "complexity": 3, "decorators": [], "hash": "67b245fe10479c54", "kind": "function", "lines": 3, "module": "plots_pairwise", "name": "_cells_p", "public": false, "signature": "(value: float) -> tuple[str, tuple, str]", "summary": "A p- or q-value cell: green at or below ``ALPHA``, \"–\" when there is none (a pair", "varargs": []}
{"arguments": 2, "called_by": ["plots_pairwise:_matrix", "plots_pairwise:add_pairwise"], "calls": ["?.join", "?.split", "int", "max", "textwrap.wrap"], "complexity": 1, "decorators": [], "hash": "d95659ef818f83fd", "kind": "function", "lines": 4, "module": "plots_pairwise", "name": "_title", "public": false, "signature": "(panel: str, side: float) -> str", "summary": "A panel's title and the key of its triangles, wrapped to its width (``side`` inches at", "varargs": []}
-{"arguments": 6, "called_by": ["plots_pairwise:add_pairwise"], "calls": ["?.add_patch", "?.get", "?.itertuples", "?.set_title", "?.set_visible", "?.set_xlabel", "?.set_xlim", "?.set_xticklabels", "?.set_xticks", "?.set_ylabel", "?.set_ylim", "?.set_yticklabels", "?.set_yticks", "?.text", "?.tick_params", "?.values", "_wording:shortened", "enumerate", "float", "len", "numpy.arange", "plots_pairwise:_cells_d", "plots_pairwise:_cells_p", "plots_pairwise:_ink", "plots_pairwise:_square", "plots_pairwise:_title"], "complexity": 14, "decorators": [], "hash": "b751544d0e2ad2f0", "kind": "function", "lines": 42, "module": "plots_pairwise", "name": "_matrix", "public": false, "signature": "(ax: Axes, conditions: list[Any], table: pd.DataFrame, panel: str, *, ylabels: bool, side: float) -> None", "summary": "Draw panel ``\"B\"`` (d and the randomization q) or ``\"C\"`` (the paired p and q).", "varargs": []}
+{"arguments": 6, "called_by": ["plots_pairwise:add_pairwise"], "calls": ["?.add_patch", "?.get", "?.itertuples", "?.set_title", "?.set_visible", "?.set_xlabel", "?.set_xlim", "?.set_xticklabels", "?.set_xticks", "?.set_ylabel", "?.set_ylim", "?.set_yticklabels", "?.set_yticks", "?.text", "?.tick_params", "?.values", "_wording:shortened", "enumerate", "float", "len", "numpy.arange", "numpy.isfinite", "plots_pairwise:_cells_d", "plots_pairwise:_cells_p", "plots_pairwise:_ink", "plots_pairwise:_square", "plots_pairwise:_title", "plots_pairwise:p_colour", "plots_pairwise:unpaired_words"], "complexity": 15, "decorators": [], "hash": "af5f5f6f368f395c", "kind": "function", "lines": 47, "module": "plots_pairwise", "name": "_matrix", "public": false, "signature": "(ax: Axes, conditions: list[Any], table: pd.DataFrame, panel: str, *, ylabels: bool, side: float) -> None", "summary": "Draw panel ``\"B\"`` (d and the randomization q) or ``\"C\"`` (the paired p and q).", "varargs": []}
{"arguments": 5, "called_by": ["workflows.figures:_add_pairwise"], "calls": ["?.add_axes", "?.count", "?.get_size_inches", "?.join", "_figure_layout:grow_bottom", "_figure_layout:panel_letter", "_figure_layout:remove_legend", "_figure_layout:sentences", "_figure_layout:set_legend", "_wording:shortened", "filter", "getattr", "len", "list", "max", "min", "plots_pairwise:_matrix", "plots_pairwise:_title", "plots_pairwise:verdict_note"], "complexity": 8, "decorators": [], "hash": "ab83ffe9dbdca7f0", "kind": "function", "lines": 40, "module": "plots_pairwise", "name": "add_pairwise", "public": true, "signature": "(figure: Figure, table: pd.DataFrame, conditions: Sequence[Any], several: bool=False, verdicts: Mapping[Any, float] | None=None) -> None", "summary": "Panels B (d and the randomization test) and C (the paired t-test on the repeats'", "varargs": []}
{"arguments": 3, "called_by": ["plots_pairwise:_matrix"], "calls": ["matplotlib.patches.FancyBboxPatch"], "complexity": 1, "decorators": [], "hash": "b1af97a23bcc8247", "kind": "function", "lines": 10, "module": "plots_pairwise", "name": "_square", "public": false, "signature": "(x: float, y: float, colour: tuple[float, float, float]) -> FancyBboxPatch", "summary": "", "varargs": []}
{"calls": [], "kind": "module", "module": "policies", "name": "", "public": true, "summary": "Decision policies: turn evidence and effort into continue/stop."}
@@ -1834,7 +1835,7 @@
{"arguments": 5, "called_by": ["sampling_unit.contrast:_compared"], "calls": ["?.items", "?.map", "?.reset_index", "?.set_index", "len", "list", "pandas.DataFrame", "pandas.Series", "sampling_unit._experiments:declared", "sampling_unit._experiments:experiments", "sampling_unit.contrast_cells:_cell_row", "sampling_unit.contrast_cells:_correct"], "complexity": 2, "decorators": [], "hash": "a2ae168a55db274b", "kind": "function", "lines": 15, "module": "sampling_unit.contrast_cells", "name": "cell_table", "public": true, "signature": "(pooled: dict[Any, dict[str, Any]], plan: pd.DataFrame, n_permutations: int, rng_for: Any, families: Mapping[Any, Any] | None=None) -> pd.DataFrame", "summary": "One row per condition: the cell-level test pooled as provided, the balance check and,", "varargs": []}
{"arguments": 4, "called_by": ["sampling_unit.contrast_cells:cell_table"], "calls": ["?.endswith", "?.replace", "?.rng_for", "?.to_numpy", "?.where", "numpy.fmax", "numpy.where", "pandas.Series", "sampling_unit._experiments:corrected", "sampling_unit.contrast_cells:refined"], "complexity": 7, "decorators": [], "hash": "a7b68c9c59e5db22", "kind": "function", "lines": 21, "module": "sampling_unit.contrast_cells", "name": "_correct", "public": false, "signature": "(table: pd.DataFrame, n_permutations: int, rng_for: Any, retests: dict[str, dict[Any, Retest]]) -> None", "summary": "Each p column refined and corrected within its sub-experiment, in place: its ``q_``", "varargs": []}
{"calls": [], "kind": "module", "module": "sampling_unit.contrast_repeats", "name": "", "public": true, "summary": "Each condition against the control across biological repeats, the repeat as the replicate."}
-{"arguments": 2, "called_by": ["sampling_unit.contrast_repeats:_condition_row", "sampling_unit.legend_text:_untested_legend"], "calls": ["numpy.isfinite"], "complexity": 3, "decorators": [], "hash": "c0d585d67ccc20a0", "kind": "function", "lines": 3, "module": "sampling_unit.contrast_repeats", "name": "untested_reason", "public": true, "signature": "(repeats: int, p: float) -> str | None", "summary": "Why a paired test of ``repeats`` repeats gave ``p``: ``FEW_REPEATS`` below the minimum,", "varargs": []}
+{"arguments": 2, "called_by": ["sampling_unit.contrast_repeats:_condition_row", "sampling_unit.legend_text:_untested_legend", "workflows._html_across:_verdict"], "calls": ["numpy.isfinite"], "complexity": 3, "decorators": [], "hash": "c0d585d67ccc20a0", "kind": "function", "lines": 3, "module": "sampling_unit.contrast_repeats", "name": "untested_reason", "public": true, "signature": "(repeats: int, p: float) -> str | None", "summary": "Why a paired test of ``repeats`` repeats gave ``p``: ``FEW_REPEATS`` below the minimum,", "varargs": []}
{"arguments": 3, "called_by": ["sampling_unit.contrast_across:_row", "sampling_unit.contrast_repeats:_condition_row"], "calls": ["?.choice", "?.max", "?.mean", "?.sum", "abs", "float", "int", "itertools.product", "len", "list", "min", "numpy.abs", "numpy.array", "numpy.count_nonzero", "numpy.mean"], "complexity": 2, "decorators": [], "hash": "cdfc570d7184c567", "kind": "function", "lines": 13, "module": "sampling_unit.contrast_repeats", "name": "sign_flip_test", "public": true, "signature": "(differences: np.ndarray, rng: np.random.Generator, n_draws: int=20000) -> tuple[float, float, bool]", "summary": "``(p, floor, exact)``: the two-sided sign-flip test of paired differences.", "varargs": []}
{"arguments": 2, "called_by": ["sampling_unit.contrast_repeats:_condition_row", "sampling_unit.contrast_repeats:_described"], "calls": ["_repeat_statistics:repeat_values", "len", "numpy.full"], "complexity": 2, "decorators": [], "hash": "34ce0b36ae4549ee", "kind": "function", "lines": 2, "module": "sampling_unit.contrast_repeats", "name": "_log_ratios", "public": false, "signature": "(block: pd.DataFrame, log: bool | None=None) -> np.ndarray", "summary": "Per repeat, log(condition mean / control mean); NaN (no test) unless the feature is", "varargs": []}
{"arguments": 5, "called_by": ["sampling_unit.contrast:_compared"], "calls": ["?.groupby", "?.join", "?.max", "?.notna", "ValueError", "pandas.DataFrame", "sampling_unit.contrast_repeats:_condition_row", "sampling_unit.contrast_repeats:_corrected"], "complexity": 6, "decorators": [], "hash": "20cd1496710b048f", "kind": "function", "lines": 21, "module": "sampling_unit.contrast_repeats", "name": "across_repeats", "public": true, "signature": "(table: pd.DataFrame, repeat_col: str | None, random_state: int, log: bool | None=None, families: Mapping[Any, Any] | None=None) -> pd.DataFrame", "summary": "One row per condition and control across the repeats of the per-repeat ``table``", "varargs": []}
@@ -2005,7 +2006,7 @@
{"arguments": 1, "called_by": ["retrospective.report_status_conditions:_contrast_parts", "sampling_unit.reading_text:_together", "sampling_unit.reading_text:readings_headline", "sampling_unit.reading_text:readings_parts", "workflows._html_cards:readout_summary", "workflows._html_plan:_done"], "calls": ["?.get", "?.iterrows", "_observation_units:observation_words", "_wording:column_word", "getattr", "pandas.DataFrame", "sampling_unit.reading_text:_by_condition", "sampling_unit.reading_text:_direction_rows", "sampling_unit.reading_text:_reading"], "complexity": 2, "decorators": [], "hash": "292fa06bdf8836ac", "kind": "function", "lines": 11, "module": "sampling_unit.reading_text", "name": "condition_readings", "public": true, "signature": "(contrast: Any) -> pd.DataFrame", "summary": "One row per condition: ``condition``, ``control_condition``, ``verdict`` (one of", "varargs": []}
{"arguments": 6, "called_by": ["sampling_unit.reading_text:condition_readings"], "calls": ["?.join", "int", "sampling_unit._experiments:left_out", "sampling_unit._reading_cells:_cells", "sampling_unit.reading_text:_effect_words", "sampling_unit.reading_text:_left_out", "sampling_unit.reading_text:_reagents", "sampling_unit.reading_text:_verdict", "str"], "complexity": 7, "decorators": [], "hash": "62ffeb407eaaa7c7", "kind": "function", "lines": 17, "module": "sampling_unit.reading_text", "name": "_reading", "public": false, "signature": "(contrast: Any, condition: Any, row: pd.Series, cells: pd.DataFrame, word: str, words: tuple[str, str]) -> dict[str, Any]", "summary": "One condition's reading: its verdict, direction and sentence.", "varargs": []}
{"arguments": 4, "called_by": ["sampling_unit.reading_text:_reading"], "calls": ["?.join", "_wording:change", "pandas.isna", "sampling_unit.reading_text:change_words"], "complexity": 3, "decorators": [], "hash": "b70230006449322b", "kind": "function", "lines": 9, "module": "sampling_unit.reading_text", "name": "_effect_words", "public": false, "signature": "(contrast: Any, condition: Any, row: pd.Series, n: int) -> str", "summary": "Cohen's d (of the one repeat, else the mean per repeat) and the change, as far as", "varargs": []}
-{"arguments": 5, "called_by": ["sampling_unit.reading_text:_reading"], "calls": ["?.append", "?.get", "int", "pandas.notna", "sampling_unit.reading_text:_paired", "sampling_unit.reading_text:limited_words"], "complexity": 10, "decorators": [], "hash": "20c155c511643e71", "kind": "function", "lines": 17, "module": "sampling_unit.reading_text", "name": "_verdict", "public": false, "signature": "(row: pd.Series, n: int, direction: str, effect: str, word: str) -> tuple[str, list[str]]", "summary": "The verdict and the reading's first parts: the direction over the repeats, the paired", "varargs": []}
+{"arguments": 5, "called_by": ["sampling_unit.reading_text:_reading"], "calls": ["?.append", "?.get", "int", "pandas.isna", "pandas.notna", "sampling_unit.reading_text:_paired", "sampling_unit.reading_text:limited_words"], "complexity": 12, "decorators": [], "hash": "8c86cdb9e46ab73e", "kind": "function", "lines": 19, "module": "sampling_unit.reading_text", "name": "_verdict", "public": false, "signature": "(row: pd.Series, n: int, direction: str, effect: str, word: str) -> tuple[str, list[str]]", "summary": "The verdict and the reading's first parts: the direction over the repeats, the paired", "varargs": []}
{"arguments": 2, "called_by": ["sampling_unit.reading_text:shared_control_line"], "calls": ["?.assign", "?.astype", "?.fillna", "?.groupby", "?.setdefault", "getattr", "len", "numpy.where", "sampling_unit.reading_text:condition_readings", "str"], "complexity": 5, "decorators": [], "hash": "911c02796712effd", "kind": "function", "lines": 15, "module": "sampling_unit.reading_text", "name": "_together", "public": false, "signature": "(contrast: Any, discovery: Any) -> dict[Any, dict[str, list[str]]]", "summary": "Per control: the features (``\"\"`` for the readout alone) on which two or more", "varargs": []}
{"arguments": 2, "called_by": ["retrospective.report_answers:conditions_sections"], "calls": ["?.agg", "?.append", "?.groupby", "?.items", "?.join", "_wording:count", "_wording:listing", "getattr", "int", "len", "list", "sampling_unit.reading_text:_together"], "complexity": 11, "decorators": [], "hash": "da32a82019540814", "kind": "function", "lines": 21, "module": "sampling_unit.reading_text", "name": "shared_control_line", "public": true, "signature": "(contrast: Any, discovery: Any=None) -> str | None", "summary": "One line when two or more conditions are significant the same way against a control", "varargs": []}
{"arguments": 2, "called_by": ["sampling_unit.contrast_text:_full", "sampling_unit.contrast_text:contrast_parts", "workflows.html_report:_conditions_card"], "calls": ["?.any", "?.append", "?.get", "?.join", "?.max", "?.values", "_observation_units:observation_words", "_style:wrap", "_wording:column_word", "_wording:listing", "bool", "int", "len", "map", "sampling_unit._experiments:family_words", "sampling_unit._experiments:not_compared", "sampling_unit.across_text:own_gap_lines", "sampling_unit.reading_text:_design", "sampling_unit.reading_text:_direction_rows", "sampling_unit.reading_text:condition_readings", "sampling_unit.reading_text:unpaired_conditions", "set", "sorted", "str"], "complexity": 14, "decorators": [], "hash": "3256608140ae4bf9", "kind": "function", "lines": 56, "module": "sampling_unit.reading_text", "name": "readings_parts", "public": true, "signature": "(contrast: Any, indent: int=2) -> list[str]", "summary": "The readings under a one-line heading, then the conditions never compared (empty", "varargs": []}
@@ -2928,7 +2929,7 @@
{"calls": [], "kind": "module", "module": "workflows._html_across", "name": "", "public": false, "summary": "The table across repeats on the HTML page (private; ``_html_tests``, ``html_report``): one"}
{"arguments": 3, "called_by": ["workflows._html_across:_across", "workflows._html_tests:_beyond", "workflows._html_tests:_cells", "workflows._html_tests:_other_versions"], "calls": ["?.join", "html.escape", "len", "str"], "complexity": 2, "decorators": [], "hash": "d257ec5a41e05b61", "kind": "function", "lines": 14, "module": "workflows._html_across", "name": "_table", "public": false, "signature": "(columns: Sequence[str], rows: Sequence[Sequence[str]], name: str) -> str", "summary": "A sortable table, its first ``FIRST_ROWS`` rows and a button above that.", "varargs": []}
{"arguments": 3, "called_by": ["workflows._html_across:_across", "workflows._html_tests:_beyond"], "calls": [], "complexity": 4, "decorators": [], "hash": "8b425c713b79300e", "kind": "function", "lines": 7, "module": "workflows._html_across", "name": "_direction", "public": false, "signature": "(lower: int, higher: int, n: int) -> str", "summary": "", "varargs": []}
-{"arguments": 6, "called_by": ["workflows._html_across:across_frame"], "calls": ["pandas.notna"], "complexity": 9, "decorators": [], "hash": "eb066ba898b8a758", "kind": "function", "lines": 10, "module": "workflows._html_across", "name": "_verdict", "public": false, "signature": "(q: float, lower: int, higher: int, n: int, confirmed: bool | None=None, one: str='cell') -> str", "summary": "The verdict in the reading's words (``reading_text.VERDICTS``): a direction that", "varargs": []}
+{"arguments": 6, "called_by": ["workflows._html_across:across_frame"], "calls": ["pandas.isna", "pandas.notna", "sampling_unit.contrast_repeats:untested_reason"], "complexity": 10, "decorators": [], "hash": "23ab94236898a57c", "kind": "function", "lines": 12, "module": "workflows._html_across", "name": "_verdict", "public": false, "signature": "(q: float, lower: int, higher: int, n: int, confirmed: bool | None=None, one: str='cell') -> str", "summary": "The verdict in the reading's words (``reading_text.VERDICTS``): a direction that", "varargs": []}
{"arguments": 2, "called_by": ["workflows._html_across:_tests_frame", "workflows._html_tests:_discovery_frame"], "calls": ["?.assign", "?.drop", "?.fillna", "?.fromkeys", "?.map", "?.sort_values", "enumerate", "len"], "complexity": 2, "decorators": [], "hash": "b377f1020d6621a5", "kind": "function", "lines": 6, "module": "workflows._html_across", "name": "_order", "public": false, "signature": "(tests: pd.DataFrame, discovery: Any) -> pd.DataFrame", "summary": "Best-ranked features first, then the conditions in their order.", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_across:_across", "workflows._html_tests:figure_legends"], "calls": ["?.get", "?.itertuples", "getattr", "len", "pandas.DataFrame", "workflows._html_across:_repeats_frame", "workflows._html_across:_tests_frame", "workflows._html_across:_verdict"], "complexity": 5, "decorators": [], "hash": "612286abe4614420", "kind": "function", "lines": 13, "module": "workflows._html_across", "name": "across_frame", "public": true, "signature": "(result: Any) -> pd.DataFrame", "summary": "The table across repeats, one row per feature and condition (the readout's", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_across:across_frame"], "calls": ["?.astype", "?.fillna", "?.get", "pandas.DataFrame", "workflows._html_across:_order"], "complexity": 2, "decorators": [], "hash": "5d8bcd36f0d1731b", "kind": "function", "lines": 28, "module": "workflows._html_across", "name": "_tests_frame", "public": false, "signature": "(discovery: Any) -> pd.DataFrame", "summary": "The table's rows from the feature discovery: every feature and condition.", "varargs": []}
@@ -3103,7 +3104,7 @@
{"arguments": 4, "called_by": ["workflows._html_plan:plan_card"], "calls": ["workflows._html_next:_mean_tolerances", "workflows._html_next:_optimise_code", "workflows._html_plan:_panel", "workflows._html_plan:_tolerances"], "complexity": 2, "decorators": [], "hash": "3eec9413ff280692", "kind": "function", "lines": 18, "module": "workflows._html_plan", "name": "_mean_goal", "public": false, "signature": "(result: Any, feature: str, counts: list[int], extra: str) -> tuple[str, str]", "summary": "", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan:_difference_goal"], "calls": ["?.get", "getattr", "workflows._html_plan:_features"], "complexity": 4, "decorators": [], "hash": "203d7fc47fd62bd2", "kind": "function", "lines": 6, "module": "workflows._html_plan", "name": "_plans", "public": false, "signature": "(result: Any) -> list[tuple[str, Any]]", "summary": "Each feature's repeat plan, in the order of ``_features``.", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan:_done"], "calls": ["_identity:identity_key", "set", "workflows._html_plan:_confirmed", "zip"], "complexity": 2, "decorators": [], "hash": "4a5d010345e0731c", "kind": "function", "lines": 5, "module": "workflows._html_plan", "name": "_confirmed_pairs", "public": false, "signature": "(result: Any) -> set[tuple[IdentityKey, IdentityKey]]", "summary": "The (feature, condition) pairs significant across repeats.", "varargs": []}
-{"arguments": 1, "called_by": ["workflows._html_plan:plan_card"], "calls": ["?.fromkeys", "?.strip", "_wording:listing", "_wording:rate", "html.escape", "len", "list", "workflows._html_next:_repeats_line", "workflows._html_next:pilot_conditions", "workflows._html_plan:_done", "workflows._html_plan:_panel", "workflows._html_plan:_plans", "workflows._html_plan_repeats:_plan_rows", "workflows._html_plan_repeats:_plan_table", "workflows._html_plan_repeats:_repeat_conditions"], "complexity": 12, "decorators": [], "hash": "3e100283d282637a", "kind": "function", "lines": 34, "module": "workflows._html_plan", "name": "_difference_goal", "public": false, "signature": "(result: Any) -> tuple[str, str] | None", "summary": "The repeats each condition not yet significant across repeats would need, per", "varargs": []}
+{"arguments": 1, "called_by": ["workflows._html_plan:plan_card"], "calls": ["?.fromkeys", "?.startswith", "?.strip", "_wording:listing", "_wording:rate", "any", "html.escape", "len", "list", "workflows._html_next:_repeats_line", "workflows._html_next:pilot_conditions", "workflows._html_plan:_done", "workflows._html_plan:_panel", "workflows._html_plan:_plans", "workflows._html_plan_repeats:_plan_rows", "workflows._html_plan_repeats:_plan_table", "workflows._html_plan_repeats:_repeat_conditions"], "complexity": 13, "decorators": [], "hash": "ae942df316d3538d", "kind": "function", "lines": 36, "module": "workflows._html_plan", "name": "_difference_goal", "public": false, "signature": "(result: Any) -> tuple[str, str] | None", "summary": "The repeats each condition not yet significant across repeats would need, per", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan:_difference_goal"], "calls": ["?.get", "_identity:identity_key", "len", "sampling_unit.reading_text:condition_readings", "workflows._html_plan:_confirmed_pairs"], "complexity": 4, "decorators": [], "hash": "013c76a9c9b13d16", "kind": "function", "lines": 8, "module": "workflows._html_plan", "name": "_done", "public": false, "signature": "(result: Any) -> set[tuple[IdentityKey, IdentityKey]]", "summary": "The (feature, condition) pairs significant across repeats; without a feature", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan:_group_goals"], "calls": ["?.get", "getattr", "str", "workflows._html_next:_chosen_population", "workflows._html_next:_labelled"], "complexity": 6, "decorators": [], "hash": "d38cb80cc6ba778a", "kind": "function", "lines": 7, "module": "workflows._html_plan", "name": "_group", "public": false, "signature": "(result: Any) -> Any | None", "summary": "The group of \"Are there populations or groups of cells?\" to plan for, with a rule", "varargs": []}
{"arguments": 4, "called_by": ["workflows._html_plan:_group_goals", "workflows._html_plan:_live_rare"], "calls": ["round"], "complexity": 2, "decorators": [], "hash": "6cc8d332dbc23f76", "kind": "function", "lines": 6, "module": "workflows._html_plan", "name": "_target_code", "public": false, "signature": "(name: str, incidence: float, prevalence: float | None, phenotype: str) -> str", "summary": "", "varargs": []}
@@ -3116,7 +3117,8 @@
{"calls": [], "kind": "module", "module": "workflows._html_plan_repeats", "name": "", "public": false, "summary": "A difference from the control in \"Plan the next experiment\" (private; ``_html_plan``): the"}
{"arguments": 1, "called_by": ["workflows._html_plan_repeats:_plan_rows"], "calls": ["float", "int", "numpy.isfinite", "pandas.isna", "str"], "complexity": 3, "decorators": [], "hash": "f646e4111c45d215", "kind": "function", "lines": 3, "module": "workflows._html_plan_repeats", "name": "_plan_words", "public": false, "signature": "(value: Any) -> str", "summary": "", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan:_difference_goal"], "calls": ["_identity:identity_key"], "complexity": 2, "decorators": [], "hash": "ad5f5533ef5784f7", "kind": "function", "lines": 2, "module": "workflows._html_plan_repeats", "name": "_repeat_conditions", "public": false, "signature": "(discovery: Any) -> set[IdentityKey]", "summary": "", "varargs": []}
-{"arguments": 3, "called_by": ["workflows._html_plan:_difference_goal"], "calls": ["?.append", "?.iterrows", "_identity:identity_key", "getattr", "pandas.isna", "sampling_unit.repeat_plan_text:field_words", "str", "workflows._html_plan_repeats:_moved", "workflows._html_plan_repeats:_plan_words"], "complexity": 8, "decorators": [], "hash": "e1c90ec8d2b5082d", "kind": "function", "lines": 26, "module": "workflows._html_plan_repeats", "name": "_plan_rows", "public": false, "signature": "(plans: list[tuple[str, Any]], pilots: set[IdentityKey], done: set[tuple[IdentityKey, IdentityKey]]) -> tuple[list[PlanRow], list[str]]", "summary": "One row per feature and condition with a plan, the pilots and the pairs ``done``", "varargs": []}
+{"arguments": 3, "called_by": ["workflows._html_plan:_difference_goal"], "calls": ["?.append", "?.iterrows", "_identity:identity_key", "getattr", "pandas.isna", "sampling_unit.repeat_plan_text:field_words", "str", "workflows._html_plan_repeats:_moved", "workflows._html_plan_repeats:_plan_words", "workflows._html_plan_repeats:_unplanned"], "complexity": 9, "decorators": [], "hash": "8bbe3e9b0841106c", "kind": "function", "lines": 25, "module": "workflows._html_plan_repeats", "name": "_plan_rows", "public": false, "signature": "(plans: list[tuple[str, Any]], pilots: set[IdentityKey], done: set[tuple[IdentityKey, IdentityKey]]) -> tuple[list[PlanRow], list[str]]", "summary": "One row per feature and condition with a plan, the pilots and the pairs ``done``", "varargs": []}
+{"arguments": 1, "called_by": ["workflows._html_plan_repeats:_plan_rows"], "calls": ["?.get", "isinstance"], "complexity": 5, "decorators": [], "hash": "0d822868e76eb43b", "kind": "function", "lines": 3, "module": "workflows._html_plan_repeats", "name": "_unplanned", "public": false, "signature": "(row: pd.Series) -> str", "summary": "``not assessable: ``: why a plan gives no repeats needed (a zero or", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan_repeats:_plan_rows"], "calls": ["_wording:change", "float", "pandas.notna", "str"], "complexity": 4, "decorators": [], "hash": "67a9c9d28bc48294", "kind": "function", "lines": 6, "module": "workflows._html_plan_repeats", "name": "_moved", "public": false, "signature": "(row: pd.Series) -> str", "summary": "The change seen that the plan is made on, normalised for a log ratio; \"–\" without.", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_plan:_difference_goal"], "calls": ["?.join", "html.escape"], "complexity": 1, "decorators": [], "hash": "0635df1ab3d773d2", "kind": "function", "lines": 12, "module": "workflows._html_plan_repeats", "name": "_plan_table", "public": false, "signature": "(rows: list[PlanRow]) -> str", "summary": "The rows as the page's sortable table.", "varargs": []}
{"calls": ["?.with_name", "pathlib.Path"], "kind": "module", "module": "workflows._html_plotly", "name": "", "public": false, "summary": "The HTML report's interactive feature figures (private; ``html_report``), drawn by"}
@@ -3127,7 +3129,7 @@
{"arguments": 4, "called_by": ["workflows._html_plotly:_pairwise"], "calls": ["workflows._html_plotly:_d_cell", "workflows._html_plotly:_q_cell"], "complexity": 4, "decorators": [], "hash": "a1cf68213a246c5c", "kind": "function", "lines": 6, "module": "workflows._html_plotly", "name": "_pair_cell", "public": false, "signature": "(pair: Any, row: Any, column: Any, lower: bool) -> _Cell", "summary": "The cell of ``row`` and ``column`` in panel B: d in the ``lower`` triangle, the", "varargs": []}
{"arguments": 3, "called_by": ["workflows._html_plotly:_pair_cell"], "calls": ["workflows._html_plotly:_number"], "complexity": 7, "decorators": [], "hash": "b18ab5f6298827b9", "kind": "function", "lines": 13, "module": "workflows._html_plotly", "name": "_d_cell", "public": false, "signature": "(pair: Any, row: Any, column: Any) -> _Cell", "summary": "A lower-left cell: Cohen's d of ``row`` minus ``column``.", "varargs": []}
{"arguments": 3, "called_by": ["workflows._html_plotly:_pair_cell"], "calls": ["float", "numpy.isfinite", "plots_pairwise:format_p", "plots_pairwise:p_shade", "round"], "complexity": 7, "decorators": [], "hash": "555fd7d8f93c0157", "kind": "function", "lines": 18, "module": "workflows._html_plotly", "name": "_q_cell", "public": false, "signature": "(pair: Any, row: Any, column: Any) -> _Cell", "summary": "An upper-right cell: the randomization test's corrected p, the paired t-test's p in", "varargs": []}
-{"arguments": 2, "called_by": ["workflows._html_plotly:_pairwise"], "calls": ["?.get", "enumerate", "float", "len", "numpy.isfinite", "plots_pairwise:format_p", "plots_pairwise:p_shade", "range", "round"], "complexity": 13, "decorators": [], "hash": "31e42adcc4043372", "kind": "function", "lines": 30, "module": "workflows._html_plotly", "name": "_paired_panel", "public": false, "signature": "(lookup: dict, names: list[Any]) -> dict[str, Any]", "summary": "Panel C: the paired t-test on the repeats' means, uncorrected p in the lower-left", "varargs": []}
+{"arguments": 2, "called_by": ["workflows._html_plotly:_pairwise"], "calls": ["?.get", "enumerate", "float", "len", "numpy.isfinite", "plots_pairwise:format_p", "plots_pairwise:p_shade", "plots_pairwise:unpaired_words", "range", "round"], "complexity": 11, "decorators": [], "hash": "104ab76f90c92758", "kind": "function", "lines": 28, "module": "workflows._html_plotly", "name": "_paired_panel", "public": false, "signature": "(lookup: dict, names: list[Any]) -> dict[str, Any]", "summary": "Panel C: the paired t-test on the repeats' means, uncorrected p in the lower-left", "varargs": []}
{"arguments": 3, "called_by": ["workflows._html_plotly:feature_specs"], "calls": ["?.all", "?.append", "?.choice", "?.fromkeys", "?.isna", "?.itertuples", "?.join", "?.uniform", "enumerate", "float", "getattr", "len", "max", "min", "numpy.random.default_rng", "numpy.sort", "pandas.notna", "round", "str", "workflows._html_plotly:_number"], "complexity": 9, "decorators": [], "hash": "8f319c7aaabbac73", "kind": "function", "lines": 33, "module": "workflows._html_plotly", "name": "_points", "public": false, "signature": "(frame: pd.DataFrame, summaries: pd.DataFrame, seed: int) -> dict[str, Any]", "summary": "The observations of the figure's clusters, jittered within each, at most", "varargs": []}
{"arguments": 1, "called_by": ["workflows._html_figures:_legend", "workflows._html_plotly:feature_specs"], "calls": ["?.join", "?.split", "?.strip", "?.upper", "getattr", "len"], "complexity": 2, "decorators": [], "hash": "d6271e41337681c9", "kind": "function", "lines": 5, "module": "workflows._html_plotly", "name": "interactive_caption", "public": true, "signature": "(figure: Any) -> str", "summary": "The static figure's title in sentences, and what hovering a point gives.", "varargs": []}
{"arguments": 6, "called_by": ["workflows._html_figures:_specs"], "calls": ["?.agg", "?.append", "?.fromkeys", "?.get", "?.get_ylabel", "?.groupby", "?.index", "?.items", "?.itertuples", "?.mean", "enumerate", "float", "getattr", "list", "pandas.isna", "round", "str", "workflows._html_plotly:_number", "workflows._html_plotly:_observations", "workflows._html_plotly:_pairwise", "workflows._html_plotly:_points", "workflows._html_plotly:interactive_caption"], "complexity": 8, "decorators": [], "hash": "09fabae26acc5c5d", "kind": "function", "lines": 45, "module": "workflows._html_plotly", "name": "feature_specs", "public": true, "signature": "(drawn: dict[str, list[Any]], prepared: pd.DataFrame, fovs: pd.DataFrame, setup: Any, colours: dict[Any, str], names: dict[str, str]) -> list[dict[str, Any]]", "summary": "One spec per static figure (see the module); ``names`` are the figures' file names,", "varargs": []}
@@ -3276,7 +3278,8 @@
{"arguments": 1, "called_by": ["workflows._pairing:paired_inputs"], "calls": ["dataclasses.replace"], "complexity": 1, "decorators": [], "hash": "4a058af2f1bd9c1f", "kind": "function", "lines": 11, "module": "workflows._pairing", "name": "unpaired_setup", "public": true, "signature": "(setup: Setup) -> Setup", "summary": "The Setup without what pairs repeats: its control, contrasts, normalisation and", "varargs": []}
{"arguments": 1, "called_by": ["workflows._pairing:pairing_said"], "calls": ["?.fromkeys"], "complexity": 1, "decorators": [], "hash": "374bf14a993537a5", "kind": "function", "lines": 2, "module": "workflows._pairing", "name": "refusal_reasons", "public": true, "signature": "(refused: PairingRefused) -> dict[str, str]", "summary": "The reason each paired section of the report gives: not compared, and why.", "varargs": []}
{"arguments": 4, "called_by": ["workflows.retrospective:report"], "calls": ["?.items", "?.update", "_repeat_groups:pairing_note", "workflows._pairing:refusal_reasons"], "complexity": 3, "decorators": [], "hash": "d140df333bd5158e", "kind": "function", "lines": 11, "module": "workflows._pairing", "name": "pairing_said", "public": true, "signature": "(paired: Paired, declared: Setup, settings: dict[str, Any], reasons: dict[str, str]) -> Setup", "summary": "What the report records of the pairing: the folders paired under another name in", "varargs": []}
-{"arguments": 2, "called_by": ["workflows.retrospective:report"], "calls": ["?.folder_of", "?.get", "_repeat_groups:with_folders", "dataclasses.replace"], "complexity": 4, "decorators": [], "hash": "77510000b966ea99", "kind": "function", "lines": 15, "module": "workflows._pairing", "name": "with_folder_labels", "public": true, "signature": "(results: MutableMapping[str, Any], pairing: Pairing) -> None", "summary": "Name each folder beside its IDs in the report's results, when the pairing renamed any", "varargs": []}
+{"arguments": 2, "called_by": ["workflows.retrospective:report"], "calls": ["?.folder_of", "?.get", "_repeat_groups:with_folders", "dataclasses.replace", "workflows._pairing:_anomaly_folders"], "complexity": 6, "decorators": [], "hash": "db1dc9e70b8453ba", "kind": "function", "lines": 18, "module": "workflows._pairing", "name": "with_folder_labels", "public": true, "signature": "(results: MutableMapping[str, Any], pairing: Pairing) -> None", "summary": "Name each folder beside its IDs in the report's results, when the pairing renamed any", "varargs": []}
+{"arguments": 2, "called_by": ["workflows._pairing:with_folder_labels"], "calls": ["?.copy", "?.folder_of", "len", "zip"], "complexity": 4, "decorators": [], "hash": "c18d79aa7ed7475e", "kind": "function", "lines": 14, "module": "workflows._pairing", "name": "_anomaly_folders", "public": false, "signature": "(anomalies: Any, pairing: Pairing) -> pd.DataFrame", "summary": "The acquisition anomalies' rows, each with its condition and repeat's folders where the", "varargs": []}
{"arguments": 1, "called_by": ["workflows._pairing:paired_inputs"], "calls": ["?.append", "?.items", "isinstance"], "complexity": 6, "decorators": [], "hash": "7c6452c32ae55a00", "kind": "function", "lines": 9, "module": "workflows._pairing", "name": "_frames", "public": false, "signature": "(feature_tables: Mapping[str, Any] | None) -> tuple[list[str], list[pd.DataFrame]]", "summary": "The feature tables' names and frames (a table given with its tag gives its frame).", "varargs": []}
{"arguments": 3, "called_by": ["workflows._pairing:paired_inputs"], "calls": ["?.items", "dict", "isinstance", "zip"], "complexity": 6, "decorators": [], "hash": "575b97620e118b11", "kind": "function", "lines": 12, "module": "workflows._pairing", "name": "_rebuilt", "public": false, "signature": "(feature_tables: Mapping[str, Any] | None, names: list[str], frames: list[pd.DataFrame]) -> Mapping[str, Any] | None", "summary": "``feature_tables`` with each frame replaced by its paired copy, tags kept.", "varargs": []}
{"calls": [], "kind": "module", "module": "workflows._population_context", "name": "", "public": false, "summary": "What question 10's groups are, read against the conditions (private; ``_populations``,"}
diff --git a/docs/common/glossary.md b/docs/common/glossary.md
index d04adf2a..04f26f94 100644
--- a/docs/common/glossary.md
+++ b/docs/common/glossary.md
@@ -101,7 +101,7 @@ Every test, rule and term the report uses, in plain words, with where it appears
*Where:* Do the conditions differ?.
*See:* [Benjamini Y, Hochberg Y. Controlling the false discovery rate: a practical and powerful approach to multiple testing. J R Stat Soc B. 1995;57(1):289-300.](https://doi.org/10.1111/j.2517-6161.1995.tb02031.x)
-**Candidate and significant across repeats.** A feature is a candidate when its exploratory cell-level screen has q ≤ 0.05 for a condition; it is significant across repeats when the paired t-test on the repeat means gives q ≤ 0.05 for that condition too (with n repeats: n is said beside it). The first finds candidates; the second says the mean difference holds across the repeats. 'Same direction in every repeat, not significant', said from 6 repeats, is a consistent trend, not evidence of no effect; with fewer, every repeat goes the same way by chance too often (1 experiment in 4 with 3 repeats), so it reads 'not significant across repeats' (owner, 2026-10-06).
+**Candidate and significant across repeats.** A feature is a candidate when its exploratory cell-level screen has q ≤ 0.05 for a condition; it is significant across repeats when the paired t-test on the repeat means gives q ≤ 0.05 for that condition too (with n repeats: n is said beside it). The first finds candidates; the second says the mean difference holds across the repeats. 'Same direction in every repeat, not significant', said from 6 repeats, is a consistent trend, not evidence of no effect; with fewer, every repeat goes the same way by chance too often (1 experiment in 4 with 3 repeats), so it reads 'not significant across repeats' (owner, 2026-10-06). With 3 or more repeats that all give the same change the paired test has no variance to test with and gives no p: that reads 'not assessed across repeats', with the reason, never 'not significant' (#90).
*Where:* Do the conditions differ?, the feature ranking.
diff --git a/docs/report/figures.md b/docs/report/figures.md
index 620e5529..23ac0fd2 100644
--- a/docs/report/figures.md
+++ b/docs/report/figures.md
@@ -37,7 +37,9 @@ at 0.05). It treats every observation as an independent draw, so when the
repeats differ it passes more often than 5% without an effect; the table keeps
the paired t-test on the repeats' means beside it, drawn as panel C (`p_paired`
below the diagonal, uncorrected, and `q_paired`, Benjamini-Hochberg over the pairs
-tested, above; with 3 repeats that imaged both). Panel C's q is adjusted over the figure
+tested, above; with 3 repeats that imaged both: "–" with fewer, "=" not assessed when the
+difference is the same in every repeat imaged both, so the test has no variance to test with,
+never read as not significant, #90). Panel C's q is adjusted over the figure
only, so its key says "adjusted over this figure only", and the legend gives each
condition's verdict q beside it, the feature family's ("Verdict q (the feature's family):
KD 0.074"; `figure.pairwise_verdicts`), since the two can fall either side of 0.05 (audit 10,
diff --git a/src/morphocoverage/_wording.py b/src/morphocoverage/_wording.py
index 43d33f62..554e104b 100644
--- a/src/morphocoverage/_wording.py
+++ b/src/morphocoverage/_wording.py
@@ -7,6 +7,7 @@
from __future__ import annotations
import math
+import sys
from collections.abc import Mapping, Sequence
from typing import Any
@@ -25,7 +26,8 @@ def percent(value: float) -> str:
Whole percentages round half up (12.5% reads ``13%``). A share that is not
0 or 1 never reads ``0%`` or ``100%``: below 1% and above 99% it keeps the
- digits that tell it apart (1 in 5000 is ``0.02%``, 199 in 200 ``99.5%``).
+ digits that tell it apart (1 in 5000 is ``0.02%``, 199 in 200 ``99.5%``),
+ however close to 1 (1 - 1e-12 reads ``99.9999999999%``).
"""
value = float(value)
if math.isnan(value):
@@ -35,10 +37,17 @@ def percent(value: float) -> str:
share = 100 * value
if 0 < share < 1:
return f"{share:.1g}%"
- if 99 < share < 100:
- missing = round(100 - share, 9) # 99.9 must not read 99.90 from rounding error
+ if share > 99 and value < 1:
+ # The gap to 1 (exact this close to 1) to the digits a float holds of it, at most 9
+ # (its error is the spacing of floats at 1): 99.9 must not read 99.90, nor
+ # 1 - 1e-12 read 99.99999999990, from rounding error; never rounded to 0 (#555).
+ gap = 1 - value
+ held = min(9, max(1, math.floor(math.log10(gap / sys.float_info.epsilon))))
+ missing = float(f"{100 * gap:.{held}g}")
digits = max(1, -math.floor(math.log10(missing)))
- return f"{share:.{digits}f}%"
+ text = f"{share:.{digits}f}"
+ # A share below 1 never reads 100%, should its digits round up (#555).
+ return f"{text}%" if float(text) < 100 else "<100%"
return f"{math.floor(share + 0.5):.0f}%"
diff --git a/src/morphocoverage/glossary.py b/src/morphocoverage/glossary.py
index 654d4d0d..169ba14d 100644
--- a/src/morphocoverage/glossary.py
+++ b/src/morphocoverage/glossary.py
@@ -251,7 +251,10 @@ class Term:
"repeats. 'Same direction in every repeat, not significant', said from 6 repeats, is a "
"consistent trend, not evidence of no effect; with fewer, every repeat goes the same "
"way by chance too often (1 experiment in 4 with 3 repeats), so it reads 'not "
- "significant across repeats' (owner, 2026-10-06).",
+ "significant across repeats' (owner, 2026-10-06). With 3 or more repeats that all "
+ "give the same change the paired test has no variance to test with and gives no p: "
+ "that reads 'not assessed across repeats', with the reason, never 'not significant' "
+ "(#90).",
"Do the conditions differ?, the feature ranking",
),
Term(
diff --git a/src/morphocoverage/plots_embedding.py b/src/morphocoverage/plots_embedding.py
index 69cb50e3..d8cf6a07 100644
--- a/src/morphocoverage/plots_embedding.py
+++ b/src/morphocoverage/plots_embedding.py
@@ -89,15 +89,20 @@ def _scatter(ax: Axes, points: pd.DataFrame, x: str, y: str, colours: dict[Any,
def _spread_labels(
positions: list[tuple[float, float]], x_span: float, y_span: float
) -> list[tuple[float, float]]:
- """Label positions with labels that fall on one another moved apart vertically: arrows of
- duplicated or collinear features end at nearly one point (audit A7)."""
+ """Label positions, in the order of ``positions``, with labels that fall on one another
+ moved apart vertically: arrows of duplicated or collinear features end at nearly one point
+ (audit A7). Placed from the lowest up, then returned in the given order, so each label
+ stays its own arrow's (#557)."""
gap = 0.05 * y_span
placed: list[tuple[float, float]] = []
- for x, y in sorted(positions, key=lambda p: p[1]):
+ spots: list[tuple[float, float]] = list(positions)
+ for i in sorted(range(len(positions)), key=lambda i: positions[i][1]):
+ x, y = positions[i]
while any(abs(y - py) < gap and abs(x - px) < 0.3 * x_span for px, py in placed):
y += gap
placed.append((x, y))
- return placed
+ spots[i] = (x, y)
+ return spots
def _arrows(ax: Axes, embedding: Embedding) -> None:
diff --git a/src/morphocoverage/plots_pairwise.py b/src/morphocoverage/plots_pairwise.py
index c133839d..56776ad3 100644
--- a/src/morphocoverage/plots_pairwise.py
+++ b/src/morphocoverage/plots_pairwise.py
@@ -114,8 +114,28 @@
"right: adjusted over the pairs of this figure only (Benjamini-Hochberg); the verdict's "
"q is adjusted over every feature and condition of its sub-experiment, so the two can "
"fall either side of 0.05. Green at ≤ 0.05, darker the smaller; – : fewer than 3 "
- "repeats imaged both."
+ "repeats imaged both; =: not assessed, the difference is the same in every repeat imaged "
+ "both, so the paired test has no variance to test with (not a result of no difference)."
)
+# Panel C's mark for a pair with enough shared repeats but no paired p (#90).
+SAME_MARK = "="
+
+
+def unpaired_words(pair: Any) -> tuple[str, str]:
+ """Panel C's mark and words for a pair with no paired p (#90): ``APART_MARK`` normalised to
+ different controls, ``–`` fewer than ``MIN_REPEATS`` repeats imaged both, ``SAME_MARK``
+ enough, with the same difference in each (NaN is dropped and a log ratio needs every value
+ positive, so nothing else leaves ``paired_t`` without a p): not assessed, never read as
+ not significant."""
+ shared = int(pair.shared_repeats)
+ if pair.status == APART:
+ return APART_MARK, f"normalised to different controls, {APART}"
+ if shared < MIN_REPEATS:
+ return "–", f"not tested ({shared} repeats imaged both, fewer than {MIN_REPEATS})"
+ return SAME_MARK, (
+ f"not assessed (the difference is the same in all {shared} repeats imaged both, so "
+ "the paired test has no variance to test with)"
+ )
def verdict_note(verdicts: Mapping[Any, float]) -> str:
@@ -385,7 +405,12 @@ def _matrix(
if panel == "B":
cell = _cells_d(pair, row) if i > j else _cells_p(float(pair.q))
else:
- cell = _cells_p(float(pair.p_paired if i > j else pair.q_paired))
+ value = float(pair.p_paired if i > j else pair.q_paired)
+ cell = (
+ _cells_p(value)
+ if np.isfinite(value)
+ else (unpaired_words(pair)[0], p_colour(np.nan), "normal")
+ )
text, colour, weight = cell
ax.add_patch(_square(j, i, colour))
ax.text(
@@ -494,11 +519,13 @@ def _square(x: float, y: float, colour: tuple[float, float, float]) -> FancyBbox
"PAIR_NOTE",
"PAIR_NOTE_SEVERAL",
"PANEL_KEYS",
+ "SAME_MARK",
"add_pairwise",
"d_colour",
"format_p",
"p_colour",
"p_shade",
"pairwise_contrasts",
+ "unpaired_words",
"verdict_note",
]
diff --git a/src/morphocoverage/sampling_unit/reading_text.py b/src/morphocoverage/sampling_unit/reading_text.py
index 32a18808..f4327305 100644
--- a/src/morphocoverage/sampling_unit/reading_text.py
+++ b/src/morphocoverage/sampling_unit/reading_text.py
@@ -61,6 +61,9 @@
CONSISTENT = "same direction in every repeat, not significant"
NOT_SIGNIFICANT = "not significant across repeats"
NOT_TESTED = "not tested across repeats"
+# Enough repeats, but the paired test gives no p: every repeat's change is the same, so it has
+# no variance to test with (#90). Not assessed, never "not significant".
+NOT_ASSESSED = "not assessed across repeats"
MIXED = "no consistent direction"
ONE_REPEAT = "one repeat"
_VALUES = {
@@ -75,7 +78,7 @@
"verdict gives the change in each repeat and the 95% t interval of the change, which is "
"wide; a change that is not significant is not evidence of no change."
)
-VERDICTS = (CONFIRMED, CONSISTENT, NOT_SIGNIFICANT, NOT_TESTED, MIXED, ONE_REPEAT)
+VERDICTS = (CONFIRMED, CONSISTENT, NOT_SIGNIFICANT, NOT_ASSESSED, NOT_TESTED, MIXED, ONE_REPEAT)
# The status of a contrast whose repeat holds no control field (``condition_contrast``).
NO_CONTROL = "no control group in"
@@ -290,6 +293,8 @@ def _verdict(
parts = [f"lower in {lower} and higher in {higher} of {n} {word}s"]
else:
trend = CONSISTENT if n >= TREND_REPEATS else NOT_SIGNIFICANT
+ unassessed = pd.isna(row["q_paired_t_normalised"]) and pd.isna(row["q_paired_t"])
+ trend = NOT_ASSESSED if unassessed else trend # no p: not a negative result (#90)
verdict = CONFIRMED if confirmed else trend if n >= MIN_REPEATS else NOT_TESTED
parts = [f"{direction} in {n} of {n} {word}s" + (f" ({effect})" if effect else "")]
parts.append(paired)
@@ -535,6 +540,7 @@ def _cells_headline(contrast: Any) -> str:
"FEW_CONTROL_FIELDS",
"LIMITED_REPLICATION",
"MIXED",
+ "NOT_ASSESSED",
"NOT_SIGNIFICANT",
"NOT_TESTED",
"NO_CONTROL",
diff --git a/src/morphocoverage/workflows/_html_across.py b/src/morphocoverage/workflows/_html_across.py
index 250c0097..ebd9c3ba 100644
--- a/src/morphocoverage/workflows/_html_across.py
+++ b/src/morphocoverage/workflows/_html_across.py
@@ -20,13 +20,14 @@
from .._style import low_to_high
from .._wording import change, contrasts_words, p_value
-from ..sampling_unit.contrast_repeats import MIN_REPEATS, TREND_REPEATS
+from ..sampling_unit.contrast_repeats import MIN_REPEATS, TREND_REPEATS, untested_reason
from ..sampling_unit.discovery import declared_scales
from ..sampling_unit.reading_text import (
CONFIRMED,
CONSISTENT,
LIMITED_REPLICATION,
MIXED,
+ NOT_ASSESSED,
NOT_SIGNIFICANT,
)
from ..statistics import ALPHA
@@ -75,11 +76,15 @@ def _verdict(
"""The verdict in the reading's words (``reading_text.VERDICTS``): a direction that
changes between repeats first, then significant across repeats (the discovery's
``confirmed``, which also needs the cell-level screen, when given; else q <= 0.05); the
- screen named for the observations, ``one`` (``patch-level``)."""
+ screen named for the observations, ``one`` (``patch-level``). Enough repeats and no q:
+ not assessed, with the reason (``contrast_repeats.untested_reason``), never "not
+ significant" (#90)."""
if n < MIN_REPEATS:
return f"not tested (needs {MIN_REPEATS} repeats)"
if not (lower == n or higher == n):
return MIXED
+ if pd.isna(q):
+ return f"{NOT_ASSESSED}: {untested_reason(n, np.nan)}"
significant = pd.notna(q) and q <= ALPHA
if confirmed if confirmed is not None else significant:
return CONFIRMED
diff --git a/src/morphocoverage/workflows/_html_plan.py b/src/morphocoverage/workflows/_html_plan.py
index e9ea1598..973e23a5 100644
--- a/src/morphocoverage/workflows/_html_plan.py
+++ b/src/morphocoverage/workflows/_html_plan.py
@@ -45,7 +45,7 @@
rule_code,
rule_labels,
)
-from ._html_plan_repeats import _plan_rows, _plan_table, _repeat_conditions
+from ._html_plan_repeats import NOT_ASSESSABLE, _plan_rows, _plan_table, _repeat_conditions
from ._html_render import text_html
from ._html_tabs import NOTHING_LIVE, choose
from ._populations import rule_words
@@ -257,6 +257,8 @@ def _difference_goal(result: Any) -> tuple[str, str] | None:
f"for {rate(POWER)} power, if the change and the variation seen here recur, each "
f"repeat with its own control.{known}"
)
+ if any(row[3].startswith(NOT_ASSESSABLE) for row in rows): # said, never dropped (#90)
+ sentence += " Not assessable: these data give no plan, for the reason in its row."
return option, _panel(sentence, extra=_plan_table(rows) + pilot)
diff --git a/src/morphocoverage/workflows/_html_plan_repeats.py b/src/morphocoverage/workflows/_html_plan_repeats.py
index 9af4bba5..1f848836 100644
--- a/src/morphocoverage/workflows/_html_plan_repeats.py
+++ b/src/morphocoverage/workflows/_html_plan_repeats.py
@@ -16,6 +16,8 @@
from ..sampling_unit.repeat_plan import MAX_REPEATS
from ..sampling_unit.repeat_plan_text import field_words
+# A plan with no estimable answer, in the table's "repeats needed" (#90).
+NOT_ASSESSABLE = "not assessable"
# A row of the table: feature, condition, change seen, repeats needed, with twice the fields,
# and the fields' word.
PlanRow = tuple[str, str, str, str, str, str]
@@ -38,7 +40,8 @@ def _plan_rows(
done: set[tuple[IdentityKey, IdentityKey]],
) -> tuple[list[PlanRow], list[str]]:
"""One row per feature and condition with a plan, the pilots and the pairs ``done``
- (significant across repeats) left out, and the features of those done, in order."""
+ (significant across repeats) left out, and the features of those done, in order. A plan
+ with no estimable answer stays, said not assessable with its reason (#90)."""
rows: list[PlanRow] = []
shown: list[str] = []
for feature, contrast in plans:
@@ -52,21 +55,28 @@ def _plan_rows(
if (identity_key(feature), identity_key(row["condition"])) in done:
shown.append(feature)
continue
- if pd.isna(row["repeats_needed"]):
- continue
+ unplanned = pd.isna(row["repeats_needed"])
rows.append(
(
feature,
str(row["condition"]),
_moved(row),
- _plan_words(row["repeats_needed"]),
- _plan_words(row["repeats_needed_twice_fields"]),
+ _unplanned(row) if unplanned else _plan_words(row["repeats_needed"]),
+ "–" if unplanned else _plan_words(row["repeats_needed_twice_fields"]),
unit,
)
)
return rows, shown
+def _unplanned(row: pd.Series) -> str:
+ """``not assessable: ``: why a plan gives no repeats needed (a zero or
+ missing variance, ``repeat_plan.DEGENERATE``, ``MISSING_VALUE``), never left out."""
+ status = row.get("status")
+ reason = status if isinstance(status, str) and status and status != "ok" else ""
+ return f"{NOT_ASSESSABLE}: {reason}" if reason else NOT_ASSESSABLE
+
+
def _moved(row: pd.Series) -> str:
"""The change seen that the plan is made on, normalised for a log ratio; "–" without."""
planned = str(row["planned_on"])
diff --git a/src/morphocoverage/workflows/_html_plotly.py b/src/morphocoverage/workflows/_html_plotly.py
index 79d180a8..a660c738 100644
--- a/src/morphocoverage/workflows/_html_plotly.py
+++ b/src/morphocoverage/workflows/_html_plotly.py
@@ -27,8 +27,7 @@
from .._repeat_groups import repeat_level
from ..data_check import validate_input_tables
from ..metadata import CONDITION_COLUMN, REPEAT_COLUMN, TECHNICAL_REPEAT_COLUMN
-from ..plots_pairwise import ALPHA, APART, APART_MARK, D_CAP, format_p, p_shade
-from ..sampling_unit.contrast_repeats import MIN_REPEATS
+from ..plots_pairwise import ALPHA, APART, APART_MARK, D_CAP, format_p, p_shade, unpaired_words
from ..schema import fov_positions
from ._rare_share import plotted_values
@@ -165,10 +164,11 @@ def _paired_panel(lookup: dict, names: list[Any]) -> dict[str, Any]:
value = float(pair.p_paired if i > j else pair.q_paired)
target = lower if i > j else upper
target[i][j] = round(p_shade(value), 3) if np.isfinite(value) else 0.0
- text[i][j] = format_p(value) if np.isfinite(value) else "–"
- if pair.status == APART:
- hover[i][j] = f"{row} and {column}: normalised to different controls, {APART}"
+ if not np.isfinite(value): # why there is no p, never "not significant" (#90)
+ text[i][j], words = unpaired_words(pair)
+ hover[i][j] = f"{row} and {column}: {words}"
continue
+ text[i][j] = format_p(value)
what = (
"p, uncorrected"
if i > j
@@ -177,9 +177,6 @@ def _paired_panel(lookup: dict, names: list[Any]) -> dict[str, Any]:
hover[i][j] = (
f"{row} and {column}: paired t-test on {pair.shared_repeats} repeats' means "
f"({pair.paired_values}), {what} {text[i][j]}"
- if np.isfinite(value)
- else f"{row} and {column}: not tested ({pair.shared_repeats} repeats imaged "
- f"both, fewer than {MIN_REPEATS})"
)
return {"lower": lower, "upper": upper, "text": text, "hover": hover, "lower_scale": "p"}
diff --git a/src/morphocoverage/workflows/_pairing.py b/src/morphocoverage/workflows/_pairing.py
index 11c5f75b..6f380cba 100644
--- a/src/morphocoverage/workflows/_pairing.py
+++ b/src/morphocoverage/workflows/_pairing.py
@@ -36,7 +36,7 @@
pairing_note,
with_folders,
)
-from ..metadata import CONDITION_COLUMN
+from ..metadata import CONDITION_COLUMN, REPEAT_COLUMN
from ._contrasts import declared_conditions as contrast_conditions
from ._described import check_described
from .setup import Setup
@@ -187,13 +187,17 @@ def pairing_said(
def with_folder_labels(results: MutableMapping[str, Any], pairing: Pairing) -> None:
"""Name each folder beside its IDs in the report's results, when the pairing renamed any
(experiment-v1 section 3.4): the per-repeat rows of the condition contrast gain ``folder``
- and ``control_folder``, and the fields to check name their group's folders
+ and ``control_folder``, the acquisition anomalies' rows ``folder`` and the folders in their
+ ``field`` (#628), and the fields to check name their group's folders
(``settings["folders"]``, ``inspection_text.field_group``)."""
if not pairing.folders:
return
contrast = results.get("contrast")
if contrast is not None:
results["contrast"] = replace(contrast, table=with_folders(contrast.table, pairing))
+ anomalies = results.get("acquisition")
+ if anomalies is not None and anomalies.found:
+ results["acquisition"] = replace(anomalies, fields=_anomaly_folders(anomalies, pairing))
inspection = results.get("inspection")
if inspection is not None:
folders = [
@@ -206,6 +210,27 @@ def with_folder_labels(results: MutableMapping[str, Any], pairing: Pairing) -> N
)
+def _anomaly_folders(anomalies: Any, pairing: Pairing) -> pd.DataFrame:
+ """The acquisition anomalies' rows, each with its condition and repeat's folders where the
+ pairing named them by IDs (``Pairing.folder_of``): ``folder`` and, in ``field``, ``"ctrl ·
+ repeat rep1 · img_003 (folder control/rep1)"``; a field whose folders are its IDs as
+ given."""
+ fields = anomalies.fields.copy()
+ if CONDITION_COLUMN not in fields:
+ return fields
+ repeats = fields[REPEAT_COLUMN] if REPEAT_COLUMN in fields else [None] * len(fields)
+ folders = [
+ pairing.folder_of(condition, repeat)
+ for condition, repeat in zip(fields[CONDITION_COLUMN], repeats, strict=True)
+ ]
+ fields["folder"] = folders
+ fields["field"] = [
+ f"{field} (folder {folder})" if folder else field
+ for field, folder in zip(fields["field"], folders, strict=True)
+ ]
+ return fields
+
+
def _frames(
feature_tables: Mapping[str, Any] | None,
) -> tuple[list[str], list[pd.DataFrame]]:
diff --git a/tests/test_html_plan.py b/tests/test_html_plan.py
index f7a33ae5..46dbd99e 100644
--- a/tests/test_html_plan.py
+++ b/tests/test_html_plan.py
@@ -283,7 +283,9 @@ def test_the_incidence_counts_the_fields_without_observations():
assert incidence < _incidence(result, objects, fovs, objects["mitotic"])[0]
-def test_a_condition_without_a_repeat_plan_is_left_out_of_the_table():
+def test_a_condition_without_a_repeat_plan_is_said_not_assessable_in_the_table():
+ # #90: a plan with no estimable answer was dropped silently; it stays, with its reason.
+ from morphocoverage.sampling_unit.repeat_plan import DEGENERATE
from morphocoverage.workflows._html_plan import _difference_goal
discovery = SimpleNamespace(
@@ -304,6 +306,7 @@ def test_a_condition_without_a_repeat_plan_is_left_out_of_the_table():
"repeats_needed_twice_fields": [3.0, np.nan, np.inf],
"planned_on": ["log ratio", "difference", "log ratio"],
"change": [0.2, np.nan, -0.1],
+ "status": ["ok", DEGENERATE, "ok"],
}
)
contrast = SimpleNamespace(plan=plan, table=pd.DataFrame(), settings={})
@@ -319,9 +322,12 @@ def test_a_condition_without_a_repeat_plan_is_left_out_of_the_table():
"from the control is planned in biological repeats. For each condition not yet "
"significant across repeats, the repeats a paired t-test on the repeat means needs for "
"80% power, if the change and the variation seen here recur, each repeat with its own "
- "control. Significant across repeats already: area.
"
+ "control. Significant across repeats already: area. Not assessable: these data give "
+ "no plan, for the reason in its row."
'| feature | '
"condition | change seen | repeats needed | "
"with twice the fields per repeat |
|---|
| area | "
+ f"b | – | not assessable: {html.escape(DEGENERATE)} | – | "
+ "
| area | "
"c | ×-0.10 | 5 | more than 30 |
"
)
diff --git a/tests/test_morphofeature_exports.py b/tests/test_morphofeature_exports.py
index 4bac4d7d..afc47378 100644
--- a/tests/test_morphofeature_exports.py
+++ b/tests/test_morphofeature_exports.py
@@ -437,3 +437,57 @@ def test_v33_the_guided_control_questions_read_the_scan_by_condition_id() -> Non
kept = objects.merge(fovs.loc[one, KEY], on=KEY)
fewer = scan_design(kept, fovs.loc[one], feature_cols=["x"])
assert most_imaged(fewer, ["DrugA", "ctrl"]) == "ctrl"
+
+
+def _far_field(
+ name: str, condition: str, repeat: str, as_ids: bool = False
+) -> tuple[pd.DataFrame, pd.DataFrame]:
+ """The export with ``x`` raised by 100 in the first field of a folder: far from the other
+ fields of its condition and repeat, an acquisition anomaly. ``as_ids``: every folder label
+ made its own ID, so no folder is named under another name."""
+ objects, fovs = with_feature(name)
+ if as_ids:
+ fovs = fovs.assign(condition_id=fovs["condition"], repeat_group=fovs["biological_repeat"])
+ held = (fovs["condition"] == condition) & (fovs["biological_repeat"] == repeat)
+ position = fovs.loc[held, "position_id"].iloc[0]
+ mine = (
+ (objects["condition"] == condition)
+ & (objects["biological_repeat"] == repeat)
+ & (objects["position_id"] == position)
+ )
+ objects.loc[mine, "x"] += 100.0
+ return objects, fovs
+
+
+@pytest.mark.parametrize(
+ ("name", "condition", "repeat", "control", "named"),
+ [
+ ("v33", "control", "rep1", "ctrl", "ctrl · repeat rep1"), # the condition's ID
+ ("v30", "DrugA", "rep1", "CTRL", "DrugA · repeat Day2"), # the folder's repeat group
+ ("v03", "DrugA", "rep2_drug", "CTRL", "DrugA · repeat Day2"),
+ ],
+)
+def test_an_acquisition_anomaly_names_its_folder(name, condition, repeat, control, named, tmp_path):
+ # #628 item 3: the anomaly rows named a field by its IDs only ("ctrl · repeat rep1 ...").
+ # (v27 holds 5 fields a folder, fewer than a group needs to be judged.)
+ objects, fovs = _far_field(name, condition, repeat)
+ setup = Setup(readout="x", features=("x",), control={"condition": control})
+ result = report(objects, fovs, setup)
+ rows = result.results["acquisition"].fields
+ folder = f"{condition}/{repeat}"
+ mine = rows[rows["field"].str.startswith(f"{named} · ")]
+ assert len(mine) and set(mine["folder"]) == {folder}
+ assert mine["field"].str.endswith(f"(folder {folder})").all()
+ # Every row names its own folder, and the report says it.
+ assert all(f"(folder {f})" in t for f, t in zip(rows["folder"], rows["field"], strict=True))
+ assert f"(folder {folder})" in result.summary(detail="full")
+ page = html_report(result, objects, fovs, tmp_path / "page").read_text(encoding="utf-8")
+ assert f"{named} · " in page and f"(folder {folder})" in page # the fields to check
+
+
+def test_an_acquisition_anomaly_of_folders_named_as_given_adds_no_folder():
+ objects, fovs = _far_field("v33", "control", "rep1", as_ids=True)
+ setup = Setup(readout="x", features=("x",), control={"condition": "control"})
+ rows = report(objects, fovs, setup).results["acquisition"].fields
+ assert len(rows) and "folder" not in rows
+ assert not rows["field"].str.contains("(folder", regex=False).any()
diff --git a/tests/test_plots_embedding.py b/tests/test_plots_embedding.py
index 16710f46..6718900f 100644
--- a/tests/test_plots_embedding.py
+++ b/tests/test_plots_embedding.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+import math
from itertools import pairwise
from morphocoverage.plots_embedding import _spread_labels
@@ -14,3 +15,75 @@ def test_labels_of_arrows_ending_together_are_moved_apart():
ys = sorted(y for _, y in near)
assert all(b - a >= 0.05 * 10.0 - 1e-9 for a, b in pairwise(ys))
assert (-5.0, 3.0) in spots # a label elsewhere stays where it was
+
+
+def _embedding(loadings: dict[str, tuple[float, float]]):
+ import numpy as np
+ import pandas as pd
+
+ from morphocoverage.embedding import Embedding
+
+ rng = np.random.default_rng(0)
+ points = pd.DataFrame(
+ {
+ "condition": ["a"] * 30 + ["b"] * 30,
+ "pc1": rng.normal(0, 3, 60),
+ "pc2": rng.normal(0, 3, 60),
+ "umap1": np.nan,
+ "umap2": np.nan,
+ }
+ )
+ frame = pd.DataFrame(
+ [{"feature": f, "pc1": x, "pc2": y, "top": True} for f, (x, y) in loadings.items()]
+ )
+ return Embedding(points, frame, (0.5, 0.3), {"features": list(loadings)})
+
+
+def _labels_and_tips(loadings: dict[str, tuple[float, float]]):
+ """Each drawn label's anchor and each arrow's tip, from the PCA figure itself."""
+ from matplotlib.text import Annotation
+
+ from morphocoverage.plots_embedding import embedding_figures
+
+ [ax] = embedding_figures(_embedding(loadings))["pca"].axes
+ tips = [t.xy for t in ax.texts if isinstance(t, Annotation)]
+ labels = {
+ t.get_text(): (t.get_position(), t.get_horizontalalignment())
+ for t in ax.texts
+ if not isinstance(t, Annotation) and t.get_text() in loadings
+ }
+ return labels, tips
+
+
+def _along(tips: list, x: float, y: float) -> list:
+ """The arrow tips pointing along the loading ``(x, y)``."""
+ return [t for t in tips if math.isclose(math.atan2(t[1], t[0]), math.atan2(y, x))]
+
+
+def test_each_loading_label_stays_beside_its_own_arrow():
+ """#557: the labels were placed in the order of their height, the names in the loadings'
+ order, so a name could sit at another feature's arrow."""
+ loadings = {"geneA": (2.0, 3.0), "geneB": (-4.0, -2.0), "geneC": (1.0, 0.0)}
+ labels, tips = _labels_and_tips(loadings)
+ assert set(labels) == set(loadings) and len(tips) == 3
+ for feature, (lx, ly) in loadings.items():
+ [tip] = _along(tips, lx, ly)
+ (x, y), ha = labels[feature]
+ assert (x, y) == (tip[0] * 1.06, tip[1] * 1.06) # nothing collides: at its own tip
+ assert ha == ("left" if lx >= 0 else "right")
+ # The nearest arrow tip to the label is its own.
+ assert min(tips, key=lambda t: math.dist(t, (x, y))) == tip
+
+
+def test_labels_of_arrows_ending_together_keep_their_own_arrow():
+ # Coincident loadings in shuffled order: the labels move apart vertically, never across.
+ loadings = {"z": (-1.0, 0.5), "dup1": (2.0, 1.0), "dup2": (2.0, 1.0), "w": (0.5, -3.0)}
+ labels, tips = _labels_and_tips(loadings)
+ for feature in ("z", "w"):
+ [tip] = _along(tips, *loadings[feature])
+ assert labels[feature][0] == (tip[0] * 1.06, tip[1] * 1.06)
+ tip = _along(tips, *loadings["dup1"])[0]
+ (x1, y1), _ = labels["dup1"]
+ (x2, y2), _ = labels["dup2"]
+ assert x1 == x2 == tip[0] * 1.06 and y1 != y2
+ assert tip[1] * 1.06 in (y1, y2) # one stays at the tip, the other moves above it
diff --git a/tests/test_unassessed_repeat_tests.py b/tests/test_unassessed_repeat_tests.py
new file mode 100644
index 00000000..51d9f227
--- /dev/null
+++ b/tests/test_unassessed_repeat_tests.py
@@ -0,0 +1,235 @@
+"""A paired test across repeats that cannot be computed is "not assessed", with its reason (#90).
+
+With 3 or more biological repeats whose changes are all the same, the paired t-test has no
+variance to test with: it gives no p. That is not a test that found nothing, and not a design
+with too few repeats: the verdict, the table on the page, panel C of the figures and the plan
+of the next experiment say it is not assessed and why, never "not significant", and never
+leave the condition out without a word.
+"""
+
+from __future__ import annotations
+
+import warnings
+from types import SimpleNamespace
+
+import numpy as np
+import pandas as pd
+import pytest
+from matplotlib.figure import Figure
+
+from morphocoverage.plots_pairwise import (
+ PAIRED_NOTE,
+ add_pairwise,
+ pairwise_contrasts,
+)
+from morphocoverage.sampling_unit import reading_text
+from morphocoverage.sampling_unit.contrast_repeats import NO_SPREAD
+from morphocoverage.sampling_unit.reading_text import (
+ CONFIRMED,
+ NOT_SIGNIFICANT,
+ NOT_TESTED,
+ VERDICTS,
+ condition_readings,
+)
+from morphocoverage.sampling_unit.repeat_plan import DEGENERATE, MISSING_VALUE
+from morphocoverage.workflows import Setup, html_report, report
+from morphocoverage.workflows._html_across import across_frame
+from morphocoverage.workflows._html_plan import _difference_goal
+from morphocoverage.workflows._html_plotly import _pairwise
+
+# The verdict of a paired test that could not be computed (``reading_text.NOT_ASSESSED``).
+NOT_ASSESSED = "not assessed across repeats"
+
+
+def _same_change(repeats: int = 3) -> tuple[pd.DataFrame, pd.DataFrame]:
+ """``A`` one unit above ``CTRL`` in every repeat, the same fields in each: the change is
+ identical in every repeat, so the paired test has no spread."""
+ rows, fovs = [], []
+ for repeat in [f"r{i + 1}" for i in range(repeats)]:
+ for condition, shift in (("CTRL", 0.0), ("A", 1.0)):
+ for field in range(4):
+ key = {
+ "condition": condition,
+ "biological_repeat": repeat,
+ "position_id": f"p{field}",
+ }
+ fovs.append({**key, "repeat_group": repeat})
+ rows += [{**key, "x": 10.0 + shift + 0.3 * field + 0.1 * k} for k in range(5)]
+ return pd.DataFrame(rows), pd.DataFrame(fovs)
+
+
+def _row(condition: str, n: int, lower: int, higher: int, q: float) -> dict:
+ return {
+ "condition": condition,
+ "control_condition": "CTRL",
+ "repeats": n,
+ "lower": lower,
+ "higher": higher,
+ "d_mean": 1.0,
+ "q_paired_t": q,
+ "q_paired_t_normalised": q,
+ }
+
+
+def _contrast(rows: list[dict]) -> SimpleNamespace:
+ return SimpleNamespace(
+ table=pd.DataFrame(),
+ settings={"repeat_col": "biological_repeat", "observation_unit": "cell"},
+ repeats=pd.DataFrame(rows),
+ cells=pd.DataFrame(),
+ targets=pd.DataFrame(),
+ )
+
+
+@pytest.mark.parametrize("n", [3, 6])
+def test_the_reading_of_equal_repeat_changes_is_not_assessed_never_not_significant(n) -> None:
+ readings = condition_readings(_contrast([_row("A", n, 0, n, np.nan)])).set_index("condition")
+ assert readings.loc["A", "verdict"] == NOT_ASSESSED
+ assert getattr(reading_text, "NOT_ASSESSED", None) == NOT_ASSESSED
+ assert NOT_ASSESSED in VERDICTS
+ assert (
+ "no paired test: the change is the same in every biological repeat"
+ in (readings.loc["A", "reading"])
+ )
+
+
+def test_the_other_reading_verdicts_are_unchanged() -> None:
+ contrast = _contrast(
+ [_row("A", 3, 0, 3, 0.01), _row("B", 3, 0, 3, 0.4), _row("C", 2, 0, 2, np.nan)]
+ )
+ readings = condition_readings(contrast).set_index("condition")
+ assert readings.loc["A", "verdict"] == CONFIRMED
+ assert readings.loc["B", "verdict"] == NOT_SIGNIFICANT
+ assert readings.loc["C", "verdict"] == NOT_TESTED
+
+
+def _repeats_row(condition: str, n: int, higher: int, p: float) -> dict:
+ return {
+ "condition": condition,
+ "control_condition": "CTRL",
+ "repeats": n,
+ "lower": n - higher,
+ "higher": higher,
+ "fold_change": 1.1,
+ "mean_difference": 1.0,
+ "p_paired_t": p,
+ "q_paired_t": p,
+ "p_paired_t_normalised": p,
+ "q_paired_t_normalised": p,
+ "d_mean": 1.0,
+ "d_min": 1.0,
+ "d_max": 1.0,
+ "repeat_contrasts": "",
+ "ci_low": np.nan,
+ "ci_high": np.nan,
+ }
+
+
+def test_the_page_table_says_not_assessed_with_the_reason() -> None:
+ contrast = SimpleNamespace(
+ repeats=pd.DataFrame(
+ [
+ _repeats_row("A", 3, 3, np.nan),
+ _repeats_row("B", 6, 6, np.nan),
+ _repeats_row("C", 3, 3, 0.4),
+ _repeats_row("D", 2, 2, np.nan),
+ ]
+ )
+ )
+ result = SimpleNamespace(
+ discovery=None,
+ results={"contrast": contrast},
+ setup=SimpleNamespace(readout="x", unit_word="cell"),
+ )
+ verdicts = dict(zip(*across_frame(result)[["condition", "verdict"]].T.to_numpy(), strict=True))
+ for condition in ("A", "B"):
+ assert verdicts[condition] == f"{NOT_ASSESSED}: {NO_SPREAD}"
+ assert "not significant" not in verdicts[condition]
+ assert verdicts["C"] == NOT_SIGNIFICANT
+ assert verdicts["D"] == "not tested (needs 3 repeats)"
+
+
+def test_panel_c_marks_equal_repeat_changes_apart_from_too_few_repeats() -> None:
+ objects, fovs = _same_change()
+ table = pairwise_contrasts(objects, fovs, feature="x", control="CTRL", n_permutations=99)
+ [pair] = table.itertuples()
+ assert pair.shared_repeats == 3 and np.isnan(pair.p_paired)
+ figure = Figure(figsize=(7, 5))
+ figure.add_subplot()
+ add_pairwise(figure, table, ["CTRL", "A"])
+ panel_c = figure.axes[-1]
+ cells = {t.get_text() for t in panel_c.texts}
+ assert "=" in cells and "–" not in cells
+ assert "=: not assessed" in PAIRED_NOTE
+ assert "– : fewer than 3 repeats imaged both" in PAIRED_NOTE
+ hovers = [h for line in _pairwise(table, ["CTRL", "A"])["c"]["hover"] for h in line if h]
+ assert hovers and all("not assessed" in h and "fewer than" not in h for h in hovers)
+ assert {t for line in _pairwise(table, ["CTRL", "A"])["c"]["text"] for t in line if t} == {"="}
+
+
+def test_panel_c_still_says_too_few_repeats_with_two() -> None:
+ objects, fovs = _same_change(repeats=2)
+ table = pairwise_contrasts(objects, fovs, feature="x", control="CTRL", n_permutations=99)
+ hovers = [h for line in _pairwise(table, ["CTRL", "A"])["c"]["hover"] for h in line if h]
+ assert hovers and all("2 repeats imaged both, fewer than 3" in h for h in hovers)
+
+
+def _plan_result(needed: list[float], status: list[str]) -> SimpleNamespace:
+ discovery = SimpleNamespace(
+ tests=pd.DataFrame(
+ {
+ "feature": ["area"] * 3,
+ "condition": ["a", "b", "c"],
+ "repeats": [3, 3, 3],
+ "confirmed": [True, False, False],
+ }
+ ),
+ ranking=pd.DataFrame({"feature": ["area"]}),
+ )
+ plan = pd.DataFrame(
+ {
+ "condition": ["a", "b", "c"],
+ "repeats_needed": needed,
+ "repeats_needed_twice_fields": needed,
+ "planned_on": ["log ratio"] * 3,
+ "change": [0.2, 0.1, -0.1],
+ "status": status,
+ }
+ )
+ contrast = SimpleNamespace(plan=plan, table=pd.DataFrame(), settings={})
+ return SimpleNamespace(
+ discovery=discovery,
+ setup=SimpleNamespace(readout="area", columns=("area",)),
+ results={"contrast": contrast},
+ )
+
+
+def test_a_plan_with_no_estimable_answer_is_shown_as_not_assessable_not_dropped() -> None:
+ # D64: b and c have no plan; the panel said "Every condition is significant across
+ # repeats" although only a is.
+ result = _plan_result([4.0, np.nan, np.nan], ["ok", DEGENERATE, MISSING_VALUE])
+ _, panel = _difference_goal(result)
+ assert "Every condition is significant" not in panel
+ assert "b | " in panel and "c | " in panel
+ assert f"not assessable: {DEGENERATE}" in panel.replace("'", "'")
+ assert f"not assessable: {MISSING_VALUE}" in panel.replace("'", "'")
+
+
+def test_equal_repeat_changes_are_not_assessed_in_the_report_and_on_its_page(tmp_path) -> None:
+ objects, fovs = _same_change()
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ result = report(
+ objects, fovs, Setup(readout="x", features=("x",), control={"condition": "CTRL"})
+ )
+ page = html_report(result, objects, fovs, tmp_path / "page").read_text(encoding="utf-8")
+ full = " ".join(result.summary(detail="full").split())
+ assert "A — not assessed across repeats" in full
+ assert "A — not significant across repeats" not in full
+ frame = pd.read_csv(tmp_path / "page" / "figures" / "tests_across_repeats.csv")
+ assert list(frame["verdict"]) == [f"{NOT_ASSESSED}: {NO_SPREAD}"]
+ # The glossary explains "not significant across repeats"; no verdict on the page reads it.
+ assert "Not significant across repeats" not in page
+ assert "Not assessed across repeats: A (higher)" in page
+ assert f"{NOT_ASSESSED}: {NO_SPREAD} | " in page
+ assert "fewer than 3)" not in page
diff --git a/tests/test_wording.py b/tests/test_wording.py
index d0f2cb36..7be47224 100644
--- a/tests/test_wording.py
+++ b/tests/test_wording.py
@@ -6,6 +6,7 @@
import numpy as np
import pandas as pd
+import pytest
from _helpers_retrospective import _plate_curve
from _helpers_sampling_unit import _signed
from _helpers_tables import _error_titles
@@ -19,6 +20,7 @@
listing,
number,
percent,
+ percent_fine,
rows_of,
)
from morphocoverage.retrospective import SamplingHierarchy, protocol_reliability
@@ -133,3 +135,21 @@ def test_the_change_is_written_so_a_tiny_change_never_reads_as_none():
assert change(1.002) == "×1.002"
assert change(-3.21, "raw") == "-3.21"
assert change(np.nan) == "–"
+
+
+@pytest.mark.parametrize("share", [1 - 1e-8, 1 - 1e-10, 1 - 1e-12, float(np.nextafter(1.0, 0.0))])
+def test_a_share_a_hair_below_one_never_raises_nor_reads_100(share):
+ """#555: the difference from 100% rounded to 0 and its log raised a math domain error."""
+ for words in (percent(share), percent_fine(share)):
+ assert words != "100%" and words.endswith("%")
+ assert words.startswith(("99.", "<100"))
+ assert words == "<100%" or float(words[:-1]) < 100
+
+
+def test_shares_near_one_keep_their_digits():
+ assert percent(1 - 1e-8) == "99.999999%"
+ assert percent(1 - 1e-10) == "99.99999999%"
+ assert percent(1 - 1e-12) == "99.9999999999%" # no trailing 0 from rounding error
+ assert percent(float(np.nextafter(1.0, 0.0))) == "99.99999999999999%"
+ assert percent(0.99901) == "99.90%" and percent(0.9999) == "99.99%"
+ assert percent(199 / 200) == "99.5%" and percent(0.999) == "99.9%"