glass icon indicating copy to clipboard operation
glass copied to clipboard

Add a warning that `MultiPlaneConvergence` cannot be reused

Open ntessore opened this issue 9 months ago • 3 comments
trafficstars

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

ntessore avatar Jan 28 '25 20:01 ntessore

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.

ntessore avatar Jan 29 '25 16:01 ntessore

Should this be not-for-arc?

connoraird avatar Oct 20 '25 09:10 connoraird

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.

ntessore avatar Oct 21 '25 20:10 ntessore