nirspipe.qc.figures.hyper.hyper_figures#
Plotly figure builders for the hyperscanning group-level raw QC report.
Module Contents#
Functions#
Every member’s annotated blocks, on its own clock above and the shared one below. |
|
Which pairs the dyad could use, when, and what went wrong where it could not. |
|
Everything the two motion figures draw, measured once off the aligned recordings. |
|
One stage of the motion panel: a GVTD row per channel set, both members in each. |
|
One head per member per block, coloured by the share of its windows that passed. |
|
Single-channel-pair signal overlay (multi-subject), for iframe per-channel pages. |
|
Data#
API#
- nirspipe.qc.figures.hyper.hyper_figures.logger = 'get_logger(...)'#
- nirspipe.qc.figures.hyper.hyper_figures.build_alignment_timeline(raw_raws: dict[str, mne.io.Raw] | None, aligned_raws: dict[str, mne.io.Raw], subject_ids: list[str], residuals: list[dict] | None = None, tol_s: float = 0.0) plotly.graph_objects.Figure | None#
Every member’s annotated blocks, on its own clock above and the shared one below.
The second row is the shared clock every later panel reads.
residualsareonset_residuals(), drawn as a third row: what is left between the members after alignment, which the bars are too coarse to show. Points beyondtol_sare red.One row per member in each panel. None when nothing is annotated.
- nirspipe.qc.figures.hyper.hyper_figures.build_usable_time(grid: dict, subject_ids: list[str], series: dict[str, dict], conditions: dict[str, tuple[float, float]] | None = None, cutoffs: dict[str, float] | None = None, rejected: dict[str, set[str]] | None = None) plotly.graph_objects.Figure | None#
Which pairs the dyad could use, when, and what went wrong where it could not.
A channel is usable by the dyad only while it is passing in both members at the same moment, so the dyad’s usable time is the intersection of the two and not the smaller of them: two members can each keep 13 of 14 pairs and share only 12, if the pair they each lose is a different one. That intersection is the carpet at the bottom.
The carpet’s colours are the screening’s, window by window. A pair a member rejected (
rejected, by screening, by hand or in channels.tsv) keeps them, is named as rejected and counts as lost, as it does in the dyad’s usable numbers. Rows run from worst to best: rejected pairs first, then by the share of windows lost and of windows neither member passed.Over it, each member’s long-channel means for the metrics the mask is made of, so the panel says why a pair went and not only that it did. A condition bar names the blocks and dotted rules carry their edges down through the series.
None when the grid holds no pair.
- nirspipe.qc.figures.hyper.hyper_figures.SPIKE_MERGE_S = 2.0#
- nirspipe.qc.figures.hyper.hyper_figures.motion_series(od_raws: dict[str, mne.io.Raw], after_raws: dict[str, mne.io.Raw] | None, subject_ids: list[str], sep_bands=None, imu: dict[str, dict[str, ImuTrace]] | None = None, full_raws: dict[str, mne.io.Raw] | None = None, full_after: dict[str, mne.io.Raw] | None = None, roi_map: dict | None = None, rejected: dict[str, list[str]] | None = None) dict#
Everything the two motion figures draw, measured once off the aligned recordings.
-> {"subject_ids": [...], "t": (39610,), "sets": ["long", "short"], "stages": ["before", "after"], "series": {"before": {"long": [("sub-01", (39610,)), ...]}, ...}, "spikes_both": {"before": [(412.0, 3.1), ...]}, "carpets": {"before": [("sub-01", z, t, labels, spans)]}, "y_tops": {("before", "long"): 11.4}, "divisors": {("sub-01", "long"): 4.1e-04}, "imu": {"gyro": {...}}, "roi": {"sub-01": [("PFC", 0, 11), ...]}, "roi_colours": {"PFC": "#8da3c0", ...}}
roi_mapgroups each member’s canonical carpet rows by ROI, as on the member’s own carpet;roiholds the groups for the strip, empty without a map.imuis{sid: {sensor: ImuTrace}}already on the shared clock, fromalign_imu_like(); see_imu_rows().Each member is divided by its own before-median, and the corrected traces are divided by that same number. GVTD is an RMS of optical-density derivatives in the recording’s own units, so two members’ raw traces share no scale; at x its own median, 1.0 is that member’s usual level for both of them. Dividing the corrected trace by its own median would divide out the shrinkage the second figure shows.
One y range per channel set and stage, so the corrected peaks are not flattened under the uncorrected ones; the drop is read off the tick values, since both stages are divided by the same median. Long and short do not share one: each pair of (member, set) is divided by its own median, so a “x median” on the long channels is not the same quantity as one on the short.
Spikes are kept only where every member was spiking at once; a member spiking alone shows on the usable-time carpet.
full_rawsandfull_afterare the same recordings before the cut, on each member’s own clock. Given, GVTD is filtered and spikes are found over the whole recording and then cut to the shared window, so the cut’s edges are not a filter edge both members share.rejectedis each member’s rejected channels, which its GVTD leaves out while its carpet still draws them, as on the member’s own page.Returns
{}when no member carries usable optical density.
- nirspipe.qc.figures.hyper.hyper_figures.build_motion_panel(motion: dict, stage: str = 'before', conditions: dict[str, tuple[float, float]] | None = None) plotly.graph_objects.Figure | None#
One stage of the motion panel: a GVTD row per channel set, both members in each.
build_motion_panel(motion, "after", conditions) -> figure
Simultaneous motion is drawn as the pointwise minimum of the two traces, filled to the axis: high only where both are high, and needing no threshold to be picked.
Under the rows sits the spike strip, marking only the spans where every member was spiking at once, and under that each member’s z-scored optical-density carpet, drawn by the subject report’s own
add_carpet()so the dyad’s image and the member’s own cannot drift apart.Row titles and the run’s numbers sit in the left margin rather than inside the panels, where a noisy recording’s data would cover them.
Returns None for a stage the dyad has no data for.
- nirspipe.qc.figures.hyper.hyper_figures.build_head_by_condition(geo_by_sub: dict, subject_ids: list[str], grid: dict, conditions: dict) plotly.graph_objects.Figure | None#
One head per member per block, coloured by the share of its windows that passed.
The aggregated view: which part of whose cap went and in which block. Complements the usable-time carpet, which is channel by time with no geometry.
- nirspipe.qc.figures.hyper.hyper_figures.build_signal_overlay_pair(aligned_raws: dict[str, mne.io.Raw], subject_ids: list[str], pair: str, markers_list: list[dict], cond_colors_: dict[str, str]) plotly.graph_objects.Figure | None#
Single-channel-pair signal overlay (multi-subject), for iframe per-channel pages.