GalSim icon indicating copy to clipboard operation
GalSim copied to clipboard

Define setter for Image.array to allow inplace operations

Open sidneymau opened this issue 1 year ago • 0 comments

(Duplicate of https://github.com/GalSim-developers/GalSim/pull/1273 due to rebasing/etc.) This pull request addresses https://github.com/GalSim-developers/GalSim/issues/1272 by defining a setter for the Image.array attribute. This protects against any case where a user does an inplace operation on the image array attribute in an interactive environment: without the setter, this would raise an error while still performing the operation, leading to some confusion. This change also obviates the need to operate on a view of the underling array; e.g., instead of

image.array[:] += 1

we can now do

image.array += 1

sidneymau avatar Feb 26 '24 21:02 sidneymau