glass
glass copied to clipboard
Add a warning that `MultiPlaneConvergence` cannot be reused
Which Section of the Documentation Needs Improving?
https://glass.readthedocs.io/stable/reference/lensing.html#glass.MultiPlaneConvergence
What Can be Improved About This Section
We should add a warning to the documentation which states that MultiPlaneConvergence instances cannot be reused across multiple simulations (because the iterative computation tracks state internally).
How to Improve This Section
We could also add a code example, basically https://glass.readthedocs.io/stable/examples/1-basic/lensing.html with everything unrelated blanked out:
# create an instance for iterative lensing
# WARNING: do not reuse for multiple simulations
convergence = glass.MultiPlaneConvergence(cosmo)
# simulation loop
for i, delta in enumerate(matter):
# add lensing plane from the window function of this shell
convergence.add_window(delta, shells[i])
# get convergence map
kappa = convergence.kappa
Also warn that convergence.kappa is changed in place, so if users want to keep the map, they currently need to make a copy. This might resolve itself when we re-implement this for JAX.
Should this be not-for-arc?
I'll take this on, adding both a warning to the documentation and raising an error when users try to add a shell with a lower redshift than previous shells.