Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added method #703

Merged
merged 2 commits into from
May 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions autofit/non_linear/analysis/analysis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import logging
from abc import ABC
import os

from autoconf import conf

from autofit.mapper.prior_model.abstract import AbstractPriorModel
from autofit.non_linear.paths.abstract import AbstractPaths
Expand Down Expand Up @@ -38,6 +41,35 @@ def with_model(self, model):
model=model
)

def should_visualize(self, paths: AbstractPaths) -> bool:
"""
Whether a visualize method should continue and perform visualization, or be terminated early.

If a model-fit has already completed, the default behaviour is for visualization to be bypassed in order
to make model-fits run faster. However, visualization can be forced to run via
the `force_visualization_overwrite`, for example if a user wants to plot additional images that were not
output on the original run.

PyAutoFit test mode also disables visualization, irrespective of the `force_visualization_overwite`
config input.

Parameters
----------
paths
The PyAutoFit 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.


Returns
-------
A bool determining whether visualization should be performed or not.
"""

if os.environ.get("PYAUTOFIT_TEST_MODE") == "1":
return False

return not paths.is_complete or conf.instance["general"]["output"]["force_visualize_overwrite"]

def log_likelihood_function(self, instance):
raise NotImplementedError()

Expand Down