-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor deformation gradient generation and rotation
- Loading branch information
1 parent
8eded59
commit 2a72242
Showing
4 changed files
with
69 additions
and
24 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,19 +1,24 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from hyper_surrogate.deformation_gradient import DeformationGradientGenerator | ||
from hyper_surrogate.generator import Generator | ||
|
||
|
||
@pytest.fixture | ||
def def_gradient(): | ||
return DeformationGradientGenerator(seed=42, size=10) | ||
|
||
|
||
@pytest.fixture | ||
def generator(): | ||
return Generator(seed=42, size=10) | ||
def test_generate_def_grad(def_gradient): | ||
stretch = def_gradient.generator.uniform(0, 1) | ||
assert len(stretch) == 10 | ||
assert all(isinstance(x, float) for x in stretch) | ||
assert all(0 <= x <= 1 for x in stretch) | ||
assert isinstance(stretch, np.ndarray) | ||
assert isinstance(stretch[0], float) | ||
assert isinstance(stretch[1], float) | ||
|
||
|
||
# def test_generate_def_grad(def_gradient): | ||
# stretch = def_gradient.generate.uniform(1, 2) | ||
# logging.info(f"Stretch: {def_gradient.shear([2,1])}") | ||
# def test_generate_10_def_grad(def_gradient): | ||
# logging.info("Testing 10 deformation gradients") | ||
# logging.info(def_gradient.generate()) |
This file was deleted.
Oops, something went wrong.