コード例 #1
0
ファイル: numpy_example.py プロジェクト: hugovk/heatmap
def main():
    logging.basicConfig(format='%(relativeCreated)8d ms  // %(message)s')
    description = 'generate random points, save them in a numpy array'
    parser = ArgumentParser(description=description,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument('--output', metavar='FILE', default='/tmp/out.png')
    parser.add_argument('-v', '--verbose', action='store_true')
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('count', type=int)
    args = parser.parse_args()
    if args.verbose:
        logging.getLogger().setLevel(logging.INFO)
    if args.debug:
        logging.getLogger().setLevel(logging.DEBUG)

    logging.debug('python version %s' % str(sys.version))

    config = setup_config(args.count)
    matrix = hm.process_shapes(config)
    matrix = matrix.finalized()
    arr = matrix_to_numpy(config, matrix)
    print('shape: ' + str(arr.shape))
    print('max value: %f' % arr.max())
    nonzero = np.count_nonzero(arr)
    print('nonzero cells: %d / %d (%d%%)' % (nonzero, arr.size,
                                             int(100.0 * nonzero / arr.size)))
コード例 #2
0
def main():
    logging.basicConfig(format='%(relativeCreated)8d ms  // %(message)s')
    description = 'generate random points, save them in a numpy array'
    parser = ArgumentParser(description=description,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument('--output', metavar='FILE', default='/tmp/out.png')
    parser.add_argument('-v', '--verbose', action='store_true')
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('count', type=int)
    args = parser.parse_args()
    if args.verbose:
        logging.getLogger().setLevel(logging.INFO)
    if args.debug:
        logging.getLogger().setLevel(logging.DEBUG)

    logging.debug('python version %s' % str(sys.version))

    config = setup_config(args.count)
    matrix = hm.process_shapes(config)
    matrix = matrix.finalized()
    arr = matrix_to_numpy(config, matrix)
    print('shape: ' + str(arr.shape))
    print('max value: %f' % arr.max())
    nonzero = np.count_nonzero(arr)
    print('nonzero cells: %d / %d (%d%%)' %
          (nonzero, arr.size, int(100.0 * nonzero / arr.size)))
コード例 #3
0
 def generate_heatmap(self):
     self.hm_config.shapes = self.map_iter()
     if len([s for s in self.map_iter()]) == 0:
         self.heatmap_image = PIL.Image.open(config["map_img"])
         return
     matrix = hm.process_shapes(self.hm_config)
     matrix = matrix.finalized()
     self.heatmap_image = hm.ImageMaker(self.hm_config).make_image(matrix)
コード例 #4
0
ファイル: sample.py プロジェクト: HoTSStuff/replaylib
def main():
    print "Starting processing"
    replay_file = '2.StormReplay'
    replay = ReplayLib.Replay(replay_file)
    deaths = replay.get_deaths()
    print "Starting heatmap generation"
    config = setup_config(deaths)
    matrix = hm.process_shapes(config)
    matrix = matrix.finalized()
    image = hm.ImageMaker(config).make_image(matrix)
    image.save('sample.png')
    print "Complete"
コード例 #5
0
def main():
    logging.basicConfig(format='%(relativeCreated)8d ms  // %(message)s')
    description = 'plot random points'
    parser = ArgumentParser(description=description,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument('--output', metavar='FILE', default='/tmp/out.png')
    parser.add_argument('-v', '--verbose', action='store_true')
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('count', type=int)
    args = parser.parse_args()
    if args.verbose:
        logging.getLogger().setLevel(logging.INFO)
    if args.debug:
        logging.getLogger().setLevel(logging.DEBUG)

    logging.debug('python version %s' % str(sys.version))

    config = setup_config(args.count)
    matrix = hm.process_shapes(config)
    matrix = matrix.finalized()
    image = hm.ImageMaker(config).make_image(matrix)
    image.save(args.output)
コード例 #6
0
ファイル: numpy_example.py プロジェクト: sethoscope/heatmap
def main():
    logging.basicConfig(format="%(relativeCreated)8d ms  // %(message)s")
    description = "generate random points, save them in a numpy array"
    parser = ArgumentParser(description=description, formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument("--output", metavar="FILE", default="/tmp/out.png")
    parser.add_argument("-v", "--verbose", action="store_true")
    parser.add_argument("--debug", action="store_true")
    parser.add_argument("count", type=int)
    args = parser.parse_args()
    if args.verbose:
        logging.getLogger().setLevel(logging.INFO)
    if args.debug:
        logging.getLogger().setLevel(logging.DEBUG)

    logging.debug("python version %s" % str(sys.version))

    config = setup_config(args.count)
    matrix = hm.process_shapes(config)
    matrix = matrix.finalized()
    arr = matrix_to_numpy(config, matrix)
    print("shape: " + str(arr.shape))
    print("max value: %f" % arr.max())
    nonzero = np.count_nonzero(arr)
    print("nonzero cells: %d / %d (%d%%)" % (nonzero, arr.size, int(100.0 * nonzero / arr.size)))