Skip to content

Commit

Permalink
fix #22 version bump to 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hcwinsemius committed Dec 10, 2024
1 parent d9aace8 commit 0ab1f27
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [0.1.2] - 2024-12-10
### Added
### Changed
* `api.cross_corr` now only reports possible memory issues when `verbose=True`

### Deprecated
### Removed
### Fixed
### Security


## [0.1.1] - 2024-12-01
### Added
* Additional documentation for FF-PIV API
Expand Down
2 changes: 1 addition & 1 deletion ffpiv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""FF-PIV: Fast and Flexible Particle Image Velocimetry analysis powered by numba."""

__version__ = "0.1.1"
__version__ = "0.1.2"

from . import pnb, pnp, sample_data, window
from .api import *
23 changes: 13 additions & 10 deletions ffpiv/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def cross_corr(
search_area_size: Optional[Tuple[int, int]] = None,
engine: Literal["numba", "numpy"] = "numba",
normalize: bool = False,
verbose: bool = True,
):
"""Compute correlations over a stack of images using interrogation windows.
Expand All @@ -175,6 +176,8 @@ def cross_corr(
The engine to use for calculation, by default "numba".
normalize : bool, optional
if set, each window will be normalized with spatial mean and standard deviation, and numbers capped to 0.
verbose : bool, optional
if set (default), warnings will be displayed if the amount of available memory is low.
Returns
-------
Expand Down Expand Up @@ -210,16 +213,16 @@ def cross_corr(
len(imgs), dim_size=dim_size, window_size=window_size, overlap=overlap, search_area_size=search_area_size
)
avail_mem = window.available_memory()
if avail_mem - req_mem < 0:
warnings.warn(
f"You have too little physical memory ({avail_mem / 1e9} GB) available for this problem. "
f"You may need {req_mem / 1e9} GB. ffpiv may slow down or crash! Reduce the amount of frames interpreted "
f"in one go.",
stacklevel=2,
)
# wait for a while so that user can read the message
time.sleep(1)
time.sleep(1)
if verbose:
if avail_mem - req_mem < 0:
warnings.warn(
f"You may have too little physical memory ({avail_mem / 1e9} GB) available for this problem. "
f"You may need {req_mem / 1e9} GB. ffpiv may slow down or crash! Reduce the amount of frames "
f" interpreted in one go.",
stacklevel=2,
)
# wait for a while so that user can read the message
time.sleep(1)
x, y, window_stack = subwindows(
imgs,
window_size=window_size,
Expand Down
2 changes: 1 addition & 1 deletion ffpiv/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def round_to_even(input_tuple: Tuple[int]):
return tuple((x + 1) if x % 2 != 0 else x for x in input_tuple)


def available_memory(safety=1e9):
def available_memory(safety=0.0):
"""Get available memory in bytes."""
return psutil.virtual_memory().free - safety # + psutil.swap_memory().free

Expand Down

0 comments on commit 0ab1f27

Please sign in to comment.