self._settings.append(argument_to_setting(
self.setting_section, argument))
argument.default = None # if argument isn't given, use the config.
- self._commands = [FlatPeaksCommand(self), FlatFilterCommand(self)]
+ self._commands = [FlatPeaksCommand(self)]
+ # append FlatFilterCommand so it can steal arguments from
+ # FlatPeaksCommand.
+ self._commands.append(FlatFilterCommand(self))
def dependencies(self):
return ['vclamp']
raise Failure('%s operates on VelocityClamp experiments, not %s'
% (self.name, curve.info['experiment']))
for key,value in params.items():
- if value == None: # Use configured default value.
+ if value == None and key in self.plugin.config:
+ # Use configured default value.
params[key] = self.plugin.config[key]
# TODO: convert 'see double' from nm to points
name,def_unit = split_data_label(params['deflection column'])
FlatPeaksCommand : Underlying flat-based peak detection.
"""
def __init__(self, plugin):
+ flat_peaks = [c for c in plugin._commands
+ if c.name == 'flat filter peaks'][0]
+ flat_peaks_arg_names = [a.name for a in flat_peaks.arguments]
+ plugin_arguments = [a for a in plugin._arguments
+ if a.name not in flat_peaks_arg_names]
+ arguments = flat_peaks.arguments + plugin_arguments
super(FlatFilterCommand, self).__init__(
plugin, name='flat filter playlist')
- self.arguments.extend(plugin._arguments) # TODO: curve & block arguments
+ self.arguments.extend(arguments)
def filter(self, curve, hooke, inqueue, outqueue, params):
params['curve'] = curve
return False
if not (isinstance(peaks, list) and (len(peaks) == 0
or isinstance(peaks[0], Peak))):
- raise Failure('Expected a list of Peaks, not %s' % peaks)
+ raise Failure('Expected a list of Peaks, not %s: %s'
+ % (type(peaks), peaks))
ret = outq.get()
if not isinstance(ret, Success):
raise ret