Skip to main content

selection tools

Project description

by

Selection tools for matching, pairing, and subsetting operations.

Installation

pip install by

Features

This package provides utilities for:

Nearest Neighbor Matching

Find nearest neighbors between point sets with optional radius constraints:

from by import gen_nearest_neighbor_matching_pairs

# Find matching pairs between query and reference points
query_points = [[1, 2], [3, 4], [5, 6]]
reference_points = [[1.1, 2.1], [3.2, 4.2], [10, 10]]

# Generate matches within a radius of 1.0
matches = list(gen_nearest_neighbor_matching_pairs(
    query_points, 
    reference_points,
    radius=1.0
))

Proximity-Based Pairing

Generate pairs from sorted iterables based on distance criteria:

from by import gen_of_close_pairs_from_iterables

# Find pairs from two lists that are within radius=2 of each other
list1 = [4, 7, 8, 11]
list2 = [5, 10, 15]

pairs = list(gen_of_close_pairs_from_iterables(list1, list2, radius=2))
# Result: [(4, 5), (8, 10)]

Interval-Based Selection

Select sublists that cover specified intervals:

from by import sublist_that_contains_segment

segments = [0, 5, 10, 15, 20, 25, 30]

# Find segments covering the interval [11, 21]
covering_segments = sublist_that_contains_segment(segments, 11, 21)
# Result: [10, 15, 20]

License

MIT

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

by-0.0.6.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

by-0.0.6-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file by-0.0.6.tar.gz.

File metadata

  • Download URL: by-0.0.6.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for by-0.0.6.tar.gz
Algorithm Hash digest
SHA256 5fb8ed929bf3db053cfb8cd759d83f682c730fdc98af193df0b349052269b062
MD5 f710536279817f6058ad11062afcf86c
BLAKE2b-256 6fcf8a8c6d8115ed9b8e2e8e5c265bada7618289be9a3a11c33006e5d84feb84

See more details on using hashes here.

File details

Details for the file by-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: by-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for by-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1fcf9b8d7f89e8851dcc9c2d7420859da9340aaafc18718d32b7449365944c1c
MD5 343653d3dbcd1529ab4adef4e30caaf3
BLAKE2b-256 f9d213f64e90b31efe4df713df96fda4b720c711320f33ca1ee4a13c3354711d

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