Skip to content

Commit a78c218

Browse files
authored
Merge pull request #143 from AFM-SPM/ns-rse/142-drop-python-3-9
2 parents cb92e05 + fd3cb1a commit a78c218

13 files changed

Lines changed: 16 additions & 22 deletions

File tree

.github/workflows/pypi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Python
2323
uses: actions/setup-python@v5
2424
with:
25-
python-version: 3.9
25+
python-version: 3.11
2626
- name: Installing the package
2727
run: |
2828
pip3 install .

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
15-
python-version: ['3.9', '3.10', '3.11', '3.12']
15+
python-version: ['3.10', '3.11', '3.12']
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Set up Python

AFMReader/asd.py

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

3-
from __future__ import annotations
43
import errno
54
import os
65
from pathlib import Path
@@ -232,8 +231,7 @@ def load_asd(file_path: str | Path, channel: str):
232231
header_dict = read_header_file_version_2(open_file)
233232
else:
234233
raise ValueError(
235-
f"File version {file_version} unknown. Please add support if you "
236-
"know how to decode this file version."
234+
f"File version {file_version} unknown. Please add support if you know how to decode this file version."
237235
)
238236
logger.debug(f"header dict: \n{header_dict}")
239237

@@ -250,7 +248,7 @@ def load_asd(file_path: str | Path, channel: str):
250248
if channel == header_dict["channel1"]:
251249
logger.info(f"Requested channel {channel} matches first channel in file: {header_dict['channel1']}")
252250
elif channel == header_dict["channel2"]:
253-
logger.info(f"Requested channel {channel} matches second channel in file: " f"{header_dict['channel2']}")
251+
logger.info(f"Requested channel {channel} matches second channel in file: {header_dict['channel2']}")
254252

255253
# Skip first channel data
256254
_size_of_frame_header = header_dict["frame_header_length"]
@@ -818,7 +816,7 @@ def create_analogue_digital_converter(
818816
)
819817
else:
820818
raise ValueError(
821-
f"Analogue to digital range hex value {analogue_digital_range} has no known " "analogue-digital mapping."
819+
f"Analogue to digital range hex value {analogue_digital_range} has no known analogue-digital mapping."
822820
)
823821
logger.info(f"Analogue to digital mapping | Range: {analogue_digital_range} -> {mapping}")
824822
logger.info(f"Converter: {converter}")

AFMReader/general_loader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Switchboard for input files."""
22

3-
from __future__ import annotations
43
from pathlib import Path
54

65
import numpy.typing as npt

AFMReader/gwy.py

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

3-
from __future__ import annotations
43
from pathlib import Path
54
import re
65
from typing import Any, BinaryIO
@@ -11,7 +10,7 @@
1110
from AFMReader.io import read_uint32, read_null_terminated_string, read_char, read_double
1211

1312

14-
def load_gwy(file_path: Path | str, channel: str) -> tuple[np.ndarray[Any, np.dtypes.Float64DType], float]:
13+
def load_gwy(file_path: Path | str, channel: str) -> tuple[np.ndarray[Any, np.float64], float]:
1514
"""
1615
Extract image and pixel to nm scaling from the .gwy file.
1716

AFMReader/ibw.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""For decoding and loading .ibw AFM file format into Python Numpy arrays."""
22

3-
from __future__ import annotations
43
import errno
54
import os
65
from pathlib import Path

AFMReader/io.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""For reading and writing data from / to files."""
22

3-
from __future__ import annotations
43
from pathlib import Path
54

65
import struct

AFMReader/jpk.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""For decoding and loading .jpk AFM file format into Python Numpy arrays."""
22

3-
from __future__ import annotations
43
from importlib import resources
54
from pathlib import Path
65

@@ -12,6 +11,8 @@
1211

1312
logger.enable(__package__)
1413

14+
# pylint: disable=too-many-locals
15+
1516

1617
def _jpk_pixel_to_nm_scaling(tiff_page: tifffile.tifffile.TiffPage, jpk_tags: dict[str, int]) -> float:
1718
"""
@@ -141,11 +142,13 @@ def _get_z_scaling(tif: tifffile.tifffile, channel_idx: int, jpk_tags: dict[str,
141142
for value in values:
142143
if tif.pages[channel_idx].tags[str(value)].value == default_slot.value:
143144
_default_slot = slot
144-
145+
# pylint: disable=possibly-used-before-assignment
145146
# Determine if the default slot requires scaling and find scaling and offset values
146147
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))),
148150
)
151+
# pylint: enable=possibly-used-before-assignment
149152
if scaling_type == "LinearScaling":
150153
scaling_name = (
151154
tif.pages[channel_idx]
@@ -203,7 +206,9 @@ def load_jpk(
203206
Load height trace channel from the .jpk file. 'height_trace' is the default channel name.
204207
205208
>>> 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)
207212
"""
208213
logger.info(f"Loading image from : {file_path}")
209214
file_path = Path(file_path)

AFMReader/spm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""For decoding and loading .spm AFM file format into Python Numpy arrays."""
22

3-
from __future__ import annotations
43
from pathlib import Path
54

65
import pySPM

AFMReader/stp.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""For decoding and loading .stp AFM file format into Python Numpy arrays."""
22

3-
from __future__ import annotations
43
from pathlib import Path
54
import re
65

0 commit comments

Comments
 (0)