pyscan-stats
pyscan-stats is a Python package for spatial scan statistics, created from a fork of the original pyscan library by Michael Matheny.
User Installation
Wheels for Linux and macOS 14+ are available on PyPI. To install, run:
pip install pyscan-stats
Documentation
- Read the original documentation at https://michaelmathen.github.io/pyscan/
- Ready to run examples with data are available at: https://github.com/simonpedrogonzalez/pyscan-stats-resources
New Features
Faster Numpy-based Net Grid Constructor
grid = pyscan.Grid(
unique_xs, unique_ys, # (N,) numpy arrays of sorted unique x and y coordinates
m_arr, b_arr # (N, 3) numpy arrays (x, y, weight)
)
Removes the burden of instantiating in Python the pyscan.WPoint for each data point, which can be slow for larger datasets.
Area-Limited Max Convex Subgrid Scan
prec = 1e-3
disc_f = pyscan.RKULLDORF
max_area = 750 # Maximum number of pixels in the subgrid
max_subgrid = pyscan.max_subgrid_convex(grid, prec, disc_f, max_area)
Allows for specifying a maximum area for the subgrid, useful when the interest is in smaller anomalies or when computational resources are limited. Usage example here. The implementation uses a sliding window version of Kadane's algorithm.
Improvements
- Support for new Python versions (3.10+)
- Project dependency update and organization for easier extension and maintenance.
- Updated examples.
Dev installation
git clone https://github.com/simonpedrogonzalez/pyscan.- Install
uvpackage manager if not already installed (you can use other package managers). - Install CMake, Boost, GSL, CGAL if not already installed. For example, on Mac:
brew install cmake boost gsl cgal
- Run
make initto create a Python 3.12 venv in.venvand install dev dependencies.
You are all set to start developing! The following utility commands are available:
make cpp: compiles C++ code into thebuild/directory.make py: builds the Python package and installs it in the venv, with the last compiled cpp binaries.make test: runs the C++ tests, only works after compiling the C++ code.make clean: removesbuild/,dist/and packaging artifacts.
Notes: If an error occurs executing one of the commands, try:
- Manually activating the venv
source .venv/bin/activateand running the command again. - Running
make cleanbeforemake cppto ensure a clean build. - This setup was tested both on macOS (15.6, M2) and Linux (Ubuntu 20.04).
About pyscan
Pyscan is a python wrapper around a large number of anomaly detection algorithms written in c++. These algorithms are from several papers by Jeff M. Phillips, Michael Matheny, Dong Xie, Mingxuan Han, Raghvendra Singh, Liang Zhang, Kaiqiang Wang, Deepak Agarwal, Andrew McGregor, Suresh Venkatasubramanian and Zhengyuan Zhu:
- The Kernel Scan Statistic
- Scalable Spatial Scan Statistics for Trajectories
- Computing Approximate Statistical Discrepancy
- Scalable Spatial Scan Statistics through Sampling
- Spatial Scan Statistics: Approximations and Performance Studies
- The Hunting of the Bump: On Maximizing Statistical Discrepancy
🛠️ Need Help?
Things never go as planned! Feel free to reach out:
Metadata
Release files for pyscan-stats 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyscan_stats-1.0.2.tar.gz | 14.3 MB | Details |
Built distributions (wheels)
Total release size: 38.2 MB
Release files / pyscan_stats-1.0.2.tar.gz
| Download URL | pyscan_stats-1.0.2.tar.gz |
|---|---|
| Size | 14.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a92ea7f25b73519538a9d511d415fecf12aae06ef23673d488f58d2f55b62d65
|
|
BLAKE2b-256 checksum How to use checksums |
a55f2c3917cc4b4e15d7725bda708082c477012bf42907c3cc2124ba4ed05512
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | pyscan_stats-1.0.2-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
fa19b2bcd371784e0ae48468d51de966ec7c065dbc14ffbe6371bf606de3de8f
|
|
BLAKE2b-256 checksum How to use checksums |
7ec8502316f4bbbb299cbaebec082dd41730074d54f6d710dc32b7cadf1ae7c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | pyscan_stats-1.0.2-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f56e932685ecacdeb38617087d17a5cd8c2f2d5a6c5705e3afb864d27277e8f6
|
|
BLAKE2b-256 checksum How to use checksums |
718b4443c11df75078cbb592a8e9c608d0143a97279e453580fddb10479b2fd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | pyscan_stats-1.0.2-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c7a3cce9916fbac44236012a5f6826dc38ff64be64b9d9aa6d2e04d5228310a1
|
|
BLAKE2b-256 checksum How to use checksums |
4a8c22c4b03f80ccbbab264b9334bd8670db2883aeaedf321de4c16c9d7df5ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | pyscan_stats-1.0.2-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b19d7e05ce9f415f982c6a663a1fe68c1a6f8cd7b11688686f9f573db45d9804
|
|
BLAKE2b-256 checksum How to use checksums |
3ae7da3c160dffd8dc625a3d05c584c8d440110e0d29617d0ec6296f18cc7f1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | pyscan_stats-1.0.2-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
300c567d920437b04e130f6da854ddad2e6ecc02ee05e7cdaa4cec9437fedaf5
|
|
BLAKE2b-256 checksum How to use checksums |
3814de6f56342aae2df5b3a7f4d4e88203635b3761f725d3d2d255fed5592fc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | pyscan_stats-1.0.2-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
26318162798de87c7f8d07b1083bf97c1f37328a8b4af43490f5ef9c5e8029d7
|
|
BLAKE2b-256 checksum How to use checksums |
4e5b14a2d73de5dd5e9906e165e5b629b9faab145eb88e08263dd308dee05456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pyscan_stats-1.0.2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
384e3b858d344623f2dfb949dfda5c56a42ea00156da0f65e04c7c3812ed548a
|
|
BLAKE2b-256 checksum How to use checksums |
3f320b84ac237495431b4ed440a1e30b1a4e0c87794d37f53cc737e814aaa002
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | pyscan_stats-1.0.2-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
41b62c0a86769270449f50eb4ca26337bc86a5ab117984b6f87d4cb2f2f1d5ea
|
|
BLAKE2b-256 checksum How to use checksums |
62eae0e1a9f79b1568f87b7c75344eb9c4ff5dd100779a2c7bb3df4a37d29f39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | pyscan_stats-1.0.2-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ab2ba92396b5e2aebbf8cb85b266148e80ea0f7cc7072209c57ce22823115a4f
|
|
BLAKE2b-256 checksum How to use checksums |
7b933a8c24f24ac3a988973c76ac3f612c6990b2f8816e0b0fb51426467b88cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp39-cp39-macosx_14_0_arm64.whl
| Download URL | pyscan_stats-1.0.2-cp39-cp39-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.9 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9f748f978932bdb957b028da8627c85f3ee5f955b15a4babe587445871df50bd
|
|
BLAKE2b-256 checksum How to use checksums |
49c2596d4197e32012ed412b7cc02cedca65f20747670271e222ac4c90e0e7ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp38-cp38-manylinux_2_28_x86_64.whl
| Download URL | pyscan_stats-1.0.2-cp38-cp38-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
560f4f2367d1e27e3864bd32eb64bdad948a399973c55f24c7cd1bf2ec81c9cb
|
|
BLAKE2b-256 checksum How to use checksums |
e9c72dc055e55d0c281516781b27a6c748aeffc4236eea5c18c6a6852b388d61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / pyscan_stats-1.0.2-cp38-cp38-macosx_14_0_arm64.whl
| Download URL | pyscan_stats-1.0.2-cp38-cp38-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.8 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f755b1f0ee480597d7ecd05f1b25a45e0fb9145182e27d18fbe33158aa5363bb
|
|
BLAKE2b-256 checksum How to use checksums |
81303691ab93c3176053f59974eadbcb9d3df76f2eae8e79cbe21ba04de1e320
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|