nirspipe.qc.figures.common.matrix_map#
The conventions every matrix panel in the reports is drawn with.
Which colour scale a quantity takes, which rows and columns a matrix keeps, and how a cell’s number is printed on top of it. One copy, so a red cell cannot mean +1 in one panel and -1 in the next.
Layout stays with each figure: a lower-triangle channel matrix with separation dividers, a pair of square per-chromophore matrices and a cross-brain grid are different pictures. What they must not disagree about is what a colour means.
Module Contents#
Functions#
The colour a scale gives one value, as |
|
Which rows and which columns hold a finite value in any of |
|
Print every cell’s value on the heatmap, in ink the cell’s own colour can carry. |
Data#
API#
- nirspipe.qc.figures.common.matrix_map.CORRELATION_SCALE = 'RdBu_r'#
- nirspipe.qc.figures.common.matrix_map.COHERENCE_SCALE = 'viridis'#
- nirspipe.qc.figures.common.matrix_map.DIFFERENCE_SCALE = None#
- nirspipe.qc.figures.common.matrix_map.scale_color(value: float, cmap: str, vmin: float, vmax: float) str#
The colour a scale gives one value, as
rgb(r,g,b).scale_color(0.0, "RdBu_r", -1, 1) -> the scale's midpoint colourFor anything that has to match a heatmap’s fill without being one: the ink a printed cell value takes, or a chord coloured by the same quantity the matrix beside it is.
- nirspipe.qc.figures.common.matrix_map.kept_axes(mats) tuple[numpy.ndarray, numpy.ndarray]#
Which rows and which columns hold a finite value in any of
mats.[[0.4, nan], [nan, nan]] -> rows [True, False], columns [True, False]
A figure draws only these: a site no value was computed for is left off the axis rather than drawn as an empty row. The tables on disk keep every site.
- nirspipe.qc.figures.common.matrix_map.cell_values(fig, z, row_labels, col_labels, *, cmap, vmin, vmax, row, col, fmt: str = '.2f', strip_zero: bool = True, marks=None) None#
Print every cell’s value on the heatmap, in ink the cell’s own colour can carry.
a cell at .69 -> white text; the same number at .12 -> black fmt "+.3f", marks True at a cell of .0374 -> bold "+.037*"
Every cell gets its number, so a matrix on a fixed scale whose values sit close together stays readable.
The ink is chosen from the cell’s own colour and not from its value, so one rule serves sequential and diverging scales alike. Two text traces rather than one, because a heatmap takes a single
textfontfor the whole grid.marks, a boolean array shaped likez, sets the marked cells’ numbers in bold with a star. A signedfmtprints a value that rounds to zero without its sign.