Skip to content

Commit

Permalink
MAINT: Add logging to concentration analysis.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwboth committed Nov 22, 2024
1 parent 82389b8 commit 14e230a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/darsia/multi_image_analysis/concentrationanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from __future__ import annotations

import copy
import logging
from pathlib import Path
from time import time
from typing import Optional, Union
from warnings import warn

Expand All @@ -16,6 +18,8 @@

import darsia

logger = logging.getLogger(__name__)


class ConcentrationAnalysis:
"""Class providing the capabilities to determine concentration/saturation
Expand Down Expand Up @@ -248,7 +252,11 @@ def __call__(self, img: darsia.Image) -> darsia.Image:
probe_img = copy.deepcopy(img)

# Remove background image
tic = time()
diff = self._subtract_background(probe_img)
logger.debug(f"subtraction: {time() - tic}")

tic = time()

# Provide possibility for tuning and inspection of intermediate results
self._inspect_diff(diff)
Expand All @@ -268,14 +276,20 @@ def __call__(self, img: darsia.Image) -> darsia.Image:
# Balance signal (take into account possible heterogeneous effects)
balanced_signal = self._balance_signal(clean_signal)

logger.debug(f"processing: {time() - tic}")

# Regularize/upscale signal to Darcy scale and convert from signal to concentration
# or other way around.
if self.first_restoration_then_model:
smooth_signal = self._restore_signal(balanced_signal)
concentration = self._convert_signal(smooth_signal, diff)
else:
tic = time()
nonsmooth_concentration = self._convert_signal(balanced_signal, diff)
logger.debug(f"conversion: {time() - tic}")
tic = time()
concentration = self._restore_signal(nonsmooth_concentration)
logger.debug(f"restoration: {time() - tic}")

# Invoke plot
if self.verbosity >= 1:
Expand Down

0 comments on commit 14e230a

Please sign in to comment.