Remove differentiation reference from difference's column argument help.
[hooke.git] / hooke / plugin / curve.py
index 9471318f81582f2055f259a145ffd9b66121104a..158cb772a3e2c4ba31dcaf0aa4284c24e93c2f92 100644 (file)
@@ -5,15 +5,15 @@
 #
 # This file is part of Hooke.
 #
-# Hooke is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-# Hooke is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
+# Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
 # License along with Hooke.  If not, see
@@ -38,7 +38,7 @@ class CurvePlugin (Builtin):
     def __init__(self):
         super(CurvePlugin, self).__init__(name='curve')
         self._commands = [
-            InfoCommand(self), ExportCommand(self),
+            GetCommand(self), InfoCommand(self), ExportCommand(self),
             DifferenceCommand(self), DerivativeCommand(self),
             PowerSpectrumCommand(self)]
 
@@ -64,6 +64,17 @@ of the current playlist.
 
 # Define commands
 
+class GetCommand (Command):
+    """Return a :class:`hooke.curve.Curve`.
+    """
+    def __init__(self, plugin):
+        super(GetCommand, self).__init__(
+            name='get curve', arguments=[CurveArgument],
+            help=self.__doc__, plugin=plugin)
+
+    def _run(self, hooke, inqueue, outqueue, params):
+        outqueue.put(params['curve'])
+
 class InfoCommand (Command):
     """Get selected information about a :class:`hooke.curve.Curve`.
     """
@@ -152,7 +163,7 @@ True if you want the column-naming header line.
             help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
-        data = params['curve'].data[int(params['block'])] # HACK, int() should be handled by ui
+        data = params['curve'].data[params['block']]
 
         f = open(params['output'], 'w')
         if params['header'] == True:
@@ -161,11 +172,7 @@ True if you want the column-naming header line.
         f.close()
 
 class DifferenceCommand (Command):
-    """Calculate the derivative (actually, the discrete differentiation)
-    of a curve data block.
-
-    See :func:`hooke.util.calculus.derivative` for implementation
-    details.
+    """Calculate the difference between two blocks of data.
     """
     def __init__(self, plugin):
         super(DifferenceCommand, self).__init__(
@@ -183,11 +190,11 @@ approaching curve and `1` selects the retracting curve.
                          help='Block B in A-B.'),
                 Argument(name='x column', type='int', default=0,
                          help="""
-Column of data block to differentiate with respect to.
+Column of data to return as x values.
 """.strip()),
-                Argument(name='f column', type='int', default=1,
+                Argument(name='y column', type='int', default=1,
                          help="""
-Column of data block to differentiate.
+Column of data block to difference.
 """.strip()),
                 ],
             help=self.__doc__, plugin=plugin)
@@ -198,11 +205,15 @@ Column of data block to differentiate.
         assert a[:,params['x column']] == b[:,params['x column']]
         out = Data((a.shape[0],2), dtype=a.dtype)
         out[:,0] = a[:,params['x column']]
-        out[:,1] = a[:,params['f column']] - b[:,params['f column']]
+        out[:,1] = a[:,params['y column']] - b[:,params['y column']]
         outqueue.put(out)
 
 class DerivativeCommand (Command):
-    """Calculate the difference between two blocks of data.
+    """Calculate the derivative (actually, the discrete differentiation)
+    of a curve data block.
+
+    See :func:`hooke.util.calculus.derivative` for implementation
+    details.
     """
     def __init__(self, plugin):
         super(DerivativeCommand, self).__init__(
@@ -249,9 +260,9 @@ class PowerSpectrumCommand (Command):
 Data block to act on.  For an approach/retract force curve, `0`
 selects the approaching curve and `1` selects the retracting curve.
 """.strip()),
-                Argument(name='column', type='int', default=1,
+                Argument(name='column', type='int', default=1,
                          help="""
-Column of data block to differentiate with respect to.
+Column of data block containing time-series data.
 """.strip()),
                 Argument(name='freq', type='float', default=1.0,
                          help="""
@@ -272,6 +283,6 @@ Otherwise, the chunks are end-to-end, and not overlapping.
     def _run(self, hooke, inqueue, outqueue, params):
         data = params['curve'].data[params['block']]
         outqueue.put(unitary_avg_power_spectrum(
-                data[:,params['column']], freq=params['freq'],
+                data[:,params['column']], freq=params['freq'],
                 chunk_size=params['chunk size'],
                 overlap=params['overlap']))