Skip to main content

GriSPy (Grid Search in Python)

logo

PyPi Version Build Status Documentation Status Coverage Status License: MIT Python 3.10+ PyPI downloads

ascl:1912.013 arXiv https://github.com/leliel12/diseno_sci_sfw

GriSPy is a regular grid search algorithm for quick nearest-neighbor lookup.

This class indexes a set of k-dimensional points in a regular grid providing a fast aproach for nearest neighbors queries. Optional periodic boundary conditions can be provided for each axis individually.

GriSPy has the following queries implemented:

  • bubble_neighbors: find neighbors within a given radius. A different radius for each centre can be provided.
  • shell_neighbors: find neighbors within given lower and upper radius. Different lower and upper radius can be provided for each centre.
  • nearest_neighbors: find the nth nearest neighbors for each centre.

Usage example

Let's create a 2D random distribution of points as an example:

import numpy as np
import grispy as gsp

data = np.random.uniform(size=(1000, 2))
grid = gsp.GriSPy(data)

The grid object now has all the data points indexed in a grid. Now let's search for neighbors around new points:

centres = np.random.uniform(size=(10, 2))
dist, ind = grid.bubble_neighbors(centres, distance_upper_bound=0.1)

And that's it! The dist and ind lists contain the distances and indices to data neighbors within a 0.1 search radius.


Requirements

You will need Python 3.11 or later to run GriSPy.

Standard Installation

GriSPy is available at PyPI. You can install it via the pip command

$ pip install grispy

Development Install

Clone this repo and then inside the local directory execute

$ pip install -e .

Citation

If you use GriSPy in a scientific publication, we would appreciate citations to the following paper:

Chalela, M., Sillero, E., Pereyra, L., García, M. A., Cabral, J. B., Lares, M., & Merchán, M. (2020). GriSPy: A Python package for fixed-radius nearest neighbors search. 10.1016/j.ascom.2020.100443.

Bibtex

@ARTICLE{Chalela2021,
       author = {{Chalela}, M. and {Sillero}, E. and {Pereyra}, L. and {Garcia}, M.~A. and {Cabral}, J.~B. and {Lares}, M. and {Merch{\'a}n}, M.},
        title = "{GriSPy: A Python package for fixed-radius nearest neighbors search}",
      journal = {Astronomy and Computing},
     keywords = {Data mining, Nearest-neighbor search, Methods, Data analysis, Astroinformatics, Python package},
         year = 2021,
        month = jan,
       volume = {34},
          eid = {100443},
        pages = {100443},
          doi = {10.1016/j.ascom.2020.100443},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2021A&C....3400443C},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

Full-text: https://arxiv.org/abs/1912.09585

Authors

Martin Chalela (E-mail: mchalela@unc.edu.ar), Emanuel Sillero, Luis Pereyra, Alejandro Garcia, Juan B. Cabral, Marcelo Lares, Manuel Merchán.

Release files for grispy 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grispy 0.3.0
File Size Uploaded
grispy-0.3.0.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grispy 0.3.0
File Interpreter ABI Platform
grispy-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.5 kB

Release files / grispy-0.3.0.tar.gz

Download URL grispy-0.3.0.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e0c94b0891cf969ebfe0661bf76a29ba5754d92ce91584daa55573893a749d6b
BLAKE2b-256 checksum
How to use checksums
b2323d5d78a75acf31d781f325bace333f2f1d88fcdbdd0b65f32c6fca798695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / grispy-0.3.0-py3-none-any.whl

Download URL grispy-0.3.0-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
152217310fc39f643a6f33e76f630649fb1f0e3213e4afa001958efab3cc7369
BLAKE2b-256 checksum
How to use checksums
fa2b776742ec00ed1c39e372db67ce6011cfa65f670e8a547165bacde2791801
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

1 release file

0.1.0

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page