diff options
author | Ben Reynwar <ben@reynwar.net> | 2012-08-14 07:12:53 -0700 |
---|---|---|
committer | Ben Reynwar <ben@reynwar.net> | 2012-08-14 07:22:43 -0700 |
commit | 3e46aef392ba9b2e63bbfefefdb7178cc87049ab (patch) | |
tree | 942e3a7a78344b638859b9f65ce37cacb070eb01 /gr-wxgui/src/python/plotter | |
parent | fe96ee8d82b2666951cf3cef8f7f5d991396273f (diff) |
docs: Changed arguments in python docstrings to new formatting style.
Diffstat (limited to 'gr-wxgui/src/python/plotter')
-rw-r--r-- | gr-wxgui/src/python/plotter/bar_plotter.py | 18 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/channel_plotter.py | 34 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/common.py | 34 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/grid_plotter_base.py | 106 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/plotter_base.py | 12 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/waterfall_plotter.py | 38 |
6 files changed, 167 insertions, 75 deletions
diff --git a/gr-wxgui/src/python/plotter/bar_plotter.py b/gr-wxgui/src/python/plotter/bar_plotter.py index 3f9259e9df..487db66b64 100644 --- a/gr-wxgui/src/python/plotter/bar_plotter.py +++ b/gr-wxgui/src/python/plotter/bar_plotter.py @@ -108,9 +108,13 @@ class bar_plotter(grid_plotter_base): Get the text the will populate the point label. Give X and Y values for the current point. Give values for the channel at the X coordinate. - @param x_val the current x value - @param y_val the current y value - @return a string with newlines + + Args: + x_val: the current x value + y_val: the current y value + + Returns: + a string with newlines """ if len(self._bars) == 0: return '' scalar = float(len(self._bars)-1)/(self.x_max - self.x_min) @@ -130,9 +134,11 @@ class bar_plotter(grid_plotter_base): def set_bars(self, bars, bar_width, color_spec): """ Set the bars. - @param bars a list of bars - @param bar_width the fractional width of the bar, between 0 and 1 - @param color_spec the color tuple + + Args: + bars: a list of bars + bar_width: the fractional width of the bar, between 0 and 1 + color_spec: the color tuple """ self.lock() self._bars = bars diff --git a/gr-wxgui/src/python/plotter/channel_plotter.py b/gr-wxgui/src/python/plotter/channel_plotter.py index 4bcc36fd4c..1eac9f5f3a 100644 --- a/gr-wxgui/src/python/plotter/channel_plotter.py +++ b/gr-wxgui/src/python/plotter/channel_plotter.py @@ -67,8 +67,12 @@ class channel_plotter(grid_plotter_base): def enable_legend(self, enable=None): """ Enable/disable the legend. - @param enable true to enable - @return the enable state when None + + Args: + enable: true to enable + + Returns: + the enable state when None """ if enable is None: return self._enable_legend self.lock() @@ -128,9 +132,13 @@ class channel_plotter(grid_plotter_base): Get the text the will populate the point label. Give X and Y values for the current point. Give values for the channel at the X coordinate. - @param x_val the current x value - @param y_val the current y value - @return a string with newlines + + Args: + x_val: the current x value + y_val: the current y value + + Returns: + a string with newlines """ #create text label_str = '%s: %s\n%s: %s'%( @@ -186,7 +194,9 @@ class channel_plotter(grid_plotter_base): def clear_waveform(self, channel): """ Remove a waveform from the list of waveforms. - @param channel the channel key + + Args: + channel: the channel key """ self.lock() if channel in self._channels.keys(): @@ -198,11 +208,13 @@ class channel_plotter(grid_plotter_base): def set_waveform(self, channel, samples=[], color_spec=(0, 0, 0), marker=None, trig_off=0): """ Set the waveform for a given channel. - @param channel the channel key - @param samples the waveform samples - @param color_spec the 3-tuple for line color - @param marker None for line - @param trig_off fraction of sample for trigger offset + + Args: + channel: the channel key + samples: the waveform samples + color_spec: the 3-tuple for line color + marker: None for line + trig_off: fraction of sample for trigger offset """ self.lock() if channel not in self._channels.keys(): self._legend_cache.changed(True) diff --git a/gr-wxgui/src/python/plotter/common.py b/gr-wxgui/src/python/plotter/common.py index 88215e039a..9af636245d 100644 --- a/gr-wxgui/src/python/plotter/common.py +++ b/gr-wxgui/src/python/plotter/common.py @@ -30,8 +30,12 @@ import wx def get_exp(num): """ Get the exponent of the number in base 10. - @param num the floating point number - @return the exponent as an integer + + Args: + num: the floating point number + + Returns: + the exponent as an integer """ if num == 0: return 0 return int(math.floor(math.log10(abs(num)))) @@ -41,8 +45,12 @@ def get_si_components(num): Get the SI units for the number. Extract the coeff and exponent of the number. The exponent will be a multiple of 3. - @param num the floating point number - @return the tuple coeff, exp, prefix + + Args: + num: the floating point number + + Returns: + the tuple coeff, exp, prefix """ num = float(num) exp = get_exp(num) @@ -65,8 +73,12 @@ def get_si_components(num): def sci_format(num): """ Format a floating point number into scientific notation. - @param num the number to format - @return a label string + + Args: + num: the number to format + + Returns: + a label string """ coeff, exp, prefix = get_si_components(num) if -3 <= exp < 3: return '%g'%num @@ -75,9 +87,13 @@ def sci_format(num): def eng_format(num, units=''): """ Format a floating point number into engineering notation. - @param num the number to format - @param units the units to append - @return a label string + + Args: + num: the number to format + units: the units to append + + Returns: + a label string """ coeff, exp, prefix = get_si_components(num) if -3 <= exp < 3: return '%g'%num diff --git a/gr-wxgui/src/python/plotter/grid_plotter_base.py b/gr-wxgui/src/python/plotter/grid_plotter_base.py index f1bc8f546d..a492539575 100644 --- a/gr-wxgui/src/python/plotter/grid_plotter_base.py +++ b/gr-wxgui/src/python/plotter/grid_plotter_base.py @@ -78,7 +78,9 @@ class grid_plotter_base(plotter_base): def set_point_label_coordinate(self, coor): """ Set the point label coordinate. - @param coor the coordinate x, y tuple or None + + Args: + coor: the coordinate x, y tuple or None """ self.lock() self._point_label_coordinate = coor @@ -103,8 +105,12 @@ class grid_plotter_base(plotter_base): Enable/disable the grid aspect ratio. If enabled, enforce the aspect ratio on the padding: horizontal_padding:vertical_padding == width:height - @param enable true to enable - @return the enable state when None + + Args: + enable: true to enable + + Returns: + the enable state when None """ if enable is None: return self._enable_grid_aspect_ratio self.lock() @@ -115,8 +121,12 @@ class grid_plotter_base(plotter_base): def enable_point_label(self, enable=None): """ Enable/disable the point label. - @param enable true to enable - @return the enable state when None + + Args: + enable: true to enable + + Returns: + the enable state when None """ if enable is None: return self._enable_point_label self.lock() @@ -127,7 +137,9 @@ class grid_plotter_base(plotter_base): def set_title(self, title): """ Set the title. - @param title the title string + + Args: + title the title string """ self.lock() self.title = title @@ -137,8 +149,10 @@ class grid_plotter_base(plotter_base): def set_x_label(self, x_label, x_units=''): """ Set the x label and units. - @param x_label the x label string - @param x_units the x units string + + Args: + x_label: the x label string + x_units: the x units string """ self.lock() self.x_label = x_label @@ -149,8 +163,10 @@ class grid_plotter_base(plotter_base): def set_y_label(self, y_label, y_units=''): """ Set the y label and units. - @param y_label the y label string - @param y_units the y units string + + Args: + y_label: the y label string + y_units: the y units string """ self.lock() self.y_label = y_label @@ -161,10 +177,12 @@ class grid_plotter_base(plotter_base): def set_x_grid(self, minimum, maximum, step, scale=False): """ Set the x grid parameters. - @param minimum the left-most value - @param maximum the right-most value - @param step the grid spacing - @param scale true to scale the x grid + + Args: + minimum: the left-most value + maximum: the right-most value + step: the grid spacing + scale: true to scale the x grid """ self.lock() self.x_min = float(minimum) @@ -183,10 +201,12 @@ class grid_plotter_base(plotter_base): def set_y_grid(self, minimum, maximum, step, scale=False): """ Set the y grid parameters. - @param minimum the bottom-most value - @param maximum the top-most value - @param step the grid spacing - @param scale true to scale the y grid + + Args: + minimum: the bottom-most value + maximum: the top-most value + step: the grid spacing + scale: true to scale the y grid """ self.lock() self.y_min = float(minimum) @@ -305,9 +325,13 @@ class grid_plotter_base(plotter_base): def _get_tick_label(self, tick, unit): """ Format the tick value and create a gl text. - @param tick the floating point tick value - @param unit the axis unit - @return the tick label text + + Args: + tick: the floating point tick value + unit: the axis unit + + Returns: + the tick label text """ if unit: tick_str = common.sci_format(tick) else: tick_str = common.eng_format(tick) @@ -316,11 +340,15 @@ class grid_plotter_base(plotter_base): def _get_ticks(self, min, max, step, scalar): """ Determine the positions for the ticks. - @param min the lower bound - @param max the upper bound - @param step the grid spacing - @param scalar the grid scaling - @return a list of tick positions between min and max + + Args: + min: the lower bound + max: the upper bound + step: the grid spacing + scalar: the grid scaling + + Returns: + a list of tick positions between min and max """ #cast to float min = float(min) @@ -340,8 +368,12 @@ class grid_plotter_base(plotter_base): def enable_grid_lines(self, enable=None): """ Enable/disable the grid lines. - @param enable true to enable - @return the enable state when None + + Args: + enable: true to enable + + Returns: + the enable state when None """ if enable is None: return self._enable_grid_lines self.lock() @@ -352,8 +384,10 @@ class grid_plotter_base(plotter_base): def _draw_grid_line(self, coor1, coor2): """ Draw a dashed line from coor1 to coor2. - @param corr1 a tuple of x, y - @param corr2 a tuple of x, y + + Args: + corr1: a tuple of x, y + corr2: a tuple of x, y """ if not self.enable_grid_lines(): return length = math.sqrt((coor1[0] - coor2[0])**2 + (coor1[1] - coor2[1])**2) @@ -372,11 +406,13 @@ class grid_plotter_base(plotter_base): """ Draw a rectangle on the x, y plane. X and Y are the top-left corner. - @param x the left position of the rectangle - @param y the top position of the rectangle - @param width the width of the rectangle - @param height the height of the rectangle - @param fill true to color inside of rectangle + + Args: + x: the left position of the rectangle + y: the top position of the rectangle + width: the width of the rectangle + height: the height of the rectangle + fill: true to color inside of rectangle """ GL.glBegin(fill and GL.GL_QUADS or GL.GL_LINE_LOOP) GL.glVertex2f(x, y) diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py index 2fdd0f20ab..3ad1e81582 100644 --- a/gr-wxgui/src/python/plotter/plotter_base.py +++ b/gr-wxgui/src/python/plotter/plotter_base.py @@ -37,7 +37,9 @@ class gl_cache(object): def __init__(self, draw): """ Create a new cache. - @param draw a function to draw gl stuff + + Args: + draw: a function to draw gl stuff """ self.changed(True) self._draw = draw @@ -84,7 +86,9 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): Initialize the GLCanvas with double buffering. Initialize various plotter flags. Bind the paint and size events. - @param parent the parent widgit + + Args: + parent: the parent widgit """ attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA) wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList); @@ -111,7 +115,9 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): """ Create a new gl cache. Register its draw and init function. - @return the new cache object + + Returns: + the new cache object """ cache = gl_cache(draw_fcn) self.register_init(cache.init) diff --git a/gr-wxgui/src/python/plotter/waterfall_plotter.py b/gr-wxgui/src/python/plotter/waterfall_plotter.py index 6a6bf6330e..02ec67ee4c 100644 --- a/gr-wxgui/src/python/plotter/waterfall_plotter.py +++ b/gr-wxgui/src/python/plotter/waterfall_plotter.py @@ -49,8 +49,12 @@ def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]): The x and y values of the coordinates range from 0 to 1. The coordinates must be specified so that x increases with the index value. Resulting values are calculated along the line formed between 2 coordinates. - @param *_pts an array of x,y coordinates for each color element - @return array of rbga values (4 bytes) each + + Args: + red_pts, green_pts, blue_pts, alpha_pts: an array of x,y coordinates for each color element + + Returns: + array of rbga values (4 bytes) each """ def _fcn(x, pw): for (x1, y1), (x2, y2) in zip(pw, pw[1:]): @@ -167,9 +171,13 @@ class waterfall_plotter(grid_plotter_base): """ Get the text the will populate the point label. Give the X value for the current point. - @param x_val the current x value - @param y_val the current y value - @return a value string with units + + Args: + x_val: the current x value + y_val: the current y value + + Returns: + a value string with units """ return '%s: %s'%(self.x_label, common.eng_format(x_val, self.x_units)) @@ -210,7 +218,9 @@ class waterfall_plotter(grid_plotter_base): def _resize_texture(self, flag=None): """ Create the texture to fit the fft_size X num_lines. - @param flag the set/unset or update flag + + Args: + flag: the set/unset or update flag """ if flag is not None: self._resize_texture_flag = flag @@ -229,7 +239,9 @@ class waterfall_plotter(grid_plotter_base): Set the color mode. New samples will be converted to the new color mode. Old samples will not be recolorized. - @param color_mode the new color mode string + + Args: + color_mode: the new color mode string """ self.lock() if color_mode in COLORS.keys(): @@ -242,7 +254,9 @@ class waterfall_plotter(grid_plotter_base): """ Set number of lines. Powers of two only. - @param num_lines the new number of lines + + Args: + num_lines: the new number of lines """ self.lock() self._num_lines = num_lines @@ -254,9 +268,11 @@ class waterfall_plotter(grid_plotter_base): """ Set the samples to the waterfall. Convert the samples to color data. - @param samples the array of floats - @param minimum the minimum value to scale - @param maximum the maximum value to scale + + Args: + samples: the array of floats + minimum: the minimum value to scale + maximum: the maximum value to scale """ self.lock() #set the min, max values |