smftools.analysis.plot.autocorr#

autocorr.py — ACF overlay, LS periodogram, paired barplot, and metric histogram rendering.

All functions read summary CSVs (or DataFrames) produced by a compute pass and write figures. Project-specific values (colors, labels, reference ordering) are passed as parameters.

Functions

plot_autocorr_overlay(summary_df, ...[, ...])

Plot per-group mean ± SEM autocorrelation curves.

plot_ls_overlay(summary_df, ref_strand, ...)

Plot mean ± SEM Lomb-Scargle spectra.

plot_metric_barplot_paired(summary_df, ...)

Paired barplot: x = group, paired bars = reference strands, dots = individual replicates.

plot_metric_histogram(df, metric_key, ...[, ...])

Overlaid per-group histograms (density-normalised) of a single-molecule metric.

plot_sm_periodogram_overlay(sm_df, output_path)

Plot mean ± SEM single-molecule LS spectra averaged over individual reads.

rolling_smooth(arr[, win])

NaN-aware moving average.

smftools.analysis.plot.autocorr.rolling_smooth(arr, win=25)#

NaN-aware moving average.

Return type:

ndarray

smftools.analysis.plot.autocorr.plot_autocorr_overlay(summary_df, ref_strand, output_path, group_col='cell_type', group_order=None, group_colors=None, group_labels=None, ref_label='', title_suffix='', max_lag=1000, smooth_win=25, dpi=300, figsize=(5.5, 2.5))#

Plot per-group mean ± SEM autocorrelation curves.

Return type:

None

Parameters#

summary_df : DataFrame with columns reference_strand, group_col, curve_csv. ref_strand : filter to this reference_strand value, or None for all rows. group_order : order to plot groups; defaults to unique values in group_col. group_colors : {group_value: color}; defaults to matplotlib tab10. group_labels : {group_value: display_label}.

smftools.analysis.plot.autocorr.plot_ls_overlay(summary_df, ref_strand, output_path, group_col='cell_type', group_order=None, group_colors=None, group_labels=None, ref_label='', title_suffix='', nrl_range=(150.0, 250.0), period_xlim=(150, 250), dpi=300, figsize=(3.5, 2.5))#

Plot mean ± SEM Lomb-Scargle spectra.

Return type:

None

Parameters#

ref_strand : filter to this reference strand value, or None for all rows.

smftools.analysis.plot.autocorr.plot_sm_periodogram_overlay(sm_df, output_path, group_col='cell_type', group_order=None, group_colors=None, group_labels=None, title_suffix='', nrl_range=(150.0, 250.0), period_xlim=(150, 250), dpi=300, figsize=(3.5, 2.5))#

Plot mean ± SEM single-molecule LS spectra averaged over individual reads.

Return type:

None

Parameters#

sm_dfDataFrame with ls_freqs and ls_power list-valued columns,

plus a grouping column (default cell_type).

smftools.analysis.plot.autocorr.plot_metric_barplot_paired(summary_df, metric_key, output_path, group_col='cell_type', group_order=None, group_labels=None, group_colors=None, ref_col='reference_strand', ref_order=None, ref_labels=None, ylabel='', title='', dpi=300, figsize=(4.0, 2.7))#

Paired barplot: x = group, paired bars = reference strands, dots = individual replicates.

First ref in ref_order is solid; second uses hatch "//".

Return type:

None

smftools.analysis.plot.autocorr.plot_metric_histogram(df, metric_key, output_path, group_col='cell_type', group_order=None, group_colors=None, group_labels=None, ref_col='reference_strand', ref_strand=None, ref_label='', xlabel='', title='', title_suffix='', bins=30, xlim=None, vlines=None, dpi=300, figsize=(4.5, 2.7))#

Overlaid per-group histograms (density-normalised) of a single-molecule metric.

Return type:

None

Parameters#

df : DataFrame with one row per read; needs metric_key, group_col, and optionally ref_col. metric_key : column to histogram, e.g. "ls_nrl_bp", "ls_snr", "ls_peak_power". ref_strand : if given (with ref_col), filter to this reference_strand value. vlines : x positions to mark with dotted vertical lines (e.g. NRL search-band boundary).