Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
top_match_idx = data_group["TopMatchIndices"][:][:map_size] - 1
dictionary_size = data_group["FZcnt"][:][0]
dictionary_euler = data_group["DictionaryEulerAngles"][:][:dictionary_size]
euler = dictionary_euler[top_match_idx, :]
data_dict["rotations"] = Rotation.from_euler(euler)
# Get number of top matches kept per data point
n_top_matches = f["NMLparameters/EBSDIndexingNameListType/nnk"][:][0]
data_dict["prop"] = _get_properties(
data_group=data_group, n_top_matches=n_top_matches, map_size=map_size,
)
f.close()
return CrystalMap(**data_dict)
"scan_unit": header["scan_unit"],
"phase_list": dict2phaselist(header["phases"]),
"phase_id": data.pop("phase_id"),
"is_in_data": data.pop("is_in_data"),
}
# Add standard items by updating the new dictionary
for direction in ["z", "y", "x"]:
this_direction = data.pop(direction)
if hasattr(this_direction, "__iter__") is False:
this_direction = None
crystal_map_dict[direction] = this_direction
_ = [data.pop(i) for i in ["id"]]
# What's left should be properties like quality metrics etc.
crystal_map_dict.update({"prop": data})
return CrystalMap(**crystal_map_dict)
# Set scan unit
if vendor in ["tsl", "emsoft"]:
scan_unit = "um"
else: # NanoMegas
scan_unit = "nm"
data_dict["scan_unit"] = scan_unit
# Create rotations
data_dict["rotations"] = Rotation.from_euler(
np.column_stack(
(data_dict.pop("euler1"), data_dict.pop("euler2"), data_dict.pop("euler3"))
)
)
return CrystalMap(**data_dict)