Skip to main content

plots.figure_predictions_along_probe

plots.figure_predictions_along_probe(
    out,
    depths,
    classes,
    histology=None,
    regions=None,
    mapping='Cosmos',
    show_histology=True,
    show_prediction=True,
    show_probabilities=True,
    show_legend=False,
    show_labels=True,
    ylim=None,
    fig=None,
    axs=None,
)

Region predictions along one probe: histology, predicted region and probabilities.

Args: out (pd.DataFrame): The output of a region decoder’s predict for one probe, with predicted_atlas_id and one p_<acronym> column per class, in class order. depths (np.ndarray): Depth along the probe (µm) of each row of out. classes (np.ndarray): Atlas id of each class, in the order of the p_ columns: the model’s config["classes"]. histology (pd.DataFrame or dict, optional): The channels’ histology, with axial_um and an Allen atlas_id, e.g. from SpikeSortingLoader.load_channels(). Without it, no histology panel is drawn. regions (iblatlas.regions.BrainRegions, optional): Region table. Defaults to the iblatlas regions plus the decoders’ void_fluid, so no class is dropped. mapping (str, optional): Region map the histology is drawn in, the model’s config["region_map"]. Defaults to “Cosmos”. show_histology (bool, optional): Draw the histology bar. Defaults to True. show_prediction (bool, optional): Draw the predicted-region bar. Defaults to True. show_probabilities (bool, optional): Draw the probabilities as stacked bands. Defaults to True. show_legend (bool, optional): Add a legend of the classes, right of the probabilities. Defaults to False. show_labels (bool, optional): Write the acronyms on the region bars. Defaults to True. ylim (tuple, optional): Depth range of every panel. Defaults to that of depths. fig (matplotlib.figure.Figure, optional): Figure of axs. axs (Sequence[matplotlib.axes.Axes], optional): One axes per shown panel, left to right. Use it to draw several probes on one figure.

Returns: tuple: The figure, and a dict of axes keyed by panel: "histology", "prediction" and "probabilities".

Raises: ValueError: If the number of p_ columns differs from the number of classes.