def deriveMetric(input, first, second, oper): # derive the metric derivor = DeriveMetricOperation(input, first, second, oper) derived = derivor.processData().get(0) newName = derived.getMetrics().toArray()[0] # merge new metric with the trial merger = MergeTrialsOperation(input) merger.addInput(derived) merged = merger.processData().get(0) #print "new metric: " + newName return merged, newName
def scaleMetric(input, metric, value, oper): # derive the metric scaler = ScaleMetricOperation(input, metric, value, oper) scaled = scaler.processData().get(0) newName = scaled.getMetrics().toArray()[0] # merge new metric with the trial merger = MergeTrialsOperation(input) merger.addInput(scaled) merged = merger.processData().get(0) #print "new metric: " + newName return merged, newName
def deriveMetric(input, first, second, oper): # derive the metric derivor = DeriveMetricOperation(input, first, second, oper) # check to see if this metric already has been derived merged = None newName = None if (derivor.exists()): print "Exists: ", newName merged = input newName = derivor.getNewName() else: derived = derivor.processData().get(0) newName = derivor.getNewName() # merge new metric with the trial merger = MergeTrialsOperation(input) merger.addInput(derived) merged = merger.processData().get(0) # save the newly derived metric # saver = SaveResultOperation(derived) # saver.setForceOverwrite(False) # saver.processData() print "new metric: ", newName return merged, newName