|
1 | 1 | """For decoding and loading .jpk AFM file format into Python Numpy arrays.""" |
2 | 2 |
|
3 | | -from __future__ import annotations |
4 | 3 | from importlib import resources |
5 | 4 | from pathlib import Path |
6 | 5 |
|
|
12 | 11 |
|
13 | 12 | logger.enable(__package__) |
14 | 13 |
|
| 14 | +# pylint: disable=too-many-locals |
| 15 | + |
15 | 16 |
|
16 | 17 | def _jpk_pixel_to_nm_scaling(tiff_page: tifffile.tifffile.TiffPage, jpk_tags: dict[str, int]) -> float: |
17 | 18 | """ |
@@ -141,11 +142,13 @@ def _get_z_scaling(tif: tifffile.tifffile, channel_idx: int, jpk_tags: dict[str, |
141 | 142 | for value in values: |
142 | 143 | if tif.pages[channel_idx].tags[str(value)].value == default_slot.value: |
143 | 144 | _default_slot = slot |
144 | | - |
| 145 | + # pylint: disable=possibly-used-before-assignment |
145 | 146 | # Determine if the default slot requires scaling and find scaling and offset values |
146 | 147 | scaling_type = _get_tag_value( |
147 | | - tif.pages[channel_idx], str(int(jpk_tags["first_scaling_type"]) + (jpk_tags["slot_size"] * (_default_slot))) |
| 148 | + tif.pages[channel_idx], |
| 149 | + str(int(jpk_tags["first_scaling_type"]) + (jpk_tags["slot_size"] * (_default_slot))), |
148 | 150 | ) |
| 151 | + # pylint: enable=possibly-used-before-assignment |
149 | 152 | if scaling_type == "LinearScaling": |
150 | 153 | scaling_name = ( |
151 | 154 | tif.pages[channel_idx] |
@@ -203,7 +206,9 @@ def load_jpk( |
203 | 206 | Load height trace channel from the .jpk file. 'height_trace' is the default channel name. |
204 | 207 |
|
205 | 208 | >>> from AFMReader.jpk import load_jpk |
206 | | - >>> image, pixel_to_nanometre_scaling_factor = load_jpk(file_path="./my_jpk_file.jpk", channel="height_trace", flip_image=True) |
| 209 | + >>> image, pixel_to_nanometre_scaling_factor = load_jpk(file_path="./my_jpk_file.jpk", |
| 210 | + >>> channel="height_trace", |
| 211 | + >>> flip_image=True) |
207 | 212 | """ |
208 | 213 | logger.info(f"Loading image from : {file_path}") |
209 | 214 | file_path = Path(file_path) |
|
0 commit comments