Skip to content
PointillViz
PointillViz

© 2026 PointillViz

Ripley’s Cross-L Function

by PointillViz reference tools

At what distance cell type B accumulates around cell type A.

Verifiedv1.1.0
  • cell types
  • point process
  • colocalization
  • scale
  • summary
  • series
  • table
Cross-L curve rising to a peak and leaving a null envelope
Cross-L curve rising to a peak and leaving a null envelopeArtwork from the tool’s bundle

Readme

Answers the question: At what distances does group B accumulate around or avoid group A?

The tool uses group A as the reference and measures the distances from its cells to cells from group B. It gradually increases a radius r around every A-cell and counts how many B-cells fall within that radius.

More specifically, let C(A,B)(r) be the number of observed A-to-B pairs separated by at most r. The cross-K function adjusts this count for the overall density ρ(B) of group B and for m(A)(r), the number of A-cells included at radius r:

Under complete spatial randomness, K(A,B)(r)=πr2. The tool transforms this comparison into a curve centered around zero:

Positive values indicate more B-cells around A than expected, while negative values indicate fewer.

Plot. The x-axis shows the radius r, and the y-axis shows L(A,B)(r)−r. The solid line is the observed curve; its peak indicates the spatial scale at which B is most strongly accumulated around A. The grey band comes from random redistributions of the B labels while keeping A fixed. Values above the band indicate enrichment of B around A, while values below indicate spatial avoidance.

Table. Each row represents one tested radius r. L(r) − r is the observed curve value, while Envelope low and Envelope high are the lowest and highest values from the random relabellings at that radius. Outside envelope indicates whether the observed value lies above or below this range; a blank entry means that it lies inside.

References

Ripley, B. D. (1977). Modelling spatial patterns. Journal of the Royal Statistical Society, Series B, 39(2), 172-212.

Parameters

ParameterTypeDefaultWhat it does
Grouping columnfield categorical_field optional Selects the annotation used to define the groups. Defaults to the dataset’s cell-type column.
Group A (reference)type_a category_value optional Selects the reference group from which distances are measured. Defaults to the most abundant group.
Group B (neighbour)type_b category_value optional Selects the group counted around group A. Defaults to the next most abundant group; A and B must differ.
Maximum radiusmax_radius float, 1–5,000 150 Sets the largest distance tested, in the dataset’s coordinate units. Keep it below about one quarter of the section’s shorter side to limit edge effects.
Radius stepsn_steps int, 4–200 30 Sets how many radii are tested between the smallest radius and the maximum radius. More steps produce a more detailed curve.
Simulationsn_sims int, 5–999 39 Sets how many random redistributions of the B labels are used to create the grey envelope. More simulations give a more stable envelope but increase runtime.
Observation windowwindow select, 2 options Convex hull of the cells Defines the tissue area used to calculate density and correct for edges. The convex hull suits irregular tissue, while the bounding box suits a rectangular imaging field.

Outputs

  • summarywrites a summary
  • seriesreturns a line chart
  • tablereturns a table

Tool check

The nine gates this version passed when it was published.

Verified

Passed 9 of 9 gates

  1. bundle pass
  2. manifest pass
  3. entry pass
  4. imports pass, advisory
  5. fixture pass
  6. result pass
  7. determinism pass
  8. edge pass
  9. no_mutation pass
  1. bundle pass

    4 files, 14.5 kB packed and 37.2 kB unpacked, plugin.json at the root.

  2. manifest pass

    ripley-cross-l 1.1.0 by PointillViz reference tools; entry tool.py, outputs summary, series, table, 120 s and 4096 MB budget.

  3. entry pass

    tool.py imported in 0.20 s and defines run(ds, params).

  4. imports advisory pass

    1 Python file, importing __future__, backend, hashlib, math, numpy, scipy; no network, subprocess, filesystem-write, dynamic-exec or environment use found.

  5. fixture pass

    ran on the 600-cell fixture in 0.30 s of its 120 s budget, returning summary, table, series and 2 log lines.

  6. result pass

    returned the declared outputs: summary, table, series.

  7. determinism pass

    two runs with identical parameters produced byte-identical results (4.8 kB of JSON).

  8. edge pass

    ran at the minimum corner (max_radius=1.0, n_sims=5, n_steps=4) in 0.53 s; ran at the maximum corner (max_radius=5000.0, n_sims=999, n_steps=200, window='bbox') in 0.94 s.

  9. no_mutation pass

    the fixture dataset's 4 files are byte-identical after every run (plugin_cache/, where ds.knn caches, is excluded by design).

Passed every required gate when this version was published. That is a statement about the gates, not about whether the code is safe to run.

Versions

  1. v1.1.0 latest
  2. v1.0.0

More tools