Public API#

Generated by docs/gen_public_api.py from the package itself; do not edit by hand. tests/test_public_api.py fails when this file is out of date.

Public means a name in behav_utils.__all__ or in the __all__ of one of the sub-packages below. Every name has one home sub-package; the most used ones can also be imported from behav_utils itself (marked top level). Everything else is private: module paths below a sub-package (such as behav_utils.readouts.fit) and names starting with _ can change without notice. From 1.0 the public names follow semantic versioning (see the README).

Signatures list the parameters and their defaults. Type annotations and parameters whose names start with _ (private, as everywhere in the library) are left out, and enums are listed by their members, because Python 3.11 and later versions print both differently.

behav_utils.config#

  • class ClockConfig(name='rig', unit='s', on_problem='warn', order=<factory>) — clock: the recording clock every time column is on.

  • class ConfigError · top level — A config that cannot be used as written: an unknown key, a missing required key, a bad value.

  • load_cohorts(path) — Load the cohorts: block from the project YAML.

  • load_config(path) · top level — Load a project config from YAML and check every key.

  • class ProjectConfig(name, description='', reader=<factory>, animal_metadata=None, experimenter='', task=<factory>, tasks=<factory>, task_by=None, scoring=<factory>, clock=<factory>, columns=<factory>, session_metadata=<factory>, extra_columns=<factory>, session_types=<factory>, session_presets=<factory>, sessions_to_ignore=<factory>, source_dir=None) · top level — A whole project config, as load_config returns it; checked on construction.

  • class ScoringConfig(on_mismatch='warn', outcome_labels=<factory>) — scoring: what happens when a recorded score disagrees with the task’s.

  • class TaskConfig(primary_stimulus=None, primary_choice=None, boundary=0.0, stimulus_range=(-1.0, 1.0), stimulus_scale='linear', choice_mapping=<factory>, type='two_afc', params=<factory>) — One task block of the config.

  • class TaskSelector(field, values) — task_by: which named task block a session uses.

behav_utils.tasks#

  • CAPABILITIES (dict)

  • class Discrete(values, weights=None) — A finite set of stimuli values drawn with weights (equal if omitted; normalised).

  • class GoNoGo(go_side='positive', on_boundary='no_go') · top level — Go/no-go.

  • list_tasks() — The registered task types.

  • enum Outcome: ERROR = 0, CORRECT = 1, NO_RESPONSE = 2, ABORT = 3, UNSCORED = 4 · top level — How a trial was scored; TrialData.outcome holds these as small integers.

  • register_task(cls) — Class decorator: make a Task subclass known by its name, so configs and stores can name it.

  • class Reproduction(tolerance=0.1) · top level — Reproduce the stimulus.

  • require(task, needs, what, instead=None) — Raise RequirementError unless task declares every capability in needs.

  • class RequirementError · top level — A statistic or readout was asked of a task that lacks a capability it needs.

  • class ResponseSpace(kind, labels=()) — What a response can be.

  • class StimulusDistribution() — A distribution of stimuli: sample, pdf and support; grid comes with it.

  • class Task() · top level — A task: categories, the correct response and scoring, for arrays of trials.

  • task_from_dict(d) — Rebuild a task from to_dict output.

  • class TruncatedNormal(mean=0.0, sd=0.3, low=-1.0, high=1.0) — A normal (mean, sd) restricted to [low, high].

  • class TwoAFC(b_side='positive', on_boundary='A') · top level — Two-alternative forced choice.

  • class Uniform(low=-1.0, high=1.0) — Uniform on [low, high].

behav_utils.data#

  • class AnimalData(animal_id, sessions, metadata=<factory>) · top level — All data for a single animal: its sessions, in chronological order, and its metadata.

  • class Block(distribution, start, stop, trial_start, n_trials) — A run of consecutive sessions on one distribution, as find_blocks returns it.

  • block_after(sessions, switch) — The ordered sessions of the block that starts at switch.

  • block_before(sessions, switch) — The ordered sessions of the block that ends at switch.

  • build_mask(trials, exclude_abort=True, exclude_opto=True, exclude_no_response=False) · top level — Build a boolean trial mask from standard exclusion flags.

  • build_session(raw, config, *, strict=True, session_idx=0, source_id=None) — One raw session → SessionData: the half of loading that every reader shares.

  • csv_folder_reader(config, *, strict=True) — The csv_folders reader.

  • discover_sessions(config_or_path, *, reader=None, peek=True, laser=False) · top level — Every session the reader finds, one row each, without loading trials.

  • class ExperimentData(animals=<factory>, metadata=<factory>, config=None) · top level — Top-level container for all animals, with the config they were loaded with.

  • filter_session(session, mask=None, label='', trial_type=None) — Return new SessionData with only the selected trials.

  • filter_trial_data(trials, mask, clear_flags=True) — Return new TrialData containing only trials where mask is True.

  • filter_trials(sessions, mask_fn=None, min_trials=10, label='', exclude_abort=True, exclude_opto=True, trial_type=None) · top level — Filter trials within each session.

  • find_blocks(sessions, *, min_block_trials=0) · top level — Maximal runs of consecutive sessions sharing session.distribution.

  • find_switches(sessions, *, min_block_trials=0) · top level — Boundaries between consecutive qualifying blocks.

  • get_arrays(trials, session=None) — Extract trial arrays from a TrialData object — a pure projection.

  • is_empty_csv(path) — True for a file with nothing in it, not even a header (a run stopped before writing anything).

  • list_presets() · top level — Return {name: description} for all registered presets.

  • load_animal(animal_dir, config, *, strict=True) — Load one animal folder with the csv_folders reader: every sub-directory is a session folder.

  • load_experiment(config_or_path, *, reader=None, strict=True, sessions=None) · top level — Load every session a reader finds, or the chosen sessions, into an ExperimentData.

  • load_session_csv(csv_path, config, *, date=None) — Load one CSV file as one session, by the csv_folders reader’s rules for a single file.

  • load_store(path, *, sessions=None, strict=True) · top level — Load a store, or only the chosen sessions of it, opening only their trial files.

  • opto_mask(trials, delta=0) · top level — Boolean mask for trials at a fixed offset from opto events.

  • pool_arrays(sessions) · top level — Concatenate trial arrays across sessions.

  • preset_from_spec(name, spec) — Build a SessionFilter from a raw session_presets entry (YAML dict).

  • class RawSession(animal_id, session_id, date, trials, start=None, metadata=<factory>, source=None, files=<factory>, peek=None) — One session as a reader found it, before any column mapping.

  • read_manifest(path) · top level — The store’s sessions, one row each, without opening any trial file.

  • register_preset(name, filt) · top level — Register a named session filter preset, replacing any of the same name.

  • register_presets_from_config(config_raw) — Register the session_presets of a parsed YAML config in the process-wide registry.

  • save_store(experiment, path, *, overwrite=False) · top level — Save experiment as a store at path, a directory of Parquet and JSON files.

  • select_sessions(animal, preset=None, **overrides) · top level — Select sessions from an animal using a preset and/or keyword criteria.

  • session_from_arrays(stimuli, choices, categories=None, session_idx=0, distribution=None, abort=None, reaction_time=None, animal_id='SIM', stage='task', base_date=None, stim_range=(-1.0, 1.0), task=None, laser=None, events=None, clock='', session_date=None) — Assemble a SessionData from raw per-trial arrays, scored by task (default TwoAFC()).

  • class SessionData(session_id, session_idx, date, metadata, trials, session_type='regular', start=None, session_type_source='derived', source_id=None, experimenter='', task=<factory>, task_name='default', clock='', source=None, filter_info=None) · top level — All data for a single behavioural session.

  • class SessionFilter(stage=None, distribution=None, session_type=None, min_accuracy=None, max_accuracy=None, last_fraction=None, first_n=None, last_n=None, last_n_qualifying=None, after_session_idx=None, before_session_idx=None, session_indices=None, min_trials=10, exclude_opto=False, exclude_types=(), custom_filter=None) · top level — Immutable session selection criteria.

  • class SessionMetadata(fields=<factory>) — Session-level metadata (constant within a session).

  • class SessionSummary(session_id, session_idx, date, stage, distribution, session_type, n_trials, n_valid, n_abort, n_no_response, accuracy, start=None, session_type_source='derived', task='two_afc', animal_id='', experimenter='', source_id=None, source=None, filter=None) — Counts and accuracy of one session (SessionData.summary()).

  • class StoreError · top level — A store that cannot be written or read as asked.

  • table_reader(source, *, animal, session, date, start=None) — A reader over one table holding every trial.

  • trial_key_of(session, trial_number) — The int64 trial keys of one session’s trials: its session hash above the trial number’s 20 bits.

  • class TrialArrays(choice, stimulus, category, prev_choice=None, prev_stimulus=None, prev_category=None, reaction_time=None, trial_key=None, correct=None, prev_correct=None, task=None, truth=None) · top level — Aligned per-trial arrays for one block of (pre-filtered) trials.

  • class TrialData(trial_number, stimulus, choice, outcome, correct, category, choice_raw=<factory>, stimulus_raw=<factory>, reaction_time=<factory>, abort=<factory>, opto_on=<factory>, distribution=<factory>, correct_recorded=<factory>, outcome_recorded=<factory>, optional_fields=<factory>, extra=<factory>, events=<factory>, prev_stimulus=<factory>, prev_choice=<factory>, prev_correct=<factory>, prev_category=<factory>, prev_reaction_time=<factory>, prev_opto_on=<factory>, prev_has_prev=<factory>) · top level — Per-trial arrays for a single session, all of the same length.

