autolens_workspace icon indicating copy to clipboard operation
autolens_workspace copied to clipboard

Tutorial 5 - Raytracing Caustics

Open skcajs opened this issue 1 year ago • 6 comments

Hi, I am just visiting the Caustics section of howtolens in tutorial 5. I'm not sure what I'm supposed to be seeing but I don't think it plots anything other than the tangential critical cure. The code looks like this:

include = aplt.Include2D( tangential_critical_curves=True, tangential_caustics=True, radial_critical_curves=True, radial_caustics=True, ) tracer_plotter = aplt.TracerPlotter(tracer=tracer, grid=image_plane_grid)

I'm wondering if the tracer_plotter should look like this:

tracer_plotter = aplt.TracerPlotter(tracer=tracer, grid=image_plane_grid, include_2d=include)

That said, even with that change I'm not seeing anything other than the tangential (black) critical curve. When I set the tangential_critical_curves to false, it only displays the grid (no curves/ lines)?

skcajs avatar Sep 13 '23 15:09 skcajs

I need to update this tutorial to be clearer (free time is not something I have much of right now lol), however I think the solution is basically that:

  • The tangential caustic will become visible if you make the Isothermal profile ellitipcal (e.g. by inputting ell_comps=(0.1, 0.1).

  • A radial critical curve does not form for slope > 2.0 so you would need to use a PowerLaw with slope < 2.0 to see one.

Jammy2211 avatar Sep 13 '23 15:09 Jammy2211

Hi Sam,

Recommend you git pull all your repos to the new versions and redownload the autolens_workspace:

https://github.com/Jammy2211/PyAutoLens/releases/tag/2023.9.18.4

I didn't actually have time to fix this caustics issue yet, but I updated some tutorials in chapter_2 which updating to the new ones will make them more useful!

Jammy2211 avatar Sep 18 '23 13:09 Jammy2211

Thank you.

I am about to start chapter 2 so this will be very helpful!

skcajs avatar Sep 19 '23 18:09 skcajs

Great, there are still a few bugs / issues with the chapter, for example:

  • Some fits may converge on incorrect solutions because I used slightly too low n_live.
  • Tutorial 5 has a code snippet that doesnt do what it should.

I'm trying to polish this all up but not got much time, but feel free to ask any questions here if something doesnt feel quite right as its probably something I'm fixing!

Jammy2211 avatar Sep 20 '23 07:09 Jammy2211

Currently encountered an issue with Chapter 2 tut 1, when it tries to do the fit:

Traceback (most recent call last): File "/Users/sam/anaconda3/envs/autolens/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/Users/sam/anaconda3/envs/autolens/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar return list(map(*args)) File "/Users/sam/anaconda3/envs/autolens/lib/python3.10/site-packages/autofit/non_linear/parallel/sneaky.py", line 384, in fitness_cache return FunctionCache.fitness(x, *FunctionCache.fitness_args, AttributeError: type object 'FunctionCache' has no attribute 'fitness'

I also needed to upgrade threadpoolctl because by default 2.2.0 was installed, and needed an additional function called 'wrap', which was added in version 3.0.0. :)

I'm just seeing if I can fix it on my end, but looks like it's a bug within PyAutoFit (or a library it depends on).

skcajs avatar Sep 20 '23 14:09 skcajs

It does seem to be working on a different environment (switched from my mac to linux).

I switched environments to a fresh WSL2 environment from my macbook (I still had to update threadpoolctl), but it works now. I wonder if I needed to update my conda.

skcajs avatar Sep 26 '23 07:09 skcajs