[GRASS-git] [OSGeo/grass] f5ebd7: v.ppa: Point Pattern Analysis (#3826)

Corey White noreply at github.com
Mon Aug 24 20:07:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: f5ebd74c5cf2a1c1fdeeee2c5cfa7702f7fdc2e1
      https://github.com/OSGeo/grass/commit/f5ebd74c5cf2a1c1fdeeee2c5cfa7702f7fdc2e1
  Author: Corey White <smortopahri at gmail.com>
  Date:   2026-08-24 (Mon, 24 Aug 2026)

  Changed paths:
    M gui/wxpython/xml/toolboxes.xml
    M vector/CMakeLists.txt
    M vector/Makefile
    A vector/v.ppa/Makefile
    A vector/v.ppa/doc_figures.py
    A vector/v.ppa/f_function.c
    A vector/v.ppa/g_function.c
    A vector/v.ppa/k_function.c
    A vector/v.ppa/local_proto.h
    A vector/v.ppa/main.c
    A vector/v.ppa/result.c
    A vector/v.ppa/tests/conftest.py
    A vector/v.ppa/tests/v_ppa_test.py
    A vector/v.ppa/v.ppa.html
    A vector/v.ppa/v.ppa.md
    A vector/v.ppa/v_ppa_f.png
    A vector/v.ppa/v_ppa_g.png
    A vector/v.ppa/v_ppa_k.png
    A vector/v.ppa/v_ppa_l.png
    A vector/v.ppa/v_ppa_patterns.png

  Log Message:
  -----------
  v.ppa: Point Pattern Analysis (#3826)

* v.ppa: Point Pattern Analysis

* Changed how vector ponits are counted

* Update vector/v.ppa/main.c

Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>

* Update vector/v.ppa/main.c

Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>

* Update vector/v.ppa/main.c

Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>

* Update vector/v.ppa/main.c

Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>

* Update vector/v.ppa/main.c

Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>

* Update vector/v.ppa/main.c

Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>

* Moved sqrt call outside of ec. distance loop

* Updated docs

* added random seed for random points

* updated g-function to return g-value under csr

* updated g-function docs

* Updated K and L functions and MC Sim

* Added base setup for JSON support

* Added tests

* Added json output to k and l functions

* Added markdown to fix build issue

* Updated docs

* v.ppa: Rework estimators, interface, and tests

Restructure the tool for core inclusion and fix correctness problems
found in review:

- Split main.c into per-function files (g_function.c, f_function.c,
  k_function.c, result.c) sharing local_proto.h.
- Use the computational region as the observation window for the
  intensity estimate, F function sampling, edge correction geometry,
  and default distance range. Points outside the region are ignored
  with a warning.
- Add Ripley's isotropic edge correction for the K and L functions
  (correction=isotropic|none, default isotropic), using the closed
  form for rectangular windows.
- Evaluate K and L up to max_distance (default one quarter of the
  shorter region side) instead of the O(n^2) pattern diameter, and
  estimate K with one radius query per point.
- Print results to standard output by default with
  format=plain|csv|json; JSON output is a records array with method,
  point count, intensity, window, and correction metadata. The output
  option optionally writes to a file for all methods.
- Fix correctness bugs: intensity truncated to int made the G CSR
  reference always zero, kdtree_knn was called with k=2 writing into
  scalars, duplicate coordinates were dropped from the k-d tree,
  omitting output crashed on fopen(NULL), and num_distances was
  ignored by the G and F functions.
- Remove the unfinished Monte Carlo envelope code and the simulations
  option; simulation envelopes are planned as a follow-up (see TODO
  in the manual).
- Add the nprocs and seed standard options; report all functions
  together with their theoretical values under CSR.
- Replace the gunittest testsuite and committed test data with pytest
  tests on seeded synthetic patterns that assert agreement with CSR
  theory, clustering detection, and edge correction behavior.
- Register the tool in vector/CMakeLists.txt and use grass/gjson.h
  instead of the removed grass/parson.h.
- Rewrite the manual pages.

The restructured estimators and the isotropic correction were
implemented with AI assistance; the correction was validated
numerically against a brute-force estimate of the circle fraction
inside the window, and the estimators against CSR theory on seeded
random patterns.

* v.ppa: Add manual figures for the summary functions

Add a pattern map figure (clustered, random, dispersed) rendered with
d.vect and one plot per function comparing the three patterns against
the CSR expectation. The figures are generated by the included
doc_figures.py script from seeded synthetic patterns, so they are
reproducible. Created with AI assistance.

* style: Format cmake files with Gersemi

* Add tool to the 'Vector Report and Statistics' and 'Point Analysis' toolboxes

---------

Co-authored-by: Corey White <ctwhite48 at gmail.com>
Co-authored-by: Loïc Bartoletti <lbartoletti at users.noreply.github.com>
Co-authored-by: Edouard Choinière <27212526+echoix at users.noreply.github.com>



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list