Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add CPO strength output for Fraters2021 test #170

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions tests/test_simple_shear_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from pydrex import core as _core
from pydrex import diagnostics as _diagnostics
from pydrex import geometry as _geo
from pydrex import io as _io
from pydrex import logger as _log
from pydrex import minerals as _minerals
Expand Down Expand Up @@ -138,6 +139,9 @@ def test_direction_change(
olA_from_proj_YX = np.empty_like(olA_from_proj_XZ)
ens_from_proj_XZ = np.empty_like(olA_from_proj_XZ)
ens_from_proj_YX = np.empty_like(olA_from_proj_XZ)
# Output arrays for M-index (CPO strength).
olA_strength = np.empty_like(olA_from_proj_XZ)
ens_strength = np.empty_like(olA_from_proj_XZ)

_id = _io.stringify(switch_time_Ma * 1e6)
optional_logging = cl.nullcontext()
Expand Down Expand Up @@ -181,6 +185,9 @@ def test_direction_change(
for v in olA_mean_vectors
]
)
olA_strength[s, :] = _diagnostics.misorientation_indices(
olA_resampled, _geo.LatticeSystem.orthorhombic, pool=pool
)
del olivine, olA_resampled, olA_mean_vectors

_log.info("%s; # %d; postprocessing enstatite...", _id, _seeds[s])
Expand All @@ -205,6 +212,10 @@ def test_direction_change(
for v in ens_mean_vectors
]
)
ens_strength[s, :] = _diagnostics.misorientation_indices(
ens_resampled, _geo.LatticeSystem.orthorhombic, pool=pool
)
del enstatite, ens_resampled, ens_mean_vectors

_log.info("elapsed CPU time: %s", np.abs(process_time() - clock_start))
_log.info("calculating ensemble averages...")
Expand Down Expand Up @@ -232,3 +243,10 @@ def test_direction_change(
ens_from_proj_YX_mean=ens_from_proj_YX_mean,
ens_from_proj_YX_err=ens_from_proj_YX_err,
)
np.savez(
f"{out_basepath}_strength.npz",
olA_mean=olA_strength.mean(axis=0),
ens_mean=ens_strength.mean(axis=0),
olA_err=olA_strength.std(axis=0),
ens_err=ens_strength.std(axis=0),
)
Loading