-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish tests for Mie simulation (close #1)
- Loading branch information
1 parent
c9ba15c
commit 25efd67
Showing
5 changed files
with
124 additions
and
48 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import numpy as np | ||
|
||
from qpsphere.models import mie | ||
|
||
|
||
def test_basic(): | ||
data = np.array([0.61718511, 0.63344636, 0.39500855, | ||
0.62834482, 0.5612372, 0.24405929, | ||
0.39808633, 0.24597916, -0.00504312]) | ||
|
||
qpi = mie(grid_size=(3, 3), | ||
center=(0, 0), | ||
pixel_size=2e-6) | ||
assert np.allclose(data, qpi.pha.flatten()) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Run all tests | ||
loc = locals() | ||
for key in list(loc.keys()): | ||
if key.startswith("test_") and hasattr(loc[key], "__call__"): | ||
loc[key]() |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import numpy as np | ||
|
||
from qpsphere.models import projection | ||
|
||
|
||
def test_basic(): | ||
data = np.array([0.6854384, 0.62821467, 0.41126304, | ||
0.62821467, 0.56522698, 0.30653737, | ||
0.41126304, 0.30653737, 0.]) | ||
|
||
qpi = projection(grid_size=(3, 3), | ||
center=(0, 0), | ||
pixel_size=2e-6) | ||
assert np.allclose(data, qpi.pha.flatten()) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Run all tests | ||
loc = locals() | ||
for key in list(loc.keys()): | ||
if key.startswith("test_") and hasattr(loc[key], "__call__"): | ||
loc[key]() |