spacr.timelapse
Module Contents
- spacr.timelapse.analyze_calcium_oscillations(db_loc, measurement='cell_channel_1_mean_intensity', size_filter='cell_area', fluctuation_threshold=0.25, num_lines=None, peak_height=0.01, pathogen=None, cytoplasm=None, remove_transient=True, verbose=False, transience_threshold=0.9)[source]
- spacr.timelapse.create_results_figure()[source]
- Create a Figure with 3 subplots arranged as:
PCA (top-left)
XGBoost (top-right)
Histogram (bottom spanning both columns)
- Returns:
fig (Figure)
ax_pca, ax_xgb, ax_hist (matplotlib.axes.Axes)
- spacr.timelapse.automated_motility_assay(settings)[source]
End-to-end:
Read merged/*.npy (plate_well_field_time.npy)
Build intensity + cell/nucleus/pathogen masks, derive cytoplasm
Per cell & frame: metadata + cell regionprops
Aggregate child (nucleus/pathogen/cytoplasm) features per cell
Concatenate across all merged files
Clean impossible jumps + measurement glitches
Save per-cell measurements to SQLite DB (measurements/measurements.db, table=db_table_name) This table is always the original, pre-QC measurements.
Compute per-track velocities (after smoothing)
Save a well-level motility summary table in the same DB
Generate panel plots combining intensity + motility: - original (mask-based) infection labels - adjusted infection labels (if QC modifies labels)
Optional infection intensity QC based on pathogen channel.
New-relevant settings (all optional):
# Infection QC / strategy ‘infection_intensity_qc’: True/False ‘infection_intensity_strategy’: one of
{‘xgboost’, ‘histogram’, ‘pca’, ‘umap’, ‘tsne’}
‘infection_intensity_mode’: {‘relabel’, ‘remove’} # existing
# XGBoost ambiguous-band filtering (track-level) ‘infection_xgb_drop_ambiguous’: True/False (default True) ‘infection_xgb_ambiguous_low’: 0.25 (default) ‘infection_xgb_ambiguous_high’: 0.75 (default) ‘infection_xgb_proba_column’: ‘name_of_proba_col’ # optional override
# Histogram strategy ‘infection_hist_percentile’: 25 # used inside _apply_infection_intensity_qc
# Panel toggles ‘make_mask_panel’: True/False (default True) ‘make_adjusted_panel’: True/False (default True)
# Plot ranges (unchanged) - ‘motility_xlim’, ‘motility_ylim’ - ‘motility_origin_xlim’, ‘motility_origin_ylim’
# Measurements reuse ‘reuse_existing_measurements’: True/False (default True)