-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move tests on operators in folder. * ci: split the test with the operators folder. * test pynfft on local runner. * local runner setup pynfft2 * use venv * fix: skip 3D tests for slow transforms. * fix import * ci: remove pynfft from gpu 2D is done on CPU and is good enough.
- Loading branch information
Showing
8 changed files
with
55 additions
and
25 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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Specific test for gpunufft.""" | ||
|
||
import numpy as np | ||
import numpy.testing as npt | ||
from pytest_cases import parametrize, parametrize_with_cases | ||
|
||
from case_trajectories import CasesTrajectories | ||
from helpers import assert_correlate | ||
from mrinufft.density import cell_count, voronoi, pipe | ||
from mrinufft.density.utils import normalize_weights | ||
from mrinufft._utils import proper_trajectory | ||
|
||
|
||
def radial_distance(traj, shape): | ||
"""Compute the radial distance of a trajectory.""" | ||
proper_traj = proper_trajectory(traj, normalize="unit") | ||
weights = np.linalg.norm(proper_traj, axis=-1) | ||
return weights | ||
|
||
|
||
@parametrize("osf", [1, 1.25, 2]) | ||
@parametrize_with_cases( | ||
"traj, shape", | ||
cases=[ | ||
CasesTrajectories.case_nyquist_radial2D, | ||
CasesTrajectories.case_nyquist_radial3D, | ||
], | ||
) | ||
@parametrize(backend=["gpunufft"]) | ||
def test_pipe(backend, traj, shape, osf): | ||
"""Test the pipe method.""" | ||
distance = radial_distance(traj, shape) | ||
result = pipe(traj, shape, osf=osf, num_iterations=10) | ||
result = result / np.mean(result) | ||
distance = distance / np.mean(distance) | ||
if osf != 2: | ||
# If OSF < 2, we dont perfectly estimate | ||
assert_correlate(result, distance, slope=1, slope_err=None, r_value_err=0.2) | ||
else: | ||
assert_correlate(result, distance, slope=1, slope_err=0.1, r_value_err=0.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
File renamed without changes.
File renamed without changes.
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