Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ build/
.eggs/
*.egg

# Version file
_version.py

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
48 changes: 33 additions & 15 deletions notebooks/Test pnanolocz-lib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"source": [
"data_path = r\"C:/Users/ggjh246/OneDrive - University of Leeds/Code/playNano_testdata/save-2025.05.20-12.57.06.187.h5-jpk\"\n",
"from playnano.io.loader import load_afm_stack\n",
"\n",
"afm_stack = load_afm_stack(data_path, channel = \"height_trace\")"
]
},
Expand All @@ -41,7 +40,7 @@
"metadata": {},
"outputs": [],
"source": [
"from pnanolocz_lib import level, level_auto\n",
"from pnanolocz_lib import level_auto, level, level_weighted\n",
"\n",
"frames = afm_stack.n_frames\n",
"frame_ind = range(0, frames)\n",
Expand All @@ -68,7 +67,7 @@
"metadata": {},
"outputs": [],
"source": [
"auto_leveled = level_auto.apply_level_auto(afm_stack.data, \"iterative 1nm high\")"
"auto_leveled = level_auto.apply_level_auto(afm_stack.data, \"multi-plane-otsu\")"
]
},
{
Expand All @@ -89,7 +88,6 @@
"outputs": [],
"source": [
"from pnanolocz_lib.thresholder import thresholder\n",
"\n",
"mask_hist = thresholder(plane_levelled, 'histogram', limits = (0.2, 100),invert = False)"
]
},
Expand All @@ -109,6 +107,18 @@
"id": "9",
"metadata": {},
"outputs": [],
"source": [
"from pnanolocz_lib.level_weighted import apply_level_weighted\n",
"lev_weight = apply_level_weighted(plane_levelled, 1, 1, \"smed_line\", mask=mask_hist)\n",
"plt.imshow(lev_weight[5], cmap=\"afmhot\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"metadata": {},
"outputs": [],
"source": [
"masked_line_levelled = level.apply_level(plane_levelled, 1, 0, \"line\", mask_hist)\n",
"plt.imshow(masked_line_levelled[5], cmap=\"afmhot\")"
Expand All @@ -117,7 +127,15 @@
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"id": "11",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -128,7 +146,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "13",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -139,17 +157,17 @@
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"id": "14",
"metadata": {},
"outputs": [],
"source": [
"mask_hist2 =thresholder(maksed_line_levelled, 'histogram', limits= (0.5,100), invert=False)"
"mask_hist2 =thresholder(maksed_linemed_levelled, 'histogram', limits= (0.5,100), invert=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -160,7 +178,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -171,15 +189,15 @@
{
"cell_type": "code",
"execution_count": null,
"id": "15",
"id": "17",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"id": "18",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -189,7 +207,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"id": "19",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -199,7 +217,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "18",
"id": "20",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -209,7 +227,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"id": "21",
"metadata": {},
"outputs": [],
"source": []
Expand Down
17 changes: 13 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ classifiers = [
"Topic :: Scientific/Engineering :: Image Processing",
]


[project.optional-dependencies]
dev = [
"pytest>=7.0",
Expand All @@ -82,6 +81,7 @@ dev = [
"black",
"codespell>=2.3.0",
"mypy==1.11.1",
"nbstripout",
]

[project.urls]
Expand All @@ -93,6 +93,9 @@ package-dir = { "" = "src" }
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
write_to = "src/pnanolocz_lib/_version.py"

[tool.black]
line-length = 88
target-version = ["py310"]
Expand Down Expand Up @@ -138,7 +141,7 @@ ignore = ["D100", "D104", "D203", "D212", "D401"]
convention = "numpy"

[tool.codespell]
skip = "*.egg-info,*.png,*.jpg,*.jpeg,*.gif,*.bmp,*.svg,*.ico,*.pdf,*.zip,*.gz,*.bz2,*.xz,*.7z,*.mp3,*.wav,*.mp4,*.mov,*.tif,*.tiff,*.ipynb,docs/_build/*,build/*,dist/*"
skip = "*.egg-info,*.png,*.jpg,*.jpeg,*.gif,*.bmp,*.svg,*.ico,*.pdf,*.zip,*.gz,*.bz2,*.xz,*.7z,*.mp3,*.wav,*.mp4,*.mov,*.tif,*.tiff,*.ipynb,docs/_build/*,build/*,dist/*,*.html,*.css,*.js"
ignore-words-list = "tabel,crate"
check-filenames = false
check-hidden = false
Expand All @@ -156,12 +159,18 @@ namespace_packages = false

# Your existing strictness
strict = true
warn_unused_ignores = true
warn_unused_ignores = false
disallow_untyped_defs = true
exclude = '^tests/'

[[tool.mypy.overrides]]
module = ["scipy.*", "skimage.*", "ruptures", "sknw"]
module = [
"scipy.*",
"skimage.*",
"ruptures",
"sknw",
"numpy.*"
]
ignore_missing_imports = true

[tool.pytest.ini_options]
Expand Down
9 changes: 6 additions & 3 deletions src/pnanolocz_lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("pnanolocz_lib")
except PackageNotFoundError:
__version__ = "0.0.0"
from ._version import version as __version__ # type: ignore[import-not-found]
except Exception:
try:
__version__ = version("pnanolocz_lib")
except PackageNotFoundError:
__version__ = "0.0.0"
Loading