#!/usr/bin/perl

# fix-phase.pl
# Read STDIN and output average of each X samples to STDOUT

# Copyright 2007 John Ackermann   Version: 15 July 2001
# May be freely used provided these notices are retained, and a copy
# of any modified version that's distributed to third persons is sent
# to jra@febo.com

$last = 0;
while ($reading=<STDIN>) {

	if (substr($reading,0,1) =~ "[0-9]") {
		($x,$y) = split(/\s/,$reading);
		if ($y == $last) { 
			$y = $y + 1e-15;
			}
		print $x," ",$y,"\n";
		$last = $y;
	}
	else {
		print $reading;
	}
}

exit 0;
