Skip to content

Commit

Permalink
Enforce ptype rules in Plane.multiply
Browse files Browse the repository at this point in the history
  • Loading branch information
andykee committed Oct 19, 2023
1 parent b350657 commit c8c3684
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lentil/plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ def multiply(self, wavefront, inplace=False):
Updated wavefront
"""
if not _can_multiply_ptype(self.ptype, wavefront.ptype):
raise TypeError(f"can't multiply Wavefront with ptype " \
f"'{wavefront.ptype}' by Plane with ptype " \
f"'{self.ptype}'")

pixelscale = _multiply_pixelscale(self.pixelscale, wavefront.pixelscale)
shape = wavefront.shape if self.shape == () else self.shape
data = wavefront.data
Expand Down
2 changes: 1 addition & 1 deletion lentil/wavefront.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def ptype(self):
@ptype.setter
def ptype(self, value):
if lentil.ptype(value) == lentil.transform:
raise TypeError("invalid type ptype('transform') for Wavefront")
raise TypeError("invalid ptype 'transform' for Wavefront")
else:
self._ptype = lentil.ptype(value)

Expand Down

0 comments on commit c8c3684

Please sign in to comment.