What? Software/hardware with bugs??

Once I'd emotionally recovered from dealing with that idea, I simplified your code into this (with your data above in a file you can give as an argument, or in the obvious default filename):

use strict; use warnings; use Tk; use Tk::Canvas; use Math::FFT; my $filePath = $ARGV[0] // "testData.txt"; my @data = do { open my $fh, $filePath or die "Can't open $filePath: $ +!"; local $/; split /\s+/, <$fh> }; my $spectrum; my $fft = Math::FFT->new(\@data); $spectrum = $fft->spctrm; shift @$spectrum; # Remove DC signal component my $mw = MainWindow->new (-title => "Magnetometer Plotter"); my $canvas = $mw->Canvas (-height => 700, -width => 1024)->pack (); my $i = 0; $canvas->createLine( (map +(2 + 2 * $i++, $_), NormData($spectrum, 680)), -fill => 'blue' ); $mw->MainLoop; sub NormData { my ($data, $span) = @_; my ($min, $max); for my $datum (@$data) { $min //= $datum; $max //= $datum; $min = $datum if $min > $datum; $max = $datum if $max < $datum; } my $scale = $span / ($max - $min); map $span - ($_ - $min) * $scale + 10, @$data; }

In reply to Re^5: Quick script to check data logger data by etj
in thread Quick script to check data logger data by GrandFather

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.