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 via a Voronoi build, appending Oij columns, 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, reads back the rotated orientation matrix NEPER wrote to reconstruction.ori, and writes <output_root>/<basename> holding the nine O11..``O33`` columns followed by the original columns. Any pre-existing O* columns are dropped so the rotated matrix replaces them rather than duplicating. 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.

Warning

reconstruction.ori and the grain table are concatenated by row position, and the result is silently truncated to min(len(df), len(ori_df)). Nothing checks that the two row counts agree, nothing logs it when they do not, and no grain id participates in the join. If the NEPER build ever returns a different number of cells than there are input grains, the output file silently loses rows and pairs the surviving orientations with the wrong grains. Compare the row count of each output file against its input before using the result.

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.