From 75abcea469f9f0669d81635e89e66dce6ff42c96 Mon Sep 17 00:00:00 2001 From: Carter Francis Date: Thu, 26 Oct 2023 13:41:51 -0500 Subject: [PATCH] Performance: Speed up of deepcopy for Miller --- orix/vector/miller.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/orix/vector/miller.py b/orix/vector/miller.py index 471026776..5303ed741 100644 --- a/orix/vector/miller.py +++ b/orix/vector/miller.py @@ -426,7 +426,10 @@ def from_min_dspacing( def deepcopy(self) -> Miller: """Return a deepcopy of the instance.""" - return deepcopy(self) + data = deepcopy(self.data) # Otherwise, data is a view + copied = self.__class__(xyz=data, phase=self.phase) # deepcopy is slow. + copied.coordinate_format = self.coordinate_format + return copied def round(self, max_index: int = 20) -> Miller: """Round a set of index triplet (Miller) or quartet