Skip to content

Commit 7e21afd

Browse files
Jammy2211claude
authored andcommitted
refactor: remove unused should_profile and profile_log_likelihood_function
The profiling config option was always false and the method was never overridden in any downstream project. Remove the dead code path from SearchUpdater, NonLinearSearch, and Analysis. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f27b456 commit 7e21afd

5 files changed

Lines changed: 1 addition & 32 deletions

File tree

autofit/config/general.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ parallel:
2424
warn_environment_variables: true # If True, a warning is displayed when the search's number of CPU > 1 and enviromment variables related to threading are also > 1.
2525
profiling:
2626
parallel_profile: false # If True, the parallelization of the fit is profiled outputting a cPython graph.
27-
should_profile: false # If True, the ``profile_log_likelihood_function()`` function of an analysis class is called throughout a model-fit, profiling run times.
2827
repeats: 1 # The number of repeat function calls used to measure run-times when profiling.
2928
test:
3029
check_likelihood_function: true # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run.

autofit/non_linear/analysis/analysis.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -299,23 +299,6 @@ def make_result(
299299
analysis=analysis,
300300
)
301301

302-
def profile_log_likelihood_function(self, paths: AbstractPaths, instance):
303-
"""
304-
Overwrite this function for profiling of the log likelihood function to be performed every update of a
305-
non-linear search.
306-
307-
This behaves analogously to overwriting the `visualize` function of the `Analysis` class, whereby the user
308-
fills in the project-specific behaviour of the profiling.
309-
310-
Parameters
311-
----------
312-
paths
313-
An object describing the paths for saving data (e.g. hard-disk directories or entries in sqlite database).
314-
instance
315-
The maximum likliehood instance of the model so far in the non-linear search.
316-
"""
317-
pass
318-
319302
def perform_quick_update(self, paths, instance):
320303
raise NotImplementedError
321304

autofit/non_linear/search/abstract_search.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ def __init__(
224224

225225
self.iterations = 0
226226

227-
self.should_profile = conf.instance["general"]["profiling"]["should_profile"]
228-
229227
self.silence = silence
230228

231229
if conf.instance["general"]["hpc"]["hpc_mode"]:
@@ -938,7 +936,6 @@ def _updater(self):
938936
search_logger=self.logger,
939937
plot_results_func=self.plot_results,
940938
samples_from_func=self.samples_from,
941-
should_profile=self.should_profile,
942939
disable_output=self.disable_output,
943940
iterations_per_full_update=self.iterations_per_full_update,
944941
)

autofit/non_linear/search/updater.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def __init__(
4444
search_logger: logging.Logger,
4545
plot_results_func: Callable[[Samples], None],
4646
samples_from_func: Callable[[AbstractPriorModel, ...], Samples],
47-
should_profile: bool,
4847
disable_output: bool,
4948
iterations_per_full_update: float,
5049
):
@@ -53,7 +52,6 @@ def __init__(
5352
self._logger = search_logger
5453
self._plot_results = plot_results_func
5554
self._samples_from = samples_from_func
56-
self._should_profile = should_profile
5755
self._disable_output = disable_output
5856
self._iterations_per_full_update = iterations_per_full_update
5957
self._iterations = 0
@@ -288,14 +286,7 @@ def _profile_and_summarize(
288286
latent_samples: Optional[Samples],
289287
visualization_time: float,
290288
):
291-
"""Run profiling and write the search summary file."""
292-
if self._should_profile:
293-
self._logger.debug("Profiling Maximum Likelihood Model")
294-
analysis.profile_log_likelihood_function(
295-
paths=self._paths,
296-
instance=instance,
297-
)
298-
289+
"""Write the search summary file."""
299290
self._logger.debug("Outputting model result")
300291

301292
try:

test_autofit/config/general.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ parallel:
2121
warn_environment_variables: false # If True, a warning is displayed when the search's number of CPU > 1 and enviromment variables related to threading are also > 1.
2222
profiling:
2323
parallel_profile: false # If True, the parallelization of the fit is profiled outputting a cPython graph.
24-
should_profile: false # If True, the ``profile_log_likelihood_function()`` function of an analysis class is called throughout a model-fit, profiling run times.
2524
repeats: 1 # The number of repeat function calls used to measure run-times when profiling.
2625
test:
2726
check_likelihood_function: false # if True, when a search is resumed the likelihood of a previous sample is recalculated to ensure it is consistent with the previous run.

0 commit comments

Comments
 (0)