Source code for program that retrieves real-time, global seismic data for Nude Studies in Aleatoric Environments.

Lines containing comments are highlighted in yellow. Feel free to leave your own comments or questions. I will watch these pages and respond.

Pall Thayer
line no. 1 (0 comments)
#!/usr/bin/perl
line no. 2 (0 comments)
# ˆ© Copyright 2008, Pall Thayer
line no. 3 (0 comments)
# This file is part of "Nude Studies in Aleatoric Environments".
line no. 4 (0 comments)
#
line no. 5 (0 comments)
#    'Nude Studies in Aleatoric Environments' is art: you can redistribute
line no. 6 (0 comments)
#    it and/or modify it under the terms of the GNU General Public License
line no. 7 (0 comments)
#    as published by the Free Software Foundation, either version 3 of the
line no. 8 (0 comments)
#    License, or (at your option) any later version.
line no. 9 (0 comments)
#
line no. 10 (0 comments)
#    'Nude Studies in Aleatoric Environments' is distributed in the
line no. 11 (0 comments)
#    hope that it will be useful, but WITHOUT ANY WARRANTY; without
line no. 12 (0 comments)
#    even the implied warranty of MERCHANTABILITY or FITNESS FOR A
line no. 13 (0 comments)
#    PARTICULAR PURPOSE.  See the GNU General Public License for more details.
line no. 14 (0 comments)
#
line no. 15 (0 comments)
#    You should have received a copy of the GNU General Public License
line no. 16 (0 comments)
#    along with "Nude Studies in Aleatoric Environments".  If not,
line no. 17 (0 comments)
#    see <http://www.gnu.org/licenses/>.
line no. 18 (0 comments)
# programming begins here:
line no. 19 (1 comments)
use IO::Socket;
line no. 20 (0 comments)
while(1){
line no. 21 (1 comments)
	$SeisIn = `slinktool -d -S "CI_CWC:BHE" -u bud.iris.washington.edu`;
line no. 22 (0 comments)
	my @myValues;
line no. 23 (0 comments)
	$SeisIn =~ s/\s{3,}/bla/g;
line no. 24 (0 comments)
	@splitSeisIn = split("bla", $SeisIn);
line no. 25 (0 comments)
	foreach(@splitSeisIn){
line no. 26 (0 comments)
		unless($_ =~ m/[a-zA-z]/){
line no. 27 (0 comments)
			if($_ =~ m/\d/){
line no. 28 (0 comments)
				$val = abs($_);
line no. 29 (0 comments)
				push(@myValues, $val);
line no. 30 (0 comments)
			}
line no. 31 (0 comments)
		}
line no. 32 (0 comments)
	}
line no. 33 (0 comments)
$sum = 0;
line no. 34 (0 comments)
$count = 1;
line no. 35 (0 comments)
@myValues = sort({$a <=> $b} @myValues);
line no. 36 (1 comments)
$highest = pop(@myValues);
line no. 37 (1 comments)
$highest = int(($highest-500)*(300-0)/(50000-500));
line no. 38 (0 comments)
$highest = int($highest/2);
line no. 39 (1 comments)
$highest = "1:".$highest;
line no. 40 (1 comments)
$sock = IO::Socket::INET->new(Proto     => 'udp',
line no. 41 (0 comments)
                              PeerPort  => 9689,
line no. 42 (0 comments)
                              PeerAddr  => 'localhost')
line no. 43 (0 comments)
    or die "Creating socket: $!\n";
line no. 44 (0 comments)
	$sock->send($highest) or die "send: $!";
line no. 45 (0 comments)
close($sock);
line no. 46 (0 comments)
print "send_data: $highest\n";
line no. 47 (0 comments)
}