From 100fcb668119806c6d2770e563803c752bcddd08 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 25 Jul 2013 22:00:19 +0200 Subject: [PATCH] Add a Perl script to convert the output of find-pairwise-distance to a PGM file for visualization. --- pairwise-to-pgm.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pairwise-to-pgm.pl diff --git a/pairwise-to-pgm.pl b/pairwise-to-pgm.pl new file mode 100644 index 0000000..3e11fc8 --- /dev/null +++ b/pairwise-to-pgm.pl @@ -0,0 +1,17 @@ +#! /usr/bin/perl +use strict; +use warnings; +use POSIX; + +my $width = 599; +my $height = 599; +my $max = 7263081; + +print "P5\n$width $height\n255\n"; +while (<>) { + /(\d+) (\d+) (\d+)/ or die; + my ($i, $j, $z) = ($1, $2, $3); + $z = log($z + 1.0) / log($max + 1.0); + $z = pow($z, 20); + print chr(int(255.0 * $z)); +} -- 2.39.2