behav_utils.stats#

  • compute_stats(arrays, names=None, *, rng=None, strict=True) · top level — Compute scalar statistics on one block of trials.

  • fit(name, *, outputs, exchangeable=True, requires=(), instead=None) — Register a fitter that returns several numbers, as a decorator on g(arrays, *, rng) -> tuple.

  • fit_pse_dynamics(a, shape=None) — The PSE_DYNAMICS values for one block.

  • is_exchangeable(name) — Whether trial-level resampling is valid for a statistic.

  • list_stats(task=None) · top level — Every scalar name that can be requested from :func:compute_stats.

  • LOGISTIC_HISTORY = ('w_stimulus', 'w_prev_choice_1', 'w_prev_choice_2', 'w_prev_choice_3', 'w_prev_outcome_1', 'w_prev_outcome_2', 'w_prev_outcome_3', 'history_decay')

  • PSE_DYNAMICS = ('pse_start', 'pse_end', 'pse_final', 'pse_tau', 'pse_trials_to_90', 'pse_censored', 'pse_shape_daic', 'pse_step_switch')

  • PSYCHOMETRIC = ('mu', 'sigma', 'lapse_low', 'lapse_high')

  • SD_PROFILE = ('sd_slope', 'sd_curvature', 'sd_range')

  • SDT = ('dprime', 'criterion')

  • stat(name, *, exchangeable=True, requires=(), instead=None) — Register a statistic that returns one number, as a decorator on f(arrays, *, rng) -> float.

