1111
1212# guitest: show
1313
14+ from typing import Any
15+
1416from guidata .qthelpers import exec_dialog , qt_app_context
1517from numpy import linspace , sin
1618
1921from plotpy .tools import DownSampleCurveTool , EditPointTool
2022
2123
22- def callback_function (tool : EditPointTool ):
24+ def callback_function (tool : EditPointTool ) -> None :
2325 """Callback that is called by the tool when the user stops clicking. Just prints
2426 the new arrays and the changes.
2527
@@ -31,9 +33,17 @@ def callback_function(tool: EditPointTool):
3133 print ("Indexed changes:" , tool .get_changes ())
3234
3335
34- def edit_downsampled_curve (downsampling_factor : int , * args ):
36+ def edit_downsampled_curve (downsampling_factor : int , * args ) -> tuple [ Any , ...] :
3537 """
3638 Plot curves and return selected point(s) coordinates
39+
40+ Args:
41+ downsampling_factor: downsampling factor (>=1)
42+ *args: arguments to be passed to the plotpy builder make.mcurve function
43+
44+ Returns:
45+ Modified *args input that can be used in another call to this function to check
46+ the interaction between edit tool and the donwsampling tool.
3747 """
3848 win = make .dialog (
3949 wintitle = _ ("Select one point then press OK to accept" ),
@@ -65,8 +75,8 @@ def edit_downsampled_curve(downsampling_factor: int, *args):
6575 return args
6676
6777
68- def test_edit_curve () :
69- """Test"""
78+ def test_downsample_curve () -> None :
79+ """Test the downsample curve tool. """
7080 with qt_app_context (exec_loop = False ):
7181 nlines = 1000
7282 x = linspace (- 10 , 10 , num = nlines )
@@ -78,4 +88,4 @@ def test_edit_curve():
7888
7989
8090if __name__ == "__main__" :
81- test_edit_curve ()
91+ test_downsample_curve ()
0 commit comments