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 #1276

Closed sidneymau closed 3 months ago

sidneymau commented 6 months ago

(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
rmjarvis commented 3 months ago

@sidneymau This has been dormant for a couple months now. Did you want to try to finish it, or should we abandon this effort?

sidneymau commented 3 months ago

Thanks for bumping this—I'm happy to consider this abandoned for now and have the PR closed and the branch pruned. I may pick it up again when I have more time, but I don't expect that to be any time soon.