Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-14, macos-26]
os: [ubuntu-latest, windows-latest, macos-15, macos-26]
env-type: [pip]
include:
- os: macos-14
- os: macos-15
llvm: llvm@15
- os: macos-26
llvm: llvm@20
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-14, macos-26]
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-15, macos-26]
include:
- os: macos-14
- os: macos-15
llvm: llvm@15
macos_deployment_target: "14.0"
macos_deployment_target: "15.0"
- os: macos-26
llvm: llvm@20
macos_deployment_target: "26.0"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wheels_testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-14, macos-26]
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-15, macos-26]
include:
- os: macos-14
- os: macos-15
llvm: llvm@15
- os: macos-26
llvm: llvm@20
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = [
"matplotlib>=3.8",
"pyvista>=0.43.3",
"vtk>=9.5.2",
"netCDF4>=1.6.5",
"netCDF4==1.7.5",
"sympy>=1.13.0",
"PyQT6>=6.7.1",
"imageio>=2.36.1",
Expand Down
19 changes: 16 additions & 3 deletions src/pyvale/dic/_dicchecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ def _multiwindow_init(subset_size: int,
f"{multiwindow_search_area[i]} at index {i}")

overlap = [x * (1.0-multiwindow_overlap) for x in multiwindow_subset_size]
configured_overlap = list(map(int, overlap))
overlap.append(subset_step)
overlap = list(map(int,overlap))

# Avoid running the same final FFT level twice when size and overlap are identical
if (multiwindow_subset_size and
multiwindow_subset_size[-1] == subset_size and
multiwindow_search_area[-1] == subset_size and
configured_overlap[-1] == subset_step):
return configured_overlap, multiwindow_subset_size, multiwindow_search_area

multiwindow_subset_size.append(subset_size)
multiwindow_search_area.append(subset_size)

Expand Down Expand Up @@ -245,7 +253,9 @@ def _check_thresholds(threshold: float,
raise ValueError("Optimizer precision must be a float strictly "
"between 0 and 1.")

def _check_subsets(subset_size: int, subset_step: int) -> None:
def _check_subsets(subset_size: int,
subset_step: int,
method: str | None = None) -> None:
"""
Parameters
Expand All @@ -254,6 +264,9 @@ def _check_subsets(subset_size: int, subset_step: int) -> None:
Threshold for the Levenberg optimization method.
subset_step : int
Threshold for the brute-force optimization method.
method : str, optional
Scan method. Even subset sizes are supported by the FFT-only
``MULTIWINDOW`` method, but remain disallowed for the other methods.
Raises
------
Expand All @@ -262,8 +275,8 @@ def _check_subsets(subset_size: int, subset_step: int) -> None:
"""


# Enforce scalar types for non-FFT methods
if subset_size % 2 == 0:
# The FFT-only multiwindow path handles even-sized subsets explicitly.
if subset_size % 2 == 0 and method != "MULTIWINDOW":
raise ValueError("subset_size must be an odd number.")

# check if subset_step is larger than the subset_size
Expand Down
2 changes: 1 addition & 1 deletion src/pyvale/dic/dic2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def calculate_2d(reference: np.ndarray | str | Path,

dicchecks._check_thresholds(threshold, precision)
common_util.check_output_directory(str(output_basepath), output_prefix, print_level)
dicchecks._check_subsets(subset_size, subset_step)
dicchecks._check_subsets(subset_size, subset_step, method_enum.value)
updated_seeds = dicchecks._check_and_update_rg_seed(seed, roi_mask, method_enum.value, w, h, subset_size, subset_step)
num_params = dicchecks._check_shape_function(shape_function_enum)

Expand Down
6 changes: 4 additions & 2 deletions src/pyvale/dic/dic3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def calculate_3d(reference: list[np.ndarray] | list[str] | list[Path],
the existing flat format ``[x0, y0, x1, y1, ...]`` or tuple format
``[(x0, y0), (x1, y1), ...]``. If the method is not RG, this will be ignored.
subset_size : int, optional
Size of the square subset window in pixels (default: 21).
Size of the square subset window in pixels (default: 21). Must be odd
except for the FFT-only ``"MULTIWINDOW"`` method, which also supports
even sizes.
subset_step : int, optional
Step size between subset centers in pixels (default: 10).
correlation_criteria : str, optional
Expand Down Expand Up @@ -323,7 +325,7 @@ def calculate_3d(reference: list[np.ndarray] | list[str] | list[Path],
# checks on the config
dicchecks._check_thresholds(threshold, precision)
common_util.check_output_directory(str(output_basepath), output_prefix, print_level)
dicchecks._check_subsets(subset_size, subset_step)
dicchecks._check_subsets(subset_size, subset_step, method_enum.value)
updated_seeds = dicchecks._check_and_update_rg_seed(seed, roi_mask, method_enum.value, w0, h0, subset_size, subset_step)
num_params = dicchecks._check_shape_function(shape_function_enum)

Expand Down
4 changes: 2 additions & 2 deletions tests/dic/test_dic.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ def test_2d_multiwindow_fft_large(dic_temp_dir: Path) -> None:
deformed=def_large,
roi_mask=roi_rigid.mask,
seed=seed,
subset_size=31,
subset_step=15,
subset_size=32,
subset_step=16,
max_displacement=100,
correlation_criteria="ZNSSD",
shape_function="RIGID",
Expand Down
Loading