Conversation
Introduce n_repeats to elastic_simulation to run multiple independent repeats per strain and compute uncertainty. The function now accumulates Cij samples per repeat, returns mean and std (Cij and Cij_std) and mean/std for isotropic moduli (moduli, moduli_std). Use ddof=0 for n_repeats==1 and ddof=1 (sample std) for n_repeats>1. Updated docstring/return spec and adjusted logic for normal and shear strain handling. Tests updated/added to validate Cij index mapping, n_repeats std behavior, and related test refactors (imports and isotropic moduli checks).
Enable statistical uncertainty estimation by running independent repeats per strain state. elastic_simulation: add n_repeats handling (each repeat uses seed + r), collect per-repeat Cij samples, compute mean and per-element std, and return Cij_samples and n_repeats; compute moduli means and stds and expose them as B/G/E/nu and B_std/G_std/E_std/nu_std. Preserve previous behavior when n_repeats=1. Use cij mean for cubicity warnings. Documentation and example notebook updated to document n_repeats, show printed uncertainties, and set n_repeats=3 in examples.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Here, the calculations are serial for now. In principle, this is fine since most of those are short calculations. However, I plan to run all calculations in parallel, both for deformations and for repetition, which is slightly complex. For example, we run a few independent deformations for n_repetitions, or we keep it simple and run all deformations in a single cycle for n_repetitions. This latter one, I have implemented locally. This is worth discussing, and if either is agreed upon, or if another suggestion is made, I plan to add it to another PR to keep this one focused. |
ltalirz
left a comment
There was a problem hiding this comment.
Thanks @Atilaac !
Could you please make the documentation of n_repeats a bit more specific by saying what changes between repeats?
These repeats are still all for the same glass sample, right?
In your experiments, do you see significant spread between repeats?
Ok to wait with parallelization - we first need to figure out our general approach to parallelization that works with hierarchical workflows |
Introduce n_repeats to elastic_simulation to run multiple independent repeats per strain and compute uncertainty.
The function now accumulates Cij samples per repeat, returns mean and std (Cij and Cij_std) and mean/std for isotropic moduli (moduli, moduli_std).
Updated docstring/return spec and adjusted logic for normal and shear strain handling.
Tests updated/added to validate Cij index mapping, n_repeats std behavior, and related test refactors (imports and isotropic moduli checks).
Documentation and example notebook updated to document n_repeats, show printed uncertainties, and set n_repeats=3 in examples.