def average(self, target=None): dats = [] while True: dats.append((yield)) try: # root name change detection if self.lastname != dats[-1].rootname: dats = dats[-1:] except IndexError: pass self.lastname = dats[-1].rootname if target: goodDats = dat.rejection(dats) if goodDats is not None: target.send(dat.average(goodDats))
def average_water(self, target=None): dats = [] lastname = '' while True: dats.append((yield)) try: # root name change detection if lastname != dats[-1].rootname: dats = dats[-1:] except IndexError: pass lastname = dats[-1].rootname if target: goodDats = dat.rejection(dats) if goodDats is not None: datavg = dat.average(goodDats) datavg.filename = os.path.join(datavg.dirname, 'water_' + datavg.basename) target.send(datavg) else: print('None!!')