Paircorrelation2d
Python function to compute g(r) the 2D pair correlation function (or radial distribution function) of a set of points.
Install / Use
/learn @aberut/Paircorrelation2dREADME
paircorrelation2d 
paircorrelation2d is a Python module to compute the 2D pair correlation function (radial distribution function) g(r) for a set of points, corrected to take account of the boundary effects.
A more detailed explanation on the different type of corrections to take account of boundary effects can be found in Natsuda Klongvessa (Ong)'s PhD Thesis, section 3.3.1 (pages 51-52), available online: Study of Dense Assemblies of Active Colloids : collective Behavior and Rheological Properties.
Installation
Simply put the script in your working directory (or in any directory you added to your python path).
Usage
For the impatient
import matplotlib.pyplot as plt
from paircorrelation2d import pcf2d
#Assuming array_positions is a Nx2 numpy array containing the 2D coordinates of N points
#Assuming bins_distances is a Mx1 numpy array containing bin edges defining the values of r for which g(r) is going to be computed
[g_of_r,r]=pcf2d(array_positions, bins_distances)
plt.plot(r,g_of_r)
For the patient
See example.ipynb for a detailed presentation.
Requirements
- numpy (>=1.19)
- matplotlib (>=3.3)
- shapely (>=1.8)
Citation
If you would like to use this code in a scientific work, please cite as:
paircorrelation2d (v1.0), A. Bérut (2022). DOI: 10.5281/zenodo.19227289
License
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
