From 7002582456c6a5480b985b797291c8e59ac8bcf2 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Tue, 4 Oct 2022 22:01:27 +0800 Subject: [PATCH] tweaks to fit Numpydoc standards --- csst_proto/flip_image.py | 30 +++++++++++++++++++++++------- csst_proto/some_other_modules.py | 15 ++++++++++++++- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/csst_proto/flip_image.py b/csst_proto/flip_image.py index 9461462..d10254c 100644 --- a/csst_proto/flip_image.py +++ b/csst_proto/flip_image.py @@ -1,24 +1,27 @@ import numpy as np -from astropy import table from . import PACKAGE_PATH # the main algorithm def flip_image(img: np.ndarray) -> np.ndarray: - """ flip an input image + """ + Flip an input image. This function uses an awesome algorithm to flip an input image. Parameters ---------- - img: - the input image + img : np.ndarray + The input image. Returns ------- - img_flipped: np.ndarray - the flipped image + np.ndarray + The flipped image. + Examples + -------- + >>> flip_image(np.array([1, 2], [3, 4])) """ try: assert img.ndim == 2 @@ -30,7 +33,20 @@ def flip_image(img: np.ndarray) -> np.ndarray: # a demo on how to read test image def read_test_image(): - """ read test image """ + """ + Read test image. + + This function reads the test image associated with this package. + + Returns + ------- + np.ndarray + The test image. + + Examples + -------- + >>> test_image = read_test_image() + """ fp_img = PACKAGE_PATH + "/data/test_image.txt" print("reading file {} ...".format(fp_img)) return np.loadtxt(fp_img, dtype=int) diff --git a/csst_proto/some_other_modules.py b/csst_proto/some_other_modules.py index 3c73225..e9c2417 100644 --- a/csst_proto/some_other_modules.py +++ b/csst_proto/some_other_modules.py @@ -1,3 +1,16 @@ def a_demo_function(*args): - """ a demo function """ + """ + A demo function. + + This function is a demo. + + Parameters + ---------- + *args : any + The argument list. + + Examples + -------- + >>> a_demo_function(None) + """ return None -- GitLab