GalSim-developers / GalSim

The modular galaxy image simulation toolkit. Documentation:
http://galsim-developers.github.io/GalSim/
Other
223 stars 105 forks source link

Define setter for image.array to allow inplace operations #1273

Closed sidneymau closed 6 months ago

sidneymau commented 6 months ago

This pull request addresses #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
rmjarvis commented 6 months ago

Also, this shouldn't be directed at releases/2.5. It's not a bugfix. Rebase it to main and direct the PR to main.

sidneymau commented 6 months ago

Evidently I don't know how to tell GitHub how to rebase, will try this in a new PR...