Skip to content

Commit

Permalink
docs: Minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorStoneAstro committed Nov 21, 2024
1 parent e363304 commit 50b0c84
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/source/examples/Example_ImageFit_LM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 25 additions & 8 deletions docs/source/frequently_asked_questions.rst
Original file line number Diff line number Diff line change
@@ -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. |
2 changes: 1 addition & 1 deletion docs/source/tutorials/LensZoo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/caustics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 50b0c84

Please sign in to comment.