graintrace.experiment_rotation_helper#

Rotate/register raw far-field experiment CSVs into the simulation frame.

graintrace.experiment_rotation_helper.update_experiments(input_files, output_root, bounding_box, dim=3, weighted=False, auto_fix_bbox=False, bbox_fix_mode=None, bbox_tolerance=0.0, auto_rotate=False, rotate_angles=(0, 0, 0), rotate_convention='xyz', angle_identifier=None, orientation_descriptor='euler-bunge', orientation_active_convention=False, unit='deg', elastic_strain_identifier=None, strain_unit='microstrain', env=None, neper_path=None, auto_install=False)[source]#

Rotate each input CSV into the simulation frame via a Voronoi build, saving under output_root.

For each input file this runs a VoronoiMeshBuilder build (option="voronoi", no mesh) to apply the bounding-box filter and the sample rotation, and writes <output_root>/<basename> holding the filtered grain table with the ROTATED Euler angles (degrees, standard Bunge triplet of R' = Q R, via euler()) and rotated positions/strains. Euler is the primary orientation input of MaterialCalibration, so no O11..O33 columns are written; any pre-existing (unrotated) O* columns are dropped so a stale matrix cannot disagree with the rotated Euler. With strain_unit="microstrain" the elastic_strain_identifier columns are scaled by 1e6 on the way out.

This is the preparation step for a physically registered MaterialCalibration fit: the output is the FF calibration CSV schema described in File formats.

Note

orientation_active_convention is deprecated and ignored. For a frame change without a reconstruction use apply_ff_csv().

Important

The NEPER cells (reconstruction.ori) and the grain table correspond by row position – no grain id participates. A count mismatch would pair orientations with the wrong grains, so this function raises ValueError when NEPER returns a different number of cells than the filtered grain table has rows, naming both counts and the file. The usual cause is the bounding-box filter dropping points under bbox_fix_mode="remove_points".

Raises:

ValueError – if reconstruction.ori and the filtered grain table disagree on row count.

Parameters:
Return type:

None

graintrace.experiment_rotation_helper.try_parse_float(s)[source]#

Return float(s) or None if it is not parseable.

graintrace.experiment_rotation_helper.collect_experiment_files(data_dir)[source]#

Collect all CSV files in a directory with numeric names. Returns sorted list of CSV paths and numeric stress levels.