diff --git a/src/pnanolocz/level.py b/src/pnanolocz/level.py index 2fb69ab..5b12405 100644 --- a/src/pnanolocz/level.py +++ b/src/pnanolocz/level.py @@ -7,7 +7,7 @@ row- or column-wise artefacts commonly observed in AFM topographic data. All public leveling functions accept an *exclusion mask* (same convention as -``pnanolocz_lib.thresholder``): ``True`` = excluded, ``False`` = valid. +``pnanolocz.thresholder``): ``True`` = excluded, ``False`` = valid. Excluded pixels are omitted from fitting using MATLAB-style NaN-outside semantics (i.e., excluded pixels behave like NaN during fitting) but are preserved in the output array. @@ -63,10 +63,10 @@ Examples -------- ->>> from pnanolocz_lib.level import level +>>> from pnanolocz.level import level >>> leveled_stack = apply_level(stack, polyx=2, polyy=2, method="plane") ->>> from pnanolocz_lib.level import level_plane +>>> from pnanolocz.level import level_plane >>> flattened = level_plane(img, mask=None, polyx=2, polyy=2) Authors @@ -845,6 +845,10 @@ def apply_level( operations (e.g. ``where(valid, value, nan)``) during fitting. - Method-specific MATLAB parity notes (e.g., stage gating such as `polyy > 0` in ``"line"``) are documented in the corresponding function docstrings. + + Version + ------- + 0.1.0 """ img = np.asarray(img) is_stack = img.ndim == 3 @@ -921,6 +925,9 @@ def apply_level( return np.asarray(result) if is_stack else np.asarray(result[0]) +apply_level.__version__ = "0.1.0" # type: ignore[attr-defined] + + def get_background( img: np.ndarray[Any, np.dtype[np.float64]], polyx: int, @@ -982,6 +989,10 @@ def get_background( certain parameter values) are inherited here. - Excluded pixels are preserved in the output arrays; masking primarily affects which pixels contribute to fitted estimates. + + Version + ------- + 0.1.0 """ img = np.asarray(img) is_stack = img.ndim == 3 @@ -1028,6 +1039,9 @@ def get_background( return np.asarray(result) if is_stack else np.asarray(result[0]) +get_background.__version__ = "0.1.0" # type: ignore[attr-defined] + + __all__ = [ "apply_level", "level_plane", @@ -1037,4 +1051,5 @@ def get_background( "level_smed_line", "level_mean_plane", "level_log_y", + "get_background", ] diff --git a/src/pnanolocz/level_auto.py b/src/pnanolocz/level_auto.py index c944d98..a4a15ed 100644 --- a/src/pnanolocz/level_auto.py +++ b/src/pnanolocz/level_auto.py @@ -972,6 +972,10 @@ def apply_level_auto( ``_compute_gauss_limits`` when a thresholder step declares ``args=['gauss_*']``. - The Gaussian-derived histogram bounds are calculated for each frame rather than globally across the stack, diverging from MATLAB behavior. + + Version + ------- + 0.1.0 """ img_stack = np.asarray(img_stack) if img_stack.ndim == 2: @@ -1041,4 +1045,7 @@ def apply_level_auto( return np.asarray(result[0]) if was_2d else np.asarray(result) +apply_level_auto.__version__ = "0.1.0" # type: ignore[attr-defined] + + __all__ = ["apply_level_auto", "ROUTINES"] diff --git a/src/pnanolocz/level_weighted.py b/src/pnanolocz/level_weighted.py index 3dda92b..4c80dbc 100644 --- a/src/pnanolocz/level_weighted.py +++ b/src/pnanolocz/level_weighted.py @@ -8,7 +8,7 @@ and non-uniform masking effects. All public leveling functions accept an *exclusion mask* (same convention as -``pnanolocz_lib.thresholder``): ``True`` = excluded, ``False`` = valid. Excluded +``pnanolocz.thresholder``): ``True`` = excluded, ``False`` = valid. Excluded pixels are omitted from region formation and fitting using MATLAB-style NaN-outside semantics (i.e., excluded pixels behave like NaN during fitting) but are preserved in the output array. @@ -55,7 +55,7 @@ Examples -------- ->>> from pnanolocz_lib.level_weighted import apply_level_weighted +>>> from pnanolocz.level_weighted import apply_level_weighted >>> leveled = apply_level_weighted(img, polyx=2, polyy=1, method='plane', mask=mask) Authors @@ -849,6 +849,10 @@ def apply_level_weighted( ``bwconncomp(mask, 8)``. - A MATLAB-style minimum region area is enforced via: ``min_area = max(1, floor(0.01 * H * W))``. + + Version + ------- + 0.1.0 """ arr = np.asarray(img, dtype=np.float64) is_stack = arr.ndim == 3 @@ -897,6 +901,9 @@ def apply_level_weighted( return np.asarray(stacked if is_stack else stacked[0]) +apply_level_weighted.__version__ = "0.1.0" # type: ignore[attr-defined] + + __all__ = [ "apply_level_weighted", "level_weighted_plane", diff --git a/src/pnanolocz/thresholder.py b/src/pnanolocz/thresholder.py index 63b3454..35f1058 100644 --- a/src/pnanolocz/thresholder.py +++ b/src/pnanolocz/thresholder.py @@ -1027,6 +1027,10 @@ def apply_thresholder( >>> # Otsu on a stack, then invert to obtain a validity mask (True = valid) >>> excl = apply_thresholder(stack, method="otsu") >>> valid = np.logical_not(excl) + + Version + ------- + 0.1.0 """ method = method.lower() if method not in _METHOD_MAP: @@ -1069,6 +1073,9 @@ def apply_thresholder( return result +apply_thresholder.__version__ = "0.1.0" # type: ignore[attr-defined] + + __all__ = [ "apply_thresholder", "selection",