Skip to content

Commit 8f47866

Browse files
authored
Merge pull request #152 from derollins/derollins/h5jpk
2 parents a12bd2d + 314114d commit 8f47866

25 files changed

Lines changed: 592 additions & 41 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
types: [python, yaml, markdown]
2121

2222
- repo: https://github.com/DavidAnson/markdownlint-cli2
23-
rev: v0.18.1
23+
rev: v0.18.0
2424
hooks:
2525
- id: markdownlint-cli2
2626
args: []

AFMReader/asd.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,32 @@
22

33
import errno
44
import os
5-
from pathlib import Path
65
import sys
6+
from pathlib import Path
77

8-
8+
import matplotlib.pyplot as plt
99
import numpy as np
1010
import numpy.typing as npt
11-
import matplotlib.pyplot as plt
1211
from matplotlib import animation
1312

14-
15-
from AFMReader.logging import logger
1613
from AFMReader.io import (
17-
read_int32,
18-
read_int16,
19-
read_float,
14+
read_ascii,
2015
read_bool,
16+
read_double,
17+
read_float,
2118
read_hex_u32,
22-
read_ascii,
23-
read_uint8,
24-
read_null_separated_utf8,
2519
read_int8,
26-
read_double,
20+
read_int16,
21+
read_int32,
22+
read_null_separated_utf8,
23+
read_uint8,
2724
skip_bytes,
2825
)
29-
26+
from AFMReader.logging import logger
3027

3128
if sys.version_info.minor < 11:
3229
from typing import Any, BinaryIO
30+
3331
from typing_extensions import Self
3432
else:
3533
from typing import Any, BinaryIO, Self

AFMReader/general_loader.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import numpy.typing as npt
66

7-
from AFMReader import asd, gwy, ibw, jpk, spm, stp, top, topostats
7+
from AFMReader import asd, gwy, h5_jpk, ibw, jpk, spm, stp, top, topostats
88
from AFMReader.logging import logger
99

1010
logger.enable(__package__)
@@ -45,7 +45,7 @@ def load(self) -> tuple[npt.NDArray | str, float | None]: # noqa: C901
4545
Returns
4646
-------
4747
tuple
48-
The image data (stack if ''.asd'') and the pixel to nanometre scaling ratio.
48+
The image data (stack if ''.asd'' or ''.h5-jpk'') and the pixel to nanometre scaling ratio.
4949
5050
Raises
5151
------
@@ -64,6 +64,8 @@ def load(self) -> tuple[npt.NDArray | str, float | None]: # noqa: C901
6464
image, pixel_to_nanometre_scaling_factor = jpk.load_jpk(self.filepath, self.channel)
6565
elif self.suffix == ".spm":
6666
image, pixel_to_nanometre_scaling_factor = spm.load_spm(self.filepath, self.channel)
67+
elif self.suffix == ".h5-jpk":
68+
image, pixel_to_nanometre_scaling_factor, _ = h5_jpk.load_h5jpk(self.filepath, self.channel)
6769
elif self.suffix == ".stp":
6870
image, pixel_to_nanometre_scaling_factor = stp.load_stp(self.filepath)
6971
elif self.suffix == ".top":

AFMReader/gwy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""For decoding and loading .gwy AFM file format into Python Numpy arrays."""
22

3-
from pathlib import Path
43
import re
4+
from pathlib import Path
55
from typing import Any, BinaryIO
66

7-
from loguru import logger
87
import numpy as np
8+
from loguru import logger
99

10-
from AFMReader.io import read_uint32, read_null_terminated_string, read_char, read_double
10+
from AFMReader.io import read_char, read_double, read_null_terminated_string, read_uint32
1111

1212

1313
def load_gwy(file_path: Path | str, channel: str) -> tuple[np.ndarray[Any, np.float64], float]:

0 commit comments

Comments
 (0)