Skip to content

Instantly share code, notes, and snippets.

@run4flat
Created January 31, 2012 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save run4flat/1712686 to your computer and use it in GitHub Desktop.
Save run4flat/1712686 to your computer and use it in GitHub Desktop.
save a matrix
use strict;
use warnings;
use PDL;
my $data;
BEGIN {
$data = rfits('20kV_1p45A_14deg_Fourier.fit');
}
use PDL::Graphics::Prima::Simple [$data->dims];
print "Data has dims ", join(', ', $data->dims), "\n";
my ($xmin, $xmax) = (0, 1);
my ($ymin, $ymax) = (0, 1);
plot(
-data => [
[$xmin, $xmax], [$ymin, $ymax],
plotType => pt::ColorGrid(colors => $data->log)
],
onKeyDown => sub {
my ($self, @args) = @_;
print "Saving the image...\n";
my $image = $::application->get_image($::application->get_active_window->origin
, $self->size);
my $dlg = Prima::ImageSaveDialog->create;
$dlg->save($image);
return;
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment