PyAutoLens icon indicating copy to clipboard operation
PyAutoLens copied to clipboard

Create Tracer from result with same API as instance

Open Jammy2211 opened this issue 3 years ago • 0 comments

There are currently two ways we can manipulate a lens model result:

tracer = result.max_log_likelihood_tracer
bulge_image = tracer.planes[0].galaxies[0].bulge.image_2d_from(grid=imaging.grid)

or

samples = result.samples

ml_instance = samples.max_log_likelihood_instance
bulge = ml_instance.galaxies.lens.bulge
bulge_image = bulge.image_2d_from(grid=imaging.grid)

Currently, it is not possible for us to create a Tracer with the API:

tracer = result.max_log_likelihood_tracer
bulge_image = tracer.lens.bulge.image_2d_from(grid=imaging.grid)

It should be possible to extend the Tracer object such that if the input galaxies object is a ModelInstance it has both the above API's as opposed to only the first one. This will make manipulating results more self consistent.

Jammy2211 avatar Mar 16 '22 09:03 Jammy2211