From d9ec44a5d49791748141ee5104c775cba7133ec7 Mon Sep 17 00:00:00 2001 From: Neil Shephard Date: Tue, 30 Apr 2024 16:47:59 +0100 Subject: [PATCH] docs: doctest format for example in docstring Re-writing example in docstring to use [doctest format](https://numpydoc.readthedocs.io/en/latest/format.html#examples). Minor tpyo in README.md corrected. --- README.md | 2 +- topofileformats/ibw.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1f090dd..a6a8486 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ frames, pixel_to_nanometre_scaling_factor, metadata = load_asd(file_path="./my_a You can open `.ibw` files using the `load_ibw` function. Just pass in the path to the file and the channel name that you want to use. (If in doubt, use `HeightTracee` (yes, with the -exta 'e'), `ZSensorTrace`, or `ZSensor`). +extra 'e'), `ZSensorTrace`, or `ZSensor`). ```python from topofileformats.ibw import load_ibw diff --git a/topofileformats/ibw.py b/topofileformats/ibw.py index bf55c92..8fceed9 100644 --- a/topofileformats/ibw.py +++ b/topofileformats/ibw.py @@ -63,12 +63,11 @@ def load_ibw(file_path: Path | str, channel: str) -> tuple[np.ndarray, float]: Examples -------- - ```python - from topofileformats.ibw import load_ibw - # Load the image and pixel to nanometre scaling factor - HeightTracee is the default channel name - # (yes, with the extra e) - image, pixel_to_nanometre_scaling_factor = load_ibw(file_path="./my_ibw_file.ibw", channel="HeightTracee") - ``` + Load the image and pixel to nanometre scaling factor - 'HeightTracee' is the default channel name (the extra 'e' is + not a typo!). + + >>> from topofileformats.ibw import load_ibw + >>> image, pixel_to_nanometre_scaling_factor = load_ibw(file_path="./my_ibw_file.ibw", channel="HeightTracee") """ logger.info(f"Loading image from : {file_path}") file_path = Path(file_path)