behav_utils.readouts#

  • class BinnedCurve(kind, centres, values, counts) — Per-stimulus-bin mean of either P(B) (choice_prob) or P(correct) (accuracy).

  • compute_binned_curve(arrays, *, kind='choice_prob', n_bins=8) · top level — Empirical curve on one block (responded trials only).

  • compute_conditional_psychometric(arrays, *, n_bins=8, min_per_bin=15) · top level — Per-previous-stimulus-bin psychometric fits on one block.

  • compute_error_distribution(arrays, *, n_bins=20, limit=1.0) · top level — The signed errors binned over [-limit, limit] on the library’s axis.

  • compute_psychometric_curve(arrays, *, n_bins=8, n_bootstrap=1000, seed=42) · top level — Fit a cumulative Gaussian to one block; CIs and band from trial bootstrap.

  • compute_response_curve(arrays, *, n_bins=8) · top level — Mean response, on the library’s axis, per stimulus bin.

  • compute_sd_profile(arrays, *, n_bins=8) · top level — Serial-dependence profile on one block of a binary task.

  • compute_serial_bias(arrays, *, n_bins=8) · top level — The serial-bias curve over previous − current stimulus in [-2, 2] on the library’s axis.

  • compute_update_matrix(arrays, *, n_bins=8, trial_filter='post_correct') · top level — Update matrix on one block of trials, using the frozen lag-1 view.

  • class ConditionalPsychometric(params, unconditional, n_per_bin, fell_back, n_trials, success) — (n_bins × 4) psychometric parameters conditioned on the previous-stimulus bin.

  • cumulative_gaussian(x, mu, sigma, lapse_low=0.0, lapse_high=0.0) — Compute cumulative Gaussian psychometric function.

  • class ErrorDistribution(edges, counts, density, mean, sd, n) — Signed errors (response − truth), binned.

  • fit_psychometric(stimuli, choices, x_eval=None, n_bootstrap=0, seed=42) · top level — Fit psychometric curve to choice data.

  • fit_psychometric_gof(stimuli, choices, psych_params, n_bins=8) — Compute goodness-of-fit metrics for psychometric curve.

  • fit_update_matrix(stimuli, choices, *, correct, n_bins=8, trial_filter='post_correct', no_response=None, not_blockstart=None, prev_stimuli=None, prev_choices=None, prev_correct=None) — Compute update matrix from raw behavioural arrays.

  • matrix_error(matrix1, matrix2) — Mean squared error between two matrices, ignoring NaNs.

  • class PsychometricCurve(mu, sigma, lapse_low, lapse_high, x, y, bin_centres, bin_means, bin_counts, n_trials, success, ci=None, band=None, n_bootstrap=0) — Cumulative-Gaussian fit to P(B | stimulus), with binned data and a bootstrap band.

  • class ResponseCurve(centres, values, sem, counts) — Mean response per stimulus bin, with its SEM and count.

  • class SerialBiasCurve(centres, values, sem, counts) — Mean error per bin of previous − current stimulus.

  • class SerialDependenceProfile(centres, profile, marginal, n_pairs) — profile[j] = mean over current bins i of P(B | prev j, cur i) − P(B | cur i), post-correct pairs.

  • class UpdateMatrix(matrix, conditional, unconditional, n_pairs, n_trials, trial_filter, n_sources=1, coverage=None, sem=None) — (n_bins × n_bins) shift in P(B).

