diff --git a/masque/label.py b/masque/label.py index fe2c8cb..390ca84 100644 --- a/masque/label.py +++ b/masque/label.py @@ -49,7 +49,7 @@ class Label: if val.size != 2: raise PatternError('Offset must be convertible to size-2 ndarray') - self._offset = val.flatten() + self._offset = val.flatten().astype(float) # layer property @property @@ -83,7 +83,7 @@ class Label: self.unlock() self.identifier = () self.string = string - self.offset = numpy.array(offset, dtype=float) + self.offset = numpy.array(offset, dtype=float, copy=True) self.layer = layer self.locked = locked diff --git a/masque/repetition.py b/masque/repetition.py index 11833c5..47c4370 100644 --- a/masque/repetition.py +++ b/masque/repetition.py @@ -225,7 +225,7 @@ class GridRepetition: def mirrored(self, val: List[bool]): if is_scalar(val): raise PatternError('Mirrored must be a 2-element list of booleans') - self._mirrored = numpy.array(val, dtype=bool) + self._mirrored = numpy.array(val, dtype=bool, copy=True) # a_vector property @property @@ -239,7 +239,7 @@ class GridRepetition: if val.size != 2: raise PatternError('a_vector must be convertible to size-2 ndarray') - self._a_vector = val.flatten() + self._a_vector = val.flatten().astype(float) # b_vector property @property @@ -249,7 +249,7 @@ class GridRepetition: @b_vector.setter def b_vector(self, val: vector2): if not isinstance(val, numpy.ndarray): - val = numpy.array(val, dtype=float) + val = numpy.array(val, dtype=float, copy=True) if val.size != 2: raise PatternError('b_vector must be convertible to size-2 ndarray') diff --git a/masque/shapes/path.py b/masque/shapes/path.py index bd24bdf..85aafc3 100644 --- a/masque/shapes/path.py +++ b/masque/shapes/path.py @@ -98,7 +98,7 @@ class Path(Shape): @vertices.setter def vertices(self, val: numpy.ndarray): - val = numpy.array(val, dtype=float) + val = numpy.array(val, dtype=float) #TODO document that these might not be copied if len(val.shape) < 2 or val.shape[1] != 2: raise PatternError('Vertices must be an Nx2 array') if val.shape[0] < 2: diff --git a/masque/shapes/polygon.py b/masque/shapes/polygon.py index 67c9fdd..4bd8384 100644 --- a/masque/shapes/polygon.py +++ b/masque/shapes/polygon.py @@ -30,7 +30,7 @@ class Polygon(Shape): @vertices.setter def vertices(self, val: numpy.ndarray): - val = numpy.array(val, dtype=float) + val = numpy.array(val, dtype=float) #TODO document that these might not be copied if len(val.shape) < 2 or val.shape[1] != 2: raise PatternError('Vertices must be an Nx2 array') if val.shape[0] < 3: diff --git a/masque/shapes/text.py b/masque/shapes/text.py index 8db7c4a..684c637 100644 --- a/masque/shapes/text.py +++ b/masque/shapes/text.py @@ -64,7 +64,7 @@ class Text(Shape): def mirrored(self, val: List[bool]): if is_scalar(val): raise PatternError('Mirrored must be a 2-element list of booleans') - self._mirrored = list(val) + self._mirrored = numpy.ndarray(val, dtype=bool, copy=True) def __init__(self, string: str, diff --git a/masque/subpattern.py b/masque/subpattern.py index 55d1ef1..1bb926c 100644 --- a/masque/subpattern.py +++ b/masque/subpattern.py @@ -153,7 +153,7 @@ class SubPattern: def mirrored(self, val: List[bool]): if is_scalar(val): raise PatternError('Mirrored must be a 2-element list of booleans') - self._mirrored = numpy.array(val, dtype=bool) + self._mirrored = numpy.array(val, dtype=bool, copy=True) def as_pattern(self) -> 'Pattern': """