Skip to content

Commit 81e2436

Browse files
committed
fix: script modify_VE_spread_orientations so Zarr arrays are cast to numpy
1 parent 0f69465 commit 81e2436

2 files changed

Lines changed: 37 additions & 9 deletions

File tree

matflow/data/scripts/damask/modify_VE_spread_orientations.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22

33

44
def modify_VE_spread_orientations(volume_element, phases, stddev_degrees):
5-
VE = spread_orientations(volume_element, phases, sigmas=stddev_degrees)
5+
# need to convert Zarr arrays to numpy arrays first:
6+
VE = volume_element
7+
ori_copy = VE["orientations"]
8+
ori_copy["quaternions"] = ori_copy["quaternions"][:]
9+
VE_copy = {
10+
"size": VE["size"],
11+
"grid_size": VE["grid_size"][:],
12+
"orientations": ori_copy,
13+
"element_material_idx": VE["element_material_idx"][:],
14+
"constituent_material_idx": VE["constituent_material_idx"][:],
15+
"constituent_material_fraction": VE["constituent_material_fraction"][:],
16+
"constituent_phase_label": VE["constituent_phase_label"][:],
17+
"constituent_orientation_idx": VE["constituent_orientation_idx"][:],
18+
"material_homog": VE["material_homog"][:],
19+
}
20+
VE = spread_orientations(
21+
volume_element=VE_copy, phase_names=phases, sigmas=stddev_degrees
22+
)
623
VE["grid_size"] = tuple(int(i) for i in VE["grid_size"])
724
VE["size"] = tuple(float(i) for i in VE["size"])
825
return {"volume_element": VE}

matflow/data/workflows/spread_orientations.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
doc:
1+
doc:
22
- >
33
Demonstration of modifying a volume element by applying a perturbation to its orientations.
44
55
tasks:
6-
- schema: generate_microstructure_seeds_from_random
7-
inputs:
8-
VE_size: [1, 1, 1]
9-
num_grains: 4
10-
phase_label: Al
11-
126
- schema: generate_volume_element_from_voronoi
137
inputs:
148
homog_label: SX
159
VE_grid_size: [8, 8, 8]
16-
10+
microstructure_seeds::from_random:
11+
num_seeds: 4
12+
box_size: [1, 1, 1]
13+
phase_label: Al
14+
orientations:
15+
data:
16+
- [1, 0, 0, 0]
17+
- [1, 0, 0, 0]
18+
- [1, 0, 0, 0]
19+
- [1, 0, 0, 0]
20+
unit_cell_alignment:
21+
x: a
22+
y: b
23+
z: c
24+
representation:
25+
type: quaternion
26+
quat_order: scalar_vector
27+
1728
- schema: modify_VE_spread_orientations # underscore to separate the levels of the task schema objective/method
1829
inputs:
1930
phases: [Al]

0 commit comments

Comments
 (0)