break path = os.path.join(basepath, files) if os.path.isdir(path): for logFile in os.listdir(path): if limit == 0: finished = True break with open(os.path.join(path,logFile), 'r') as h: lines = h.readlines() for line in lines: if line: feature = [features.durationLessThanMinute(line)] feature.extend([features.durationOneToFive(line)]) feature.extend([features.durationFiveOrMore(line)]) feature.extend([features.device(line)]) feature.extend(features.ipFeature(line)) feature.extend(features.timeStartFeature(line)) feature.extend(features.timeEndFeature(line)) arrayOfFeatures.append(feature) limit -= 1 print "limit: ", limit nparray = np.array(arrayOfFeatures) print nparray.shape row, col = nparray.shape plotted = np.divide(np.sum(nparray, axis=0), float(row))
def feature4(self): return features.device(self.line)