quadsv.detectors.base#
Shared base class for single-sample spatial pattern detectors.
Concrete detectors follow a three-step workflow:
Construction —
Detector.__init__()takes kernel method + backend configs + kernel hyperparameters. No data is attached.Data setup —
Detector.setup_data()takes the input container (anndata.AnnDataforDetectorIrregular,spatialdata.SpatialDataforDetectorGrid), performs preprocessing (feature filtering, coordinate / obsp extraction, or rasterization), and builds the kernel.Computation —
Detector.compute_qstat()andDetector.compute_rstat()take feature selections + compute-time knobs (n_jobs,chunk_size, etc.) and return per-feature results.
The base class owns the attribute contract (kernel_method_,
kernel_params_, kernel_, n, _data_ready) and enforces the
workflow via _require_setup(). Concrete subclasses implement
_merge_kernel_defaults(), setup_data(), compute_qstat(),
and compute_rstat().
Classes#
Abstract base for single-sample pattern detectors. |
Module Contents#
- class quadsv.detectors.base.Detector(kernel_method, **kernel_params)[source]#
Bases:
abc.ABCAbstract base for single-sample pattern detectors.
- Variables:
kernel_method_ (str) – Kernel method name (e.g.
'matern','car'). Set at construction.kernel_params_ (dict) – Resolved kernel parameters after backend-specific defaults are merged with user overrides. Set at construction.
kernel_ (
Kernelor None) – Kernel object built insetup_data().Nonebefore data setup.n (int or None) – Effective number of observations after preprocessing.
Nonebefore data setup.
- Parameters:
kernel_method (str)
kernel_params (Any)
- abstract compute_qstat(features=None, **kwargs)[source]#
Univariate Q-test across
features.- Parameters:
features (list[str] | None)
kwargs (Any)
- Return type:
- abstract compute_rstat(**kwargs)[source]#
Bivariate R-test. Signature / feature selection are subclass-specific.
- Parameters:
kwargs (Any)
- Return type: