cableguy has asked for the wisdom of the Perl Monks concerning the following question:
I've got a file (http://home.iwcg.net/spectrum.bin) that has information about a radio observing program.
The first two bytes are a two-byte unsigned integer, which acts as an "index". When that number changes, there is new data. If you miss a number, you've missed a spectrum. The remaining data are 600 2-byte signed integers, representing the "dB" of 16384 channels. Each integer is in fact the maximum of 16384/600 = 27 bins. So the 600 integers are a boiled-down representation of the whole 16384 channel (73 kHz) bandwidth.
Now, with that said, when I'm going to get the data, and trying to split the data, my perl skills are only letting me get the binary data into hex....and the hex data is only so far.
[snip header, locations, comments, and other fluff] use LWP::Simple; require LWP::UserAgent; # First, let's get the data from the web server. $ua = LWP::UserAgent->new(); $ua->agent("Argus Remote Waterfall v.01a"); $ua->timeout ($timeout); my $response = $ua->get($fetchpage); foreach(split(//,$response)) { if (!$response->is_success) { die $response->status_line; } printf("%01x ", ord($_)); print "\n" if $_ eq "\n"; }
Now, when I run that code, I get:
48 54 54 50 3a 3a 52 65 73 70 6f 6e 73 65 3d 48 41 53 48 28 30 78 38 3 +4 38 31 65 34 34 29
Not exactly 1202 bytes of data.
What am I missing? Where do I need to be looking? Any help would be greatly appreciated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting Binary Data
by ikegami (Patriarch) on Nov 24, 2004 at 16:51 UTC | |
|
Re: Splitting Binary Data
by trammell (Priest) on Nov 24, 2004 at 17:02 UTC | |
by ikegami (Patriarch) on Nov 24, 2004 at 18:01 UTC | |
by trammell (Priest) on Nov 24, 2004 at 19:00 UTC | |
by ikegami (Patriarch) on Nov 24, 2004 at 19:11 UTC | |
|
Re: Splitting Binary Data
by Zaxo (Archbishop) on Nov 24, 2004 at 17:02 UTC | |
by ikegami (Patriarch) on Nov 24, 2004 at 18:02 UTC |