quadsv.comparators.grid
=======================

.. py:module:: quadsv.comparators.grid

.. autoapi-nested-parse::

   :class:`ComparatorGrid` — cross-sample pattern comparison on a list of
   :class:`spatialdata.SpatialData` (regular rasterized bins, FFT
   backend).



Classes
-------

.. autoapisummary::

   quadsv.comparators.grid.ComparatorGrid


Module Contents
---------------

.. py:class:: ComparatorGrid(samples, *, bins, table_name, col_key, row_key, value_key = None, gene_names = None, feature_mode = 'radial', n_radial_bins = 30, fft_solver = 'rfft2', workers = None, spacing = None, freq_edges = None, presence_threshold = 0.0, fft_chunk_size = 256)

   Bases: :py:obj:`quadsv.comparators.base._ComparatorBase`


   Cross-sample pattern comparison on regular bins via FFT + SpatialData.

   Accepts a list of :class:`spatialdata.SpatialData` (one per sample). For
   each sample, :func:`spatialdata.rasterize_bins` turns the designated bin
   shape + table into a dense ``(n_genes, ny, nx)`` image, which is then fed
   to the batched 2D FFT. All samples are expected to share the same
   rasterization schema (``bins`` / ``table_name`` / ``col_key`` / ``row_key``
   / ``value_key``) — this mirrors :class:`~quadsv.DetectorGrid`.

   :param samples:
   :type samples: sequence of :class:`spatialdata.SpatialData`
   :param bins: SpatialElement key for the bin shapes in each ``sdata``.
   :type bins: str
   :param table_name: Table key in each ``sdata.tables``.
   :type table_name: str
   :param col_key: Column / row-index columns in the table's ``.obs``.
   :type col_key: str
   :param row_key: Column / row-index columns in the table's ``.obs``.
   :type row_key: str
   :param value_key: Expression column in ``.obs``; defaults to ``None`` (rasterizes counts
                     / presence directly off ``.X``).
   :type value_key: str, optional
   :param gene_names: If None, inferred from the first sample's table. All samples must
                      share ``var_names``.
   :type gene_names: sequence of str, optional
   :param fft_chunk_size: Genes per batched ``scipy.fft`` call on the rasterized block. Keeps
                          transient memory bounded at ``O(ny · nx · chunk · 8 B)``. The raster
                          itself is still built once per sample (full ``(n_genes, ny, nx)``
                          footprint is unavoidable on SpatialData).
   :type fft_chunk_size: int, default 256

   :param feature_mode: See :class:`_ComparatorBase`.
   :param n_radial_bins: See :class:`_ComparatorBase`.
   :param fft_solver: See :class:`_ComparatorBase`.
   :param workers: See :class:`_ComparatorBase`.
   :param freq_edges: See :class:`_ComparatorBase`.
   :param presence_threshold: See :class:`_ComparatorBase`.

   .. rubric:: Notes

   The comparator carries no design / contrast state — supply the
   cross-sample contrast directly to :meth:`test_diff_freq` /
   :meth:`test_diff_expr`. A single fitted comparator can therefore
   serve any number of unrelated comparisons on the same spectra.


   .. py:attribute:: feature_mode
      :value: 'radial'



   .. py:attribute:: freq_edges
      :value: None



   .. py:attribute:: gene_names


   .. py:attribute:: samples


