create_coordinate_arrays#
- orix.crystal_map.create_coordinate_arrays(shape: tuple | None = None, step_sizes: tuple | None = None) Tuple[dict, int] [source]#
Return flattened coordinate arrays from a given map shape and step sizes, suitable for initializing a
CrystalMap
.Arrays for 1D or 2D maps can be returned.
- Parameters:
- shape
Map shape. Default is a 2D map of shape (5, 10) with five rows and ten columns.
- step_sizes
Map step sizes. If not given, it is set to 1 px in each map direction given by shape.
- Returns:
d
Dictionary with keys
"x"
and"y"
, depending on the length of shape, with coordinate arrays.map_size
Number of map points.
Examples
>>> from orix.crystal_map import create_coordinate_arrays >>> create_coordinate_arrays((2, 3)) ({'x': array([0, 1, 2, 0, 1, 2]), 'y': array([0, 0, 0, 1, 1, 1])}, 6) >>> create_coordinate_arrays((3, 2)) ({'x': array([0, 1, 0, 1, 0, 1]), 'y': array([0, 0, 1, 1, 2, 2])}, 6) >>> create_coordinate_arrays((2, 3), (1.5, 1.5)) ({'x': array([0. , 1.5, 3. , 0. , 1.5, 3. ]), 'y': array([0. , 0. , 0. , 1.5, 1.5, 1.5])}, 6)