-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathvisualizer.py
More file actions
55 lines (41 loc) · 1.92 KB
/
Copy pathvisualizer.py
File metadata and controls
55 lines (41 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import autofit as af
from autofit.non_linear.test_mode import is_test_mode
from autogalaxy.quantity.model.plotter import PlotterQuantity
from autolens.analysis.plotter import Plotter
class VisualizerQuantity(af.Visualizer):
@staticmethod
def visualize(
analysis,
paths: af.DirectoryPaths,
instance: af.ModelInstance,
during_analysis: bool,
):
"""
Output images of the maximum log likelihood model inferred by the model-fit. This function is called throughout
the non-linear search at regular intervals, and therefore provides on-the-fly visualization of how well the
model-fit is going.
The visualization performed by this function includes:
- Images of the best-fit `Plane`, including the images of each of its galaxies.
- Images of the best-fit `FitQuantity`, including the model-image, residuals and chi-squared of its fit to
the imaging data.
The images output by this function are customized using the file `config/visualize/plots.yaml`.
Parameters
----------
paths
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization, and the pickled objects used by the aggregator output by this function.
instance
An instance of the model that is being fitted to the data by this analysis (whose parameters have been set
via a non-linear search).
"""
if is_test_mode():
return
fit = analysis.fit_quantity_for_instance(instance=instance)
plotter = PlotterQuantity(image_path=paths.image_path)
plotter.fit_quantity(fit=fit)
plotter = Plotter(image_path=paths.image_path)
plotter.tracer(
tracer=fit.tracer,
grid=analysis.dataset.grids.lp,
)