autolens.AnalysisImaging#

class autolens.AnalysisImaging(dataset, positions_likelihood: ~typing.Optional[~typing.Union[~autolens.analysis.positions.PositionsLHResample, ~autolens.analysis.positions.PositionsLHPenalty]] = None, hyper_dataset_result=None, cosmology: ~autogalaxy.cosmology.lensing.LensingCosmology = Planck15(name="Planck15", H0=67.74 km / (Mpc s), Om0=0.3075, Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.   0.   0.06] eV, Ob0=0.0486), settings_pixelization: ~typing.Optional[~autoarray.inversion.pixelization.settings.SettingsPixelization] = None, settings_inversion: ~typing.Optional[~autoarray.inversion.inversion.settings.SettingsInversion] = None, settings_lens: ~typing.Optional[~autolens.analysis.settings.SettingsLens] = None, raise_inversion_positions_likelihood_exception: bool = True)[source]#
__init__(dataset, positions_likelihood: ~typing.Optional[~typing.Union[~autolens.analysis.positions.PositionsLHResample, ~autolens.analysis.positions.PositionsLHPenalty]] = None, hyper_dataset_result=None, cosmology: ~autogalaxy.cosmology.lensing.LensingCosmology = Planck15(name="Planck15", H0=67.74 km / (Mpc s), Om0=0.3075, Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.   0.   0.06] eV, Ob0=0.0486), settings_pixelization: ~typing.Optional[~autoarray.inversion.pixelization.settings.SettingsPixelization] = None, settings_inversion: ~typing.Optional[~autoarray.inversion.inversion.settings.SettingsInversion] = None, settings_lens: ~typing.Optional[~autolens.analysis.settings.SettingsLens] = None, raise_inversion_positions_likelihood_exception: bool = True)#

Analysis classes are used by PyAutoFit to fit a model to a dataset via a non-linear search.

This abstract Analysis class has attributes and methods for all model-fits which fit the model to a dataset (e.g. imaging or interferometer data).

This class stores the Cosmology used for the analysis and settings that control aspects of the calculation, including how pixelizations, inversions and lensing calculations are performed.

Parameters
  • dataset – The imaging, interferometer or other dataset that the model if fitted too.

  • positions_likelihood – An object which alters the likelihood function to include a term which accounts for whether image-pixel coordinates in arc-seconds corresponding to the multiple images of the lensed source galaxy trace close to one another in the source-plane.

  • cosmology – The AstroPy Cosmology assumed for this analysis.

  • settings_pixelization – settings controlling how a pixelization is fitted during the model-fit, for example if a border is used when creating the pixelization.

  • settings_inversion – Settings controlling how an inversion is fitted during the model-fit, for example which linear algebra formalism is used.

  • settings_lens – Settings controlling the lens calculation, for example how close the lensed source’s multiple images have to trace within one another in the source plane for the model to not be discarded.

  • raise_inversion_positions_likelihood_exception – If an inversion is used without the positions_likelihood it is likely a systematic solution will be inferred, in which case an Exception is raised before the model-fit begins to inform the user of this. This exception is not raised if this input is False, allowing the user to perform the model-fit anyway.

Methods

__init__(dataset[, positions_likelihood, ...])

Analysis classes are used by PyAutoFit to fit a model to a dataset via a non-linear search.

check_and_replace_hyper_images(paths)

Using a the result of a previous model-fit, a hyper-dataset can be set up which adapts aspects of the model (e.g.

fit_imaging_via_instance_from(instance[, ...])

Given a model instance create a FitImaging object.

fit_imaging_via_tracer_from(tracer, ...[, ...])

Given a Tracer, which the analysis constructs from a model instance, create a FitImaging object.

hyper_background_noise_via_instance_from(...)

If the model instance contains a HyperBackgroundNoise attribute, which adds a free parameter to the model that scales the background noise, return this attribute.

hyper_image_sky_via_instance_from(instance)

If the model instance contains a HyperImageSky attribute, which adds a free parameter to the model that scales the background sky, return this attribute.

instance_with_associated_hyper_images_from(...)

Using the model image and galaxy images that were set up as the hyper dataset, associate the galaxy images of that result with the galaxies in this model fit.

log_likelihood_cap_from(...)

Certain Inversion's have stochasticity in their log likelihood estimate (e.g.

log_likelihood_function(instance)

Given an instance of the model, where the model parameters are set via a non-linear search, fit the model instance to the imaging dataset.

log_likelihood_positions_overwrite_from(instance)

Call the positions overwrite log likelihood function, which add a penalty term to the likelihood if the positions of the multiple images of the lensed source do not trace close to one another in the source plane.

make_result(samples, model[, sigma, ...])

After the non-linear search is complete create its Result, which includes:

modify_after_fit(paths, model, result)

Call functions that perform tasks after a model-fit is completed, for example ensuring the figure of merit has not changed from previous estimates and resetting preloads.

modify_before_fit(paths, model)

PyAutoFit calls this function immediately before the non-linear search begins, therefore it can be used to perform tasks using the final model parameterization.

modify_model(model)

output_or_check_figure_of_merit_sanity(...)

Changes to the PyAutoGalaxy source code may inadvertantly change the numerics of how a log likelihood is computed.

plane_via_instance_from(instance)

Create a Plane from the galaxies contained in a model instance.

profile_log_likelihood_function(instance[, ...])

This function is optionally called throughout a model-fit to profile the log likelihood function.

raise_exceptions(model)

save_attributes_for_aggregator(paths)

Before the non-linear search begins, this routine saves attributes of the Analysis object to the pickles folder such that they can be load after the analysis using PyAutoFit's database and aggregator tools.

save_results_for_aggregator(paths, result)

At the end of a model-fit, this routine saves attributes of the Analysis object to the pickles folder such that they can be loaded after the analysis using PyAutoFit's database and aggregator tools.

save_stochastic_outputs(paths, samples)

Certain Inversion's have stochasticity in their log likelihood estimate (e.g.

set_hyper_dataset(result)

Using a the result of a previous model-fit, set the hyper-dataset for this analysis.

set_preloads(paths, model)

It is common for the model to have components whose parameters are all fixed, and thus the way that component fits the data does not change.

stochastic_log_likelihoods_via_instance_from(...)

Certain Inversion's have stochasticity in their log likelihood estimate.

tracer_via_instance_from(instance[, ...])

Create a Tracer from the galaxies contained in a model instance.

visualize(paths, instance, during_analysis)

Output images of the maximum log likelihood model inferred by the model-fit.

with_model(model)

Associate an explicit model with this analysis.

Attributes

fit_func

fit_maker_cls

imaging

preloads_cls