Skip to content
Snippets Groups Projects
Commit ca130f98 authored by Dániel Varjas's avatar Dániel Varjas
Browse files

remove __deepcopy__ from BlochCoeff and add __copy__ to Model

parent f2042723
No related branches found
No related tags found
1 merge request!11Fix inconsistency in sympy symbols in Models
Pipeline #23559 passed
...@@ -3,7 +3,7 @@ import scipy ...@@ -3,7 +3,7 @@ import scipy
import tinyarray as ta import tinyarray as ta
import scipy.linalg as la import scipy.linalg as la
from itertools import product from itertools import product
from copy import copy, deepcopy from copy import copy
from numbers import Number from numbers import Number
from warnings import warn from warnings import warn
from functools import lru_cache from functools import lru_cache
...@@ -93,11 +93,10 @@ class BlochCoeff(tuple): ...@@ -93,11 +93,10 @@ class BlochCoeff(tuple):
else: else:
raise NotImplementedError raise NotImplementedError
def __deepcopy__(self, memo):
hop, coeff = self
return BlochCoeff(deepcopy(hop), coeff)
def __copy__(self): def __copy__(self):
return self.copy()
def copy(self):
hop, coeff = self hop, coeff = self
return BlochCoeff(copy(hop), coeff) return BlochCoeff(copy(hop), coeff)
...@@ -459,6 +458,9 @@ class Model(UserDict): ...@@ -459,6 +458,9 @@ class Model(UserDict):
result.append('}') result.append('}')
return "".join(result) return "".join(result)
def __copy__(self):
return self.copy()
def zeros_like(self): def zeros_like(self):
"""Return an empty model object that inherits the other properties""" """Return an empty model object that inherits the other properties"""
result = type(self)(shape=self.shape, result = type(self)(shape=self.shape,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment