Skip to content

Instantly share code, notes, and snippets.

@run4flat
run4flat / Help.pm
Created March 14, 2012 15:38
Help for Padre::Plugin::PDL
package Padre::Plugin::PDL::Help;
use 5.008;
use strict;
use warnings;
# For Perl 6 documentation support
use Padre::Help ();
our $VERSION = '0.05';
@run4flat
run4flat / get-macros.pl
Created March 23, 2012 15:48
Script to get string expansions for Perl API macros
use strict;
use warnings;
my @symbols = qw(
GIMME
GIMME_V
G_ARRAY
G_DISCARD
G_EVAL
G_NOARGS
@run4flat
run4flat / Notes.pod
Created June 26, 2012 20:54
revised P::G::Prima::plot() calling convention

Mission Statement: Dynamic Data Analysis

These are my notes and reflections on some ideas recently suggested by Joel on how to make the interface to plot() easier and more Perlish. In the course of writing up this document, I have come to the conclusion that PDL::Graphics::Prima is, first and foremost, a plotting library targeting dynamic data analysis. If we can write nice static plotting wrappers around the basic bindings (as PDL::Graphics::Prima::Simple attempts to do), that's great.

Eventually, I want to add a "Properties" menu item to the right-click menu, one which would allow you to change the title, specify details about the axes (including handling multiple axes automatically), and manipulate the dataSets and their PlotTypes. It is through this lens that I evaluate API ideas.

Syntax Goals

The current form of the constructor and plot() command is meant to parallel the api through which you interact with the plot widget. For example, the current way to indicate x and y plot labe

@run4flat
run4flat / prima-irc.pl
Created June 28, 2012 02:24
prima irc client
#!/usr/bin/env perl
use strict;
use warnings;
use Prima qw(Application Label Buttons InputLine Edit Lists MsgBox);
use IRC::Utils qw(parse_user strip_color strip_formatting decode_irc);
use POE qw(Component::IRC::State Component::IRC::Plugin::Connector);
my $channel = "#IRC.pm";
my $irc = POE::Component::IRC::State->spawn(
@run4flat
run4flat / prima-basic.pl
Created June 28, 2012 13:37
POE::Loop::Prima Hello World (counter)
#!/usr/bin/perl
# based on http://poe.perl.org/?POE_Cookbook/Gtk_Interfaces
#
# This sample program creates a very simple Prima counter. Its
# interface consists of two widgets: A counter label and a button
# to reset that counter.
use warnings;
use strict;
# Prima support is enabled if the Prima module is used before POE itself.
@run4flat
run4flat / gist:3013911
Created June 28, 2012 21:10 — forked from jberger/gist:3012794
PGPS gaussian width app
#!/usr/bin/env perl
use strict;
use warnings;
use PDL;
use PDL::Image2D;
use PDL::Fit::Gaussian;
use Prima;
use PDL::Graphics::Prima::Simple -sequential;
@run4flat
run4flat / gist:3062942
Created July 6, 2012 21:49
Build failure on Windows Vista 32 bit, Strawberry Perl 5.12
C:\Windows\system32>cpan PDL::Graphics::Prima
CPAN: CPAN::SQLite loaded ok (v0.199)
Database was generated on Fri, 06 Jul 2012 16:57:19 GMT
Running install for module 'PDL::Graphics::Prima'
Running make for D/DC/DCMERTENS/PDL-Graphics-Prima-0.08.tar.gz
CPAN: Digest::SHA loaded ok (v5.61)
CPAN: Compress::Zlib loaded ok (v2.034)
Checksum for C:\strawberry\cpan\sources\authors\id\D\DC\DCMERTENS\PDL-Graphics-Prima-0.08.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.76)
CPAN: File::Temp loaded ok (v0.22)
@run4flat
run4flat / gist:3295193
Created August 8, 2012 13:55
Perl thread barrier synchronization
use strict;
use warnings;
use threads qw(yield);
use threads::shared qw(cond_wait);
my $N_threads = 4;
# Allocate the shared memory outside the threads
my @data :shared;
@run4flat
run4flat / gist:3881822
Created October 12, 2012 22:02
FFT Pulse Explorer
use strict;
use warnings;
use PDL;
use PDL::Graphics::Prima;
use Prima qw(Application InputLine IniFile);
use PDL::FFT;
my $wDisplay = Prima::MainWindow->create(
text => 'FFT Envelope analysis',
size => [800, 800],
@run4flat
run4flat / gist:3902086
Created October 16, 2012 21:10
Imagine using PDL::Graphics::Prima::Simple as...
use strict;
use warnings;
sub my_plot {
croak("Expected key/value pairs, but got an odd number of arguments to pot()")
if @_ % 2 == 1;
print "About to plot!\n";
PDL::Graphics::Prima::Simple::default_plot(@_);
}