Esempio n. 1
0
 def _combineResults(self):
     smartLenOfResults = len(
         list(resultsWithoutNone(self._childResults, ignoreNans=True)))
     if smartLenOfResults == 0:
         self._result = None
     else:
         self._result = float(smartSum(self._childResults,
                                       ignoreNans=True)) / smartLenOfResults
Esempio n. 2
0
 def _combineResults(self):
     allKeys = reduce(
         lambda l1, l2: l1 + l2,
         [childDict.keys() for childDict in self._childResults])
     uniqueKeys = set(allKeys)
     self._result = OrderedDict([
         (key, smartSum([res.get(key) for res in self._childResults]))
         for key in uniqueKeys
     ])
     return self._result
 def _combineResults(self):
     allKeys = reduce(lambda l1,l2:l1+l2, [childDict['stateBPCounter'].keys() for childDict in self._childResults])
     uniqueKeys = set(allKeys)
     #print 'uniqueKeys: ', uniqueKeys
     tmp = dict([ (key, smartSum([res['stateBPCounter'].get(key) for res in self._childResults])) for key in uniqueKeys ])
     res = {'catInfo':self._childResults[0]['catInfo']}
     res['stateBPCounter'] = tmp
     res['genome'] = self.getGenome()
     self._result = res
     #self._result = {'result':res}
     #print 'self._result: ', self._result
     
     return self._result
 def _combineResults(self):
     res = OrderedDict()
     for childDict in self._childResults:
         for key1 in childDict.keys():
             if key1 not in res:
                 res[key1] = copy(childDict[key1])
             else:
                 for key2 in childDict[key1]:
                     if key2 in res[key1]:
                         res[key1][key2] = smartSum((res[key1][key2], childDict[key1][key2]))
                     else:
                         res[key1][key2] = childDict[key1][key2]
     self._result = res
     return self._result
Esempio n. 5
0
 def _combineResults(self):
     res = OrderedDict()
     for childDict in self._childResults:
         for key1 in childDict.keys():
             if key1 not in res:
                 res[key1] = copy(childDict[key1])
             else:
                 for key2 in childDict[key1]:
                     if key2 in res[key1]:
                         res[key1][key2] = smartSum((res[key1][key2], childDict[key1][key2]))
                     else:
                         res[key1][key2] = childDict[key1][key2]
     self._result = res
     return self._result
 def _combineResults(self):
     self._result = OrderedDict([ (key, smartSum([res[key] for res in self._childResults])) for key in self._childResults[0] ])
 def _combineResults(self):
     self._result = smartSum(self._childResults)
 def testSmartSum(self):
     self.assertEqual(6, smartSum([1, 2, 3]))
     self.assertEqual(3, smartSum([1, 2, None]))
     self.assertEqual(None, smartSum([None, None, None]))
     self.assertEqual(0, smartSum([]))
     self.assertRaises(TypeError, smartSum['a', 'b'])
Esempio n. 9
0
 def _combineResults(self):
     allKeys = reduce(lambda l1,l2:l1+l2, [childDict.keys() for childDict in self._childResults])
     uniqueKeys = set(allKeys)
     self._result = OrderedDict([ (key, smartSum([res.get(key) for res in self._childResults])) for key in uniqueKeys ])
     return self._result
Esempio n. 10
0
 def _combineResults(self):
     self._result = OrderedDict([ (key, smartSum([res[key] for res in self._childResults])) for key in self._childResults[0] ])
Esempio n. 11
0
 def _combineResults(self):
     self._result = smartSum(self._childResults)