Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hansalemaos/cythonsequencefinder
Module for finding sequences in arrays using Cython and NumPy.
https://github.com/hansalemaos/cythonsequencefinder
cython finder locate numpy sequence
Last synced: 24 days ago
JSON representation
Module for finding sequences in arrays using Cython and NumPy.
- Host: GitHub
- URL: https://github.com/hansalemaos/cythonsequencefinder
- Owner: hansalemaos
- License: mit
- Created: 2023-11-28T01:08:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-28T01:08:52.000Z (about 1 year ago)
- Last Synced: 2024-11-15T01:42:46.393Z (about 2 months ago)
- Topics: cython, finder, locate, numpy, sequence
- Language: Python
- Homepage: https://pypi.org/project/cythonsequencefinder
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Module for finding sequences in arrays using Cython and NumPy.
## pip install cythonsequencefinder
### Tested against Windows / Python 3.11 / Anaconda
### Cython (and a C/C++ compiler) must be installed to use the optimized Cython implementation.
```python
from time import perf_counter
import numpy as np
from cythonsequencefinder import np_search_sequence
from cythonsequencefinder import find_seqseq = np.array([1, 2, 4, 5], dtype=np.int32)
sequence_size = len(seq)
arr = np.random.randint(low=0, high=10, size=1000000, dtype=np.int32)
start = perf_counter()
rax = find_seq(arr, seq, distance=1)
print(perf_counter() - start)
start = perf_counter()
rax2 = np_search_sequence(arr, seq, distance=1)
print(perf_counter() - start)
# 0.004291800003557 - cython
# 0.007874400005675852 - numpy```