-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
67 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
import numpy as np | ||
|
||
def fill_zero_bytes(array: np.ndarray) -> None: | ||
"""Fill the zero bytes of the array with zeros.""" | ||
"""Fill the zero bytes of the array with zeros. | ||
def apply_cache(data: np.ndarray, cache: list[np.ndarray], mask: np.ndarray) -> None: | ||
This function is 2x faster compared to the `data.fill(0.0)` method. | ||
Args: | ||
array: The array to fill with zero bytes. | ||
""" | ||
|
||
def apply_cache( | ||
data: np.ndarray, | ||
cache: list[np.ndarray], | ||
mask: np.ndarray, | ||
nthreads: int = 1, | ||
) -> None: | ||
"""Apply the cache to the data array. | ||
Main purpose of this function to do it in one go and release the GIL. | ||
Args: | ||
data: The data array, ndim=2 with NxM shape. | ||
cache: List of arrays with ndim=1 and M shape. | ||
mask: The mask array, ndim=1 with N shape of np.bool type. | ||
nthreads: The number of threads to use. Default is 1. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters