nickschurch has asked for the wisdom of the Perl Monks concerning the following question:
# -------------- System variables my $currentdir = getcwd(); my $logdir = "Logs"; my $outdir = "Windoutput"; my $specdir = "Specfiles"; my $animdir = "Animfiles"; # -------------- End system variables # -------------- Main program variables my $framenumber = 1; my $frameplot; my $emin=300; my $emax=13000; my $xmin = log10($emin/1000); my $xmax = log10($emax/1000); my $ymin = log10(6E2); my $ymin2 = log10(2E4); my $ymax = log10(6E6); my $filename; # -------------- Prompted Variables print " Please enter number of frames (default = 100): "; my $nframes = <STDIN>; chomp $nframes; $nframes = 100 if ($nframes eq ""); print " Processing frame:\n "; # -------------- Main program loop until ($framenumber>$nframes) { print "${framenumber}: "; $filename = "$animdir/frame_00${framenumber}.gif/gif" if ($framenu +mber<10); $filename = "$animdir/frame_0${framenumber}.gif/gif" if (($framenu +mber>9) and ($framenumber<100)); $filename = "$animdir/frame_${framenumber}.gif/gif" if $framenumbe +r>99; print "$filename\n"; $frameplot = PDL::Graphics::PGPLOT::Window->new(Device => $filenam +e, AxisColour => 'black', Font => 'Roman', WindowXSize => 8 , WindowY +Size => 9.23, HardLW => 4); $frameplot = PDL::Graphics::PGPLOT::Window->new(Device => '/xs', A +xisColour => 'black', Font => 'Roman', WindowXSize => 8 , WindowYSize + => 9.23) if ($debug_level==1); # Prepare space for transmitted spectrum plot $frameplot->env($xmin,$xmax,$ymin,$ymax, { PlotPosition => [0.06, 0.99, 0.06, 0.639], Charsize => 0.8, Axis => 'LogXY', Xtitle => 'Energy (keV)', Ytitle => 'E L\dE\u [erg(erg/s/erg)]', }); my ($energy, $trans) = rcols "$animdir/${framenumber}_trans_spect. +txt", {LINES => '4:-1'}; my ($junk, $emit) = rcols "$animdir/${framenumber}_emit_spect.txt" +, {LINES => '4:-1'}; my ($incenergy, $inclumin) = rcols "${xscortpath}/powerlaw.dat", { +LINES => '2:-1'}; my $plotmask = which(($incenergy>$emin) & ($incenergy<$emax)); my $x = $incenergy->dice($plotmask); my $y = $inclumin->dice($plotmask); $frameplot->line(log10($x/1000), log10($y*1.60217646E-12*$x), {Col +our => 'black'}); $plotmask = which(($energy>$emin) & ($energy<$emax)); $x = $energy->dice($plotmask); $y = $trans->dice($plotmask); $frameplot->line(log10($x/1000), log10($y*1.60217646E-12*$x), {Col +our => 'blue'}); $y = $emit->dice($plotmask); $frameplot->line(log10($x/1000), log10($y*1.60217646E-12*$x), {Col +our => 'red'}); $frameplot->env($xmin,$xmax,$ymin2,$ymax, { PlotPosition => [0.06, 0.99, 0.639, 0.99], Charsize => 0.8, Axis => ['BCSTL','BCNSTL'], Ytitle => 'E L\dE\u [erg(erg/s/erg)]', }); $plotmask = which(($incenergy>$emin) & ($incenergy<$emax)); $x = $incenergy->dice($plotmask); $y = $inclumin->dice($plotmask); $frameplot->line(log10($x/1000), log10($y*1.60217646E-12*$x), {Col +our => 'black'}); $y = ($emit+$trans)->dice($plotmask); $frameplot->line(log10($x/1000), log10($y*1.60217646E-12*$x), {Col +our => 'dark green'}); if ($debug_level==1) { print "Press return to continue..."; my $pause = <STDIN>; } $frameplot->close(); $framenumber++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PGPLOT perl module weirdness...
by moritz (Cardinal) on Jan 30, 2008 at 10:36 UTC | |
|
Re: PGPLOT perl module weirdness...
by zentara (Cardinal) on Jan 30, 2008 at 14:58 UTC | |
by nickschurch (Acolyte) on Jan 31, 2008 at 07:52 UTC |