be more consistent about when copies are made
This commit is contained in:
parent
ad0adec8e8
commit
ef6c5df386
14 changed files with 28 additions and 34 deletions
|
|
@ -60,7 +60,7 @@ class Mirrorable(metaclass=ABCMeta):
|
|||
# def mirrored(self, val: Sequence[bool]) -> None:
|
||||
# if is_scalar(val):
|
||||
# raise MasqueError('Mirrored must be a 2-element list of booleans')
|
||||
# self._mirrored = numpy.array(val, dtype=bool, copy=True)
|
||||
# self._mirrored = numpy.array(val, dtype=bool)
|
||||
#
|
||||
# #
|
||||
# # Methods
|
||||
|
|
|
|||
|
|
@ -81,12 +81,11 @@ class PositionableImpl(Positionable, metaclass=ABCMeta):
|
|||
|
||||
@offset.setter
|
||||
def offset(self, val: ArrayLike) -> None:
|
||||
if not isinstance(val, numpy.ndarray) or val.dtype != numpy.float64:
|
||||
val = numpy.array(val, dtype=float)
|
||||
val = numpy.array(val, dtype=float)
|
||||
|
||||
if val.size != 2:
|
||||
raise MasqueError('Offset must be convertible to size-2 ndarray')
|
||||
self._offset = val.flatten() # type: ignore
|
||||
self._offset = val.flatten()
|
||||
|
||||
#
|
||||
# Methods
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class PivotableImpl(Pivotable, metaclass=ABCMeta):
|
|||
""" `[x_offset, y_offset]` """
|
||||
|
||||
def rotate_around(self, pivot: ArrayLike, rotation: float) -> Self:
|
||||
pivot = numpy.array(pivot, dtype=float)
|
||||
pivot = numpy.asarray(pivot, dtype=float)
|
||||
cast(Positionable, self).translate(-pivot)
|
||||
cast(Rotatable, self).rotate(rotation)
|
||||
self.offset = numpy.dot(rotation_matrix_2d(rotation), self.offset) # type: ignore # mypy#3004
|
||||
|
|
|
|||
Loading…
Reference in a new issue