behav_utils.models#

  • class Design(task, stimulus, label='', laser=None, abort=None, no_response=None) — A run without its responses.

  • generate_synthetic_animal(model=None, n_sessions=20, trials_per_session=300, *, animal_id='SYN01', task=None, distribution=None, label='', stage='task', start_date=None, laser_fraction=0.0, max_laser_run=None, abort_rate=0.05, no_response_rate=None, timing=None, metadata=None, rng=None) · top level — n_sessions synthetic sessions on consecutive days from start_date, as an AnimalData.

  • generate_synthetic_experiment(animals, rng=None) · top level — Synthetic animals as an ExperimentData.

  • generate_synthetic_session(model=None, *, task=None, distribution=None, n_trials=300, label='', laser_fraction=0.0, max_laser_run=None, abort_rate=0.05, no_response_rate=None, timing=None, animal_id='SYN01', stage='task', session_date=None, session_idx=0, rng=None) · top level — One synthetic session, with the structure of one loaded from files.

  • class IdealObserver(noise=0.3, distribution=<factory>, lapse=0.0, laser=None) · top level — The Bayesian observer, with Gaussian sensory noise and a prior of its own.

  • make_design(task=None, distribution=None, n_trials=300, *, label='', laser_fraction=0.0, max_laser_run=None, abort_rate=0.0, no_response_rate=0.0, rng=None) · top level — Draw a run of trials: the stimuli, and which trials carry the laser, abort or get no response.

  • class Model() — A behavioural model: simulate(design, rng) returns its Responses to a run.

  • normative_pse(distribution, noise, task=None) — The ideal observer’s point of subjective equality.

  • normative_slope(distribution, noise) — The ideal observer’s expected response slope on a continuous task.

  • class PsychometricModel(mu=0.0, sigma=0.3, lapse_low=0.02, lapse_high=0.02, laser=None) · top level — Choices from the psychometric curve the library fits (fit_psychometric).

  • class RandomModel(p=0.5, laser=None) · top level — Response 1 with probability p on every trial, whatever the stimulus.

  • class ReproductionModel(bias=0.0, slope=1.0, noise=0.1, lapse=0.0, laser=None) · top level — A reproducer whose response is a linear function of the stimulus, plus noise.

  • class Responses(choice, reaction_time=None) — What a model returns for a run.

  • simulate(model, design, rng=None, *, session_idx=0, animal_id='SIM', stage='task', base_date=None) · top level — Run model on design, giving a session scored by the design’s task.

  • simulate_responses(model, stimuli, task=None, rng=None, laser=None) — Just the model’s choices to stimuli, with no aborts and no session.

  • class Timing(session_start=32400.0, stimulus_delay=0.5, rt_median=0.45, rt_sigma=0.35, response_window=2.0, abort_after=0.2, iti=2.0) — How a synthetic trial unfolds, in seconds.

  • class TrialInfo(t, stimulus, laser, choice=None, correct=None, truth=None) — One trial as a TrialwiseModel sees it.

  • class TrialwiseModel() — A model that responds trial by trial and may learn from feedback.

behav_utils.analysis#

  • class ArrayAverage(mean, sem, n) — Element-wise mean and SEM across a stack (average_arrays).

  • average_arrays(arrays, *, ddof=1) — Element-wise mean and SEM across a stack of same-shaped arrays.

  • bootstrap_phase_stats(phase, names, *, n_draws=1000, n_trials=None, seed=0, unit='trials') — Resample one phase’s trials (or sessions) and recompute its statistics.

  • bootstrap_units(values, *, n_boot=2000, ci=0.95, statistic=mean, seed=0) — Across-unit (cluster) bootstrap CI on a per-unit value array.

  • collect_rows(scalars, animal, group=None, group_col='group', **labels) — Stamp per-animal scalar rows with the animal, its group and any labels.

  • combine(points, *, over='session', how='mean', weight=None) — Collapse one axis of a tidy stat table, carrying all other label columns.

  • compare_groups(rows, group_col='group', groups=None, stats=None, value_col='value', stat_col='stat', unit_col='animal', paired=False, alternative='two-sided') · top level — Rank-test each stat across animals, split into two groups.

  • compute_delta_stat(phases, names=('mu', 'sigma', 'lapse_low', 'lapse_high'), *, labels=None, reference=None, curve=True, update_matrix=False, downsample=False, n_permutations=0, n_bootstrap=1000, units=('trials',), n_bins=8, trial_filter='post_correct', n_repeats=200, seed=42) · top level — Compare N phases against a reference, with bootstrap CI and permutation p.

  • compute_interaction(result_a, result_b, contrast, *, contrast_b=None, label_a='a', label_b='b') · top level — Difference of differences between two :class:DeltaStats results.

  • compute_phase_stats(phase, names, *, per_session=False, animal_id=None, rng=None) · top level — Scalar statistics for a phase.

  • compute_rolling_stats(sessions, names, *, per_session=True, window=50, step=10, min_short=10) · top level — Rolling scalar statistics over pre-filtered sessions.

  • class Contrast(label_a, label_b, diff, n_a, n_b, n_sessions_a, n_sessions_b, difference_draws=<factory>, perm_p=None, um_diff=None, um_rmse=nan, um_corr=nan) — Δ = a − b, with difference draws per unit and an optional permutation p.

  • class DeltaStats(phases, contrasts, reference, names, units, downsample=False, n_matched=<factory>, seed=0) — Result of :func:compute_delta_stat.

  • downsample(clean, n, unit='trials', with_replacement=True, n_bins=8, rng=None) — Subsample clean sessions to ~n of the chosen unit; returns new [SessionData].

  • class DrawSummary(ci_lo, ci_hi, p, median, n_draws) — The summary of one statistic’s draws, from summarise_draws.

  • class GroupComparison(tests=<factory>, group_a=None, group_b=None, paired=False) — One :class:RankTest per stat between two groups of animals (compare_groups).

  • class Interaction(label_a, label_b, contrast_a, contrast_b, delta_a, delta_b, interaction, draws, draws_a, draws_b, shared_result=False) — Difference of differences: (Δ_a) − (Δ_b), bootstrap only.

  • min_achievable_p(test, *, n=None, n1=None, n2=None) — Smallest two-sided p-value the given rank test can return at this sample size.

  • paired_diff(points, *, by, a, b, keys=('animal',), value='value') — Per-unit difference value[a] - value[b] across label column by.

  • permute_phase_difference(phase_a, phase_b, names, *, n_draws=1000, n_trials=None, seed=0) — Null distribution of stat(a) - stat(b) from shuffling the labels.

  • class PhaseStats(pooled, sessions, animal, n_sessions, n_trials) — Scalar statistics of one phase.

  • class PhaseSummary(label, stats, n_trials, n_sessions, draws=<factory>, stats_matched=None, curve=None, update_matrix=None) — One condition: observed stats, its bootstrap draws per unit, and optional readouts.

  • rank_test(a, b, *, paired=False, alternative='two-sided') — Rank test between two per-unit value arrays.

  • class RankTest(test, paired, alternative, statistic, p, n_a, n_b, min_p, group_a=None, group_b=None, median_a=nan, median_b=nan, note='') — One rank test (rank_test): Wilcoxon signed-rank (paired) or Mann-Whitney U.

  • resample_psychometric_curve(clean, n, *, n_repeats=100, with_replacement=True, n_bins=8, seed=42) — n_repeats matched-n draws of n responded trials, each fitted, then aggregated.

  • resample_stat_vectors(clean, stat_names, *, n=None, n_repeats=1000, with_replacement=True, unit='trials', seed=0) — Resample trials K times and recompute summary stats — one matrix of replicates.

  • resample_update_matrix(clean, n, *, n_repeats=100, with_replacement=True, n_bins=8, trial_filter='post_correct', seed=42) — n_repeats matched-n draws of n post-correct pairs, each fitted, cell-wise mean.

  • class RollingStats(curves, session_info, names, window, step, per_session) — Rolling statistics as a tidy frame.

  • shared_trial_count(phase_a, phase_b) — How many trials two phases have in common (same session_id and trial_number).

  • summarise_draw_frame(draws, *, observed=None, ci=0.95, null_value=0.0) — summarise_draws for every column of a frame of draws.

  • summarise_draws(draws, *, observed=None, ci=0.95, null_value=0.0) — Percentile interval and two-sided p from a distribution of draws.

  • class UnitBootstrap(point, lo, hi, n) — Across-unit bootstrap of one per-unit value array (bootstrap_units).

