diff --git a/docs/source/examples/Example_ImageFit_LM.ipynb b/docs/source/examples/Example_ImageFit_LM.ipynb index 717b5029..377f981d 100644 --- a/docs/source/examples/Example_ImageFit_LM.ipynb +++ b/docs/source/examples/Example_ImageFit_LM.ipynb @@ -234,7 +234,7 @@ "batch_inits = batch_inits.to(dtype=torch.float32)\n", "res = caustics.utils.batch_lm(\n", " batch_inits,\n", - " obs_system.reshape(-1).repeat(10, 1),\n", + " obs_system.reshape(-1).repeat(10, 1).to(dtype=torch.float32),\n", " lambda x: sim(x).reshape(-1),\n", " C=variance.reshape(-1).repeat(10, 1),\n", ")\n", diff --git a/docs/source/frequently_asked_questions.rst b/docs/source/frequently_asked_questions.rst index cf69bcca..870ff8a9 100644 --- a/docs/source/frequently_asked_questions.rst +++ b/docs/source/frequently_asked_questions.rst @@ -1,10 +1,27 @@ FAQs - Frequently asked questions ================================= -| **Q:** How do I know what order to put the parameter values in the pytorch tensor which gets passed to the simulator? -| **A:** If you are using a simulator, then you can get the parameters using ``your_simulator.state_dict()``. The parameters whose values are set dynamically will say "None", while the static parameters will have their values shown. The order of the dynamical parameters corresponds to the order you should use in your parameter value tensor. -| -| **Q:** Why can I put the lens redshift at higher values than the source redshift or to negative values for some parametric models? -| **A:** We can calculate everything for those profiles with reduced deflection angles where the redshifts do not actually play into the calculation. If you use a profile defined by the lens mass, like a NFW lens, or a Multiplane lens then it does matter that the redshifts make sense and you will very likely get errors for those. Similarly, if you call the ``lens.physical_deflection_angle`` you will encounter errors. -| -| **Q:** I do (multiplane-)lensing with pixelated convergence using the pixelated kappa map of a parametric profile. The lensing effect differs from directly using the parametric lens. Why is the lensing effect different? -| **A:** Since you do pixelated convergence your mass is binned in pixels in a finite field of view (FOV) so you are missing some mass. At the limit of infinite resolution and infinite FOV the pixelated profile gives you the parametric profile. If the difference is above your error tolerance then you have to increase the resolution and/or FOV of your pixelated convergence map. Especially for SIE or EPL profiles (which go to infinity density in the center, and have infinite mass outside any FOV) you will miss infinite mass when pixelating. +| **Q:** How do I know what order to put the parameter values in the pytorch + tensor which gets passed to the simulator? +| **A:** If you are using any ``Module``` object (so a simulator), then you can +get the parameters using ``print(simulator)``. The order of the dynamical +parameters (top to bottom) corresponds to the order you should use in your +parameter value tensor. Note that you can ignore the static parameters. | +| **Q:** Why can I put the lens redshift at higher values than the source + redshift or to negative values for some parametric models? +| **A:** We can calculate everything for those profiles with reduced deflection +angles where the redshifts do not actually play into the calculation. If you use +a profile defined by the lens mass, like a NFW lens, or a Multiplane lens then +it does matter that the redshifts make sense and you will very likely get errors +for those. Similarly, if you call the ``lens.physical_deflection_angle`` you +will encounter errors. | +| **Q:** I do (multiplane-)lensing with pixelated convergence using the + pixelated kappa map of a parametric profile. The lensing effect differs from + directly using the parametric lens. Why is the lensing effect different? +| **A:** Since you do pixelated convergence your mass is binned in pixels in a + finite field of view (FOV) so you are missing some mass. At the limit of + infinite resolution and infinite FOV the pixelated profile gives you the + parametric profile. If the difference is above your error tolerance then you + have to increase the resolution and/or FOV of your pixelated convergence map. + Especially for SIE or EPL profiles (which go to infinity density in the + center, and have infinite mass outside any FOV) you will miss infinite mass + when pixelating. | diff --git a/docs/source/tutorials/LensZoo.ipynb b/docs/source/tutorials/LensZoo.ipynb index 6afdc588..2a6ecff1 100644 --- a/docs/source/tutorials/LensZoo.ipynb +++ b/docs/source/tutorials/LensZoo.ipynb @@ -565,7 +565,7 @@ " cosmology=cosmology,\n", " x0=0.0,\n", " y0=0.0,\n", - " sd=1.5,\n", + " kappa=1.5,\n", " z_l=z_l,\n", ")\n", "sim = caustics.LensSource(\n", diff --git a/src/caustics/utils.py b/src/caustics/utils.py index c0efde48..3f1ea111 100644 --- a/src/caustics/utils.py +++ b/src/caustics/utils.py @@ -1201,6 +1201,7 @@ def batch_lm( Cinv = 1 / C else: Cinv = torch.linalg.inv(C) + Cinv = Cinv.to(dtype=X.dtype) v_lm_step = torch.vmap( partial(