11import logging
22import numpy as np
3- from typing import Dict , Optional , Tuple , Union
3+ from typing import Optional
44
55import autofit as af
66import autoarray as aa
77import autogalaxy as ag
88
9- from autoarray .exc import PixelizationException
10-
119from autolens .analysis .analysis .dataset import AnalysisDataset
1210from autolens .analysis .positions import PositionsLH
1311from autolens .interferometer .model .result import ResultInterferometer
1412from autolens .interferometer .model .visualizer import VisualizerInterferometer
1513from autolens .interferometer .fit_interferometer import FitInterferometer
1614
17- from autolens import exc
18-
1915logger = logging .getLogger (__name__ )
2016
2117logger .setLevel (level = "INFO" )
@@ -35,6 +31,7 @@ def __init__(
3531 preloads : aa .Preloads = None ,
3632 raise_inversion_positions_likelihood_exception : bool = True ,
3733 title_prefix : str = None ,
34+ use_jax : bool = True ,
3835 ):
3936 """
4037 Analysis classes are used by PyAutoFit to fit a model to a dataset via a non-linear search.
@@ -86,6 +83,7 @@ def __init__(
8683 preloads = preloads ,
8784 raise_inversion_positions_likelihood_exception = raise_inversion_positions_likelihood_exception ,
8885 title_prefix = title_prefix ,
86+ use_jax = use_jax ,
8987 )
9088
9189 @property
@@ -114,7 +112,7 @@ def modify_before_fit(self, paths: af.DirectoryPaths, model: af.Collection):
114112
115113 return self
116114
117- def log_likelihood_function (self , instance , xp = np ):
115+ def log_likelihood_function (self , instance ):
118116 """
119117 Given an instance of the model, where the model parameters are set via a non-linear search, fit the model
120118 instance to the interferometer dataset.
@@ -154,15 +152,12 @@ def log_likelihood_function(self, instance, xp=np):
154152 """
155153
156154 log_likelihood_penalty = self .log_likelihood_penalty_from (
157- instance = instance , xp = xp
155+ instance = instance , xp = self . _xp
158156 )
159157
160- return (
161- self .fit_from (instance = instance , xp = xp ).figure_of_merit
162- - log_likelihood_penalty
163- )
158+ return self .fit_from (instance = instance ).figure_of_merit - log_likelihood_penalty
164159
165- def fit_from (self , instance : af .ModelInstance , xp = np ) -> FitInterferometer :
160+ def fit_from (self , instance : af .ModelInstance ) -> FitInterferometer :
166161 """
167162 Given a model instance create a `FitInterferometer` object.
168163
@@ -198,7 +193,7 @@ def fit_from(self, instance: af.ModelInstance, xp=np) -> FitInterferometer:
198193 adapt_images = adapt_images ,
199194 settings_inversion = self .settings_inversion ,
200195 preloads = self .preloads ,
201- xp = xp ,
196+ xp = self . _xp ,
202197 )
203198
204199 def save_attributes (self , paths : af .DirectoryPaths ):
0 commit comments