behav_utils.plotting#

  • apply_style(dpi=100, font_size=10) · top level — Apply default behav_utils style to matplotlib.

  • COLOURS (dict)

  • get_colour(index_or_name) — A colour from an index into PALETTE (wrapping round), a role in COLOURS, or a colour itself.

  • PALETTE = ('#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf')

  • plot_binned_curve(curve, ax=None, *, color=None, label=None, show_reference=True, title='') · top level — Binned P(choose B), or P(correct), per stimulus bin.

  • plot_conditional_psychometric(cp, ax=None, *, param='mu', color=None, label=None, show_unconditional=True, title='') · top level — One parameter as a function of the previous-stimulus bin; hollow markers where it fell back.

  • plot_error_distribution(dist, ax=None, *, color=None, label=None, title='') · top level — Density of signed errors (response − truth), with zero marked.

  • plot_interaction(interaction, stat, ax=None, *, show_p=True, show_components=True, colour_a='#1f77b4', colour_b='#ff7f0e', colour_interaction='#7f2704', units=None) · top level — One stat: Δ_a, Δ_b (context) and their difference with its CI and bootstrap p.

  • plot_interaction_grid(interaction, stats=None, *, ncols=4, panel_size=(3.0, 3.0), suptitle=None, show_p=True, show_components=True, colour_a='#1f77b4', colour_b='#ff7f0e', colour_interaction='#7f2704', units=None) · top level — Grid of :func:plot_interaction, one panel per stat, each with its own y-scale.

  • plot_psychometric_comparison(result, contrast=None, ax=None, *, color_a='#d62728', color_b='#444444', show_stats=True, show_band=True, show_data=True, stats_keys=('mu', 'sigma', 'accuracy'), unit=None) · top level — Two psychometric curves (phase over reference) with the Δ, CI and p annotated.

  • plot_psychometric_curve(curve, ax=None, *, color=None, label=None, alpha=0.7, linewidth=1.5, linestyle='-', show_data=True, show_band=True, show_params=False, show_lapse=False, show_reference=True, title='') · top level — Fitted curve, binned data points, and the bootstrap band if present.

  • plot_response_curve(curve, ax=None, *, color=None, label=None, show_identity=True, title='') · top level — Mean response per stimulus bin (± SEM), with the identity line a faithful reproducer would follow.

  • plot_rolling_stats(result, stat, ax=None, color=None, label=None, alpha=0.7, linewidth=1.5, sessions=None, title='') · top level — One stat against trial position, one line per session, from compute_rolling_stats.

  • plot_sd_profile(prof, ax=None, *, color=None, label=None, title='') · top level — The serial-dependence profile: P(B) shift per previous-stimulus bin.

  • plot_serial_bias(curve, ax=None, *, color=None, label=None, title='') · top level — Mean error (current stimulus’s effect removed) per bin of previous − current stimulus, ± SEM.

  • plot_stat_comparison(result, stat, ax=None, *, phase_order=None, palette=None, show_p=True, units=None) · top level — One stat: a point per phase with its bootstrap CI(s); p above each non-reference phase.

  • plot_stat_comparison_grid(result, stats=None, *, ncols=3, phase_order=None, palette=None, panel_size=(3.0, 3.0), suptitle=None, show_p=True, units=None) · top level — Grid of :func:plot_stat_comparison, one panel per stat.

  • plot_trajectory(result, stat, ax=None, color=None, label=None, alpha=0.7, linewidth=1.5, marker='o', markersize=5, linestyle='-', show_distribution_boundaries=True, title='') · top level — One stat per session, in session order, from compute_phase_stats(..., per_session=True).

  • plot_update_matrix(um, ax=None, *, vmin=None, vmax=None, cmap=None, colorbar=True, title='', xlabel='Previous stimulus', ylabel='Current stimulus') · top level — Heatmap of the shift matrix (symmetric colour scale unless given).

  • UM_CMAP(X, alpha=None, bytes=False) — Colormap objects based on lookup tables using linear segments.