Store a copy of params in CurveCommand._add_to_command_stack.
authorW. Trevor King <wking@drexel.edu>
Mon, 30 Aug 2010 17:56:49 +0000 (13:56 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 30 Aug 2010 17:56:49 +0000 (13:56 -0400)
We may modify the parameter dict later during the command's execution,
and we want future runs via the command stack to replicate the first
run from the raw initial parameters.  If you don't do this, you'll get
errors like

    $ ./bin/hk.py
        -c 'load_playlist test/data/vclamp_picoforce/playlist'
        -c 'start_command_capture'
        -c 'zero_surface_contact_point --block approach'
        -c 'zero_surface_contact_point --block retract'
        -c 'stop_command_capture'
        -c 'apply_command_stack_to_playlist --enable-evaluate'
        -c 'flat_filter_playlist --block retract --min_points 1'
    Success
    ...
    Failure
    Expected a list of Peaks, not <class 'hooke.command.Failure'>:
      surface distance (m) not in retract (['z piezo (m)', 'deflection (m)',
      'surface distance (m) (m)', 'surface deflection (m) (m)']):...

where the units '(m)' were appended twice, once during the initial
command run, and again during the reload's command stack exectution.

hooke/plugin/curve.py

index 5df5629f776d1b2c48a096deae4c8e006d8f2778..b287ee4fa11bd5ad96f10de2269c6523ebd81bad 100644 (file)
@@ -137,7 +137,7 @@ class CurveCommand (Command):
                 pass  # no need to place duplicate calls on the stack.
             else:
                 curve.command_stack.append(CommandMessage(
                 pass  # no need to place duplicate calls on the stack.
             else:
                 curve.command_stack.append(CommandMessage(
-                        self.name, params))
+                        self.name, dict(params)))
 
 
 class BlockCommand (CurveCommand):
 
 
 class BlockCommand (CurveCommand):