Skip to main content

finds sequences [3, 4, 5] in NumPy arrays [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] - result: [2 7]

Project description

finds sequences [3, 4, 5] in NumPy arrays [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] - result: [2 7]

Tested against Windows 10 / Python 3.10 / Anaconda

pip install stridessequencefinder

Find occurrences of a sequence in a 1-dimensional NumPy array using a rolling window approach.

Parameters:
sequence (numpy.ndarray): The sequence to search for.
array (numpy.ndarray): The input array to search within.
numexpr_enabled (bool, optional): Whether to use NumExpr for efficient computation (default is True).

Returns:
numpy.ndarray: An array of indices where the sequence is found in the input array.

Example:
>>> arr = np.array([1, 2, 3, 4, 5, 1, 2, 3, 4, 5])
>>> seq = np.array([3, 4, 5])
>>> indices = find_sequence_in_array(seq, arr)
>>> print(indices)
[2 7]

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

stridessequencefinder-0.10.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

stridessequencefinder-0.10-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file stridessequencefinder-0.10.tar.gz.

File metadata

  • Download URL: stridessequencefinder-0.10.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for stridessequencefinder-0.10.tar.gz
Algorithm Hash digest
SHA256 5dfe04a982dd449b54b29cad45bb3282e7012c75e321b8b329e13959f6c67ff8
MD5 f8d44b6f56ee3ca434f2c87e0ce8bc9d
BLAKE2b-256 9cd2834452ffb54ad22fea6a88a80d96abe7da396b1af8ace8421170d87cedce

See more details on using hashes here.

File details

Details for the file stridessequencefinder-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for stridessequencefinder-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 8a665a1ab59d2ce60c9445d2c669db349403810f49af432d32c43d30517caaf3
MD5 fc4707c82688b2d38d63ea36d2061281
BLAKE2b-256 1d0d3ca26a24a77d7313a004f61df18c7945d99c387076df20505e6b0e7d759d

See more details on using hashes here.

Supported by

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