Skip to main content

C++ spatial scan wrapper for Python

Project description

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

pip install pyscan-stats

Documentation

  1. Read the original documentation at https://michaelmathen.github.io/pyscan/
  2. 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 in 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

  1. git clone https://github.com/simonpedrogonzalez/pyscan.
  2. Install uv package manager if not already installed.
  3. Install CMake, Boost, GSL, CGAL if not already installed. For example, on Mac:
    brew install cmake boost gsl cgal
    
  4. Run make init to create a Python 3.12 venv in .venv and install dev dependencies.

You are all set to start developing! The following utility commands are available:

  • make cpp: compiles C++ code into the build/ 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: removes build/, dist/ and packaging artifacts.

Notes: If an error occurs executing one of the commands, try:

  • Manually activating the venv source .venv/bin/activate and running the command again.
  • Running make clean before make cpp to ensure a clean build.
  • This setup was tested both on macOS and Linux.

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscan_stats-1.0.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyscan_stats-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp313-cp313-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

pyscan_stats-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp312-cp312-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

pyscan_stats-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp311-cp311-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

pyscan_stats-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp310-cp310-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

pyscan_stats-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp39-cp39-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

pyscan_stats-1.0.0-cp38-cp38-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyscan_stats-1.0.0-cp38-cp38-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.8macOS 14.0+ ARM64

File details

Details for the file pyscan_stats-1.0.0.tar.gz.

File metadata

  • Download URL: pyscan_stats-1.0.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pyscan_stats-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3a3cb4f674921aae1b0252a0abeb68b46f33582592cdfb26e54667b4d63728e1
MD5 428bcce31b75c7c045ce6aa27bf81230
BLAKE2b-256 39364187a5bc4d19327f3215743a0c647b16c443a82a22a54c052fcca4de9f0e

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c7d83c914d2339d3d12b60f396dd8a8ff91e94a62d5499e721d4faa45e5b091
MD5 687348cbde6a22c3c0a39e1b3b14552c
BLAKE2b-256 39aa673c7550cb3182ede7d81696cf4dd2fc77006b22fb0a9776d2c57f98d302

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a2dd7dbdfa3426468114cfea295eb35d14509724903d0a6d0f02084b73c34fdc
MD5 ab1a603108b4f0e8da349d1d0f055c1b
BLAKE2b-256 744117bf06c183fd50c70e23bf174ec896c811d514c3ea1a924b9e3dbfc7c695

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 64cd93d7a02cc98033e012919202dcb9d4f1b65258651ff5684b7e33da0ed31b
MD5 748e7e45d27ca12aaff471866800acd3
BLAKE2b-256 42b0011a87a5e6e45d1ca84093bae8514db65f37842378e449c3a336ef3fd21e

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 823246c6942412ba21de330a3e70aac78e42004ac177006a37c46de9ef8845ae
MD5 0dc0e2ca97b92763c3161d43abfdde38
BLAKE2b-256 bae430ea222877ae0f5f04b7252083699ebf089e37bf788e6185f074c2ab2551

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb5de22609caddcf8338455f55bbdb71bb555071a449d1b32bcbcfad23d91131
MD5 1717c9ae1c6abe841118c0b90a76b6b2
BLAKE2b-256 f87b9719a02cc796fed2b87ae2790082429eaea4a6d007641e80ac7ae504a012

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 cc4fb78187c5619d2c2bafccb5029de27f8646fa7b323a958d7871e5c145746a
MD5 fda1d80c5fe0b4237891ec2c376204a7
BLAKE2b-256 e0111de3b1f898062b2371831e262aeb8507ee8d38f632cc18957cc3c8f8617e

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad5d471e9f0d00bfdc953b5d04226355a8ca38539c621cb765432c28e2bab63e
MD5 5796b115de3e85ef13cf1b87c39bd37b
BLAKE2b-256 7ea718a7d7e144022c9f9fc352e544b8a83e6c875184e1f15cdb6b97760a7c99

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bfb090ca762588ea4ffade76d0694622094873775ac2b7a5fd6aa2c97f376da8
MD5 35919d42c9a17f4a7d3d0cb5416b5fa9
BLAKE2b-256 3ac53ea47661bb31f6b84ec0334869e5f47a5ffc3eadb745eecd150a120a80ff

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b2cb31151ac1e9a5049d23a28fd806e5251cdf38618a1780d0c9ab59144457fe
MD5 8591c3b80dfe3740fb7fdd10865aaa04
BLAKE2b-256 3473c9a0fe75398ada93c233cc324f0f523f9b57259632b859f0598b1ded3bd8

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88b0dc4953fa5f9ca771ab13e5af7590218aad67a40d8340b62e9c94701d03f1
MD5 089a7fc3b8cdd136824bc7c5c1cba533
BLAKE2b-256 1bc93b406788dff6cecbcb748406798df4108dca085f450e1fda80d927981792

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 048500f080c16d329804fa539349347b2b80aef04ddee02b0514038d08f4c6fd
MD5 444e21ce9a23d98dacbac640d0ff31ff
BLAKE2b-256 6e7f4f98635b26ff0fc5537dca8b74d2b14559b1822c35e91d8614d005a397f5

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a578727650f7a75f4fe84ca9b331cfa625f7c339c8ba90fd175c3a6e589e31f6
MD5 7d5b49303cfada8caa8460d0397d4ec5
BLAKE2b-256 6772011ea8ba76686eb3c1f73872e4702b5286312761009109a124f3b929691a

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fdd1faa705cbbaee75a8309cf8816815b4f392712f477428d2dd425a9a6c3222
MD5 46fcd573c445222dc66404b8d851abd5
BLAKE2b-256 125503137b25a4a2e6736e0d0adcdef043866eaad10207506bba69eaa56760bc

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b69986459c66c3384ecd08f3b7099b19dff73516251560d965593bef809c44fa
MD5 e2e4fc22639f4833e9cea1dce08881c3
BLAKE2b-256 b0bd6408e6eb78a6949a80bbfa884414a9b06b1565ede99d041587d15791d7b1

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ea8b41c9002d0a16d38e0d44e3920e9e07a404934d3ff95109f3f367fa44382e
MD5 caf9f3cb58fd16573d000e205af2b942
BLAKE2b-256 479067700c588e17bbb6ab4ba125f8b18d91125dbce024d94d37a1c1f81a9f0c

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 54e7634e7c406ec719374b54d7ced335bc84b5353a9c04d0ac61b342718a1acf
MD5 68372c89ca3f7b5536c89eff8444a9c4
BLAKE2b-256 6a411f86978e0801c7be81b10630d971a843e6a2a0eef7c9ef8a416c4baf443d

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 57db62c53b72f7be7772e78c1cf0cfc90adc40b4e3b46b40715e7e474c49befb
MD5 bf818bcb7169837a9846dd178869efb4
BLAKE2b-256 7f65284851acded1f9bb8f6e5dc06f2d0bda2c4f8e0e1d805ffcd9d28d8127c3

See more details on using hashes here.

File details

Details for the file pyscan_stats-1.0.0-cp38-cp38-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyscan_stats-1.0.0-cp38-cp38-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 24fa24b5c6b4f3309f7da287919ed233975fb43f53187df09cac58c1e7e0580e
MD5 7a40934ae4a911d0b3594fe713bcee28
BLAKE2b-256 38ab5645b5275d9cb4a7a747413a992f7985b6e4da2e6891d519012ef93f983e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page