Skip to main content

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

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.7.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.7-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: by-0.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 4c04e59622885b80b3c49f2fe3dde54cfe9f3ee07cd43c96c6072d8c580f67f5
MD5 30fd3cab477eafba4f9c03a69b307d16
BLAKE2b-256 c1899064e563848648e97b4cfa6cad5d6020b9d77aa000867ae36c9d3a6f440e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: by-0.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 73af2e919206ac683b6c04be7b2a3b5b0af9824ff407211dc7fa9ea314fde2d6
MD5 87d43ea8e470481881d97af6a2ff0868
BLAKE2b-256 97cca1241912c7a4891208d5f67f9fd6f867ef9b99cd4806e595f8dd626182c9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

Supported by

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