def estimateUpperRangeForTimePeriod(timeRange, outputFolder): dataX = [] i=1 for hashtagObject in FileIO.iterateJsonFromFile(hashtagsWithoutEndingWindowFile%(outputFolder,'%s_%s'%timeRange)): print i;i+=1 occuranesInHighestActiveRegion = getOccuranesInHighestActiveRegion(hashtagObject) dataX.append((occuranesInHighestActiveRegion[-1][1]-occuranesInHighestActiveRegion[0][1])/TIME_UNIT_IN_SECONDS) print getOutliersRangeUsingIRQ(dataX) plt.hist(dataX, bins=10) plt.show()
def plotHashtagSourcesOnMap(timeRange, outputFolder): i = 1 distribution = defaultdict(int) for hashtagObject in FileIO.iterateJsonFromFile(hashtagsFile%(outputFolder,'%s_%s'%timeRange)): occuranesInHighestActiveRegion, isFirstActiveRegion = getOccuranesInHighestActiveRegion(hashtagObject, True) if occuranesInHighestActiveRegion: source, count = getSourceLattice(occuranesInHighestActiveRegion) print i, source;i+=1 distribution[getLidFromLocation(source)]+=1 # if i==10: break points, colors = zip(*[(getLocationFromLid(k),v) for k, v in sorted(distribution.iteritems(), key=itemgetter(1))]) cm = matplotlib.cm.get_cmap('Paired') sc = plotPointsOnWorldMap(points, c=colors, cmap=cm, lw = 0) plt.colorbar(sc) plt.show()