| 1 | |||||||||||||||||||||||||||||||||||||||||||
| 2 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 3 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 4 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 5 | ### | ||||||||||||||||||||||||||||||||||||||||||
| 6 | ### | ||||||||||||||||||||||||||||||||||||||||||
| 7 | ### PLplot interface to PDL::Graphics::Simple | ||||||||||||||||||||||||||||||||||||||||||
| 8 | ### | ||||||||||||||||||||||||||||||||||||||||||
| 9 | ### See the PDL::Graphics::Simple docs for details | ||||||||||||||||||||||||||||||||||||||||||
| 10 | ### | ||||||||||||||||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | package PDL::Graphics::Simple::PLplot; | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use File::Temp qw/tempfile/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Time::HiRes qw/usleep/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use PDL::Options q/iparse/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use PDL; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | eval 'use PDL::Graphics::PLplot'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | our $mod = { | |||||||||||||||||||||||||||||||||||||||||
| 24 | shortname => 'plplot', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | module=>'PDL::Graphics::Simple::PLplot', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | engine => 'PDL::Graphics::PLplot', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | synopsis=> 'PLplot (nice plotting, sloooow images)', | ||||||||||||||||||||||||||||||||||||||||||
| 28 | pgs_version=> '1.005' | ||||||||||||||||||||||||||||||||||||||||||
| 29 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | PDL::Graphics::Simple::register( 'PDL::Graphics::Simple::PLplot' ); | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | ########## | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # PDL::Graphics::Simple::PLplot::check | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # Checker | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | sub check { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | ▶ | my $force = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=22 SCAR=57.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | ▶ | $force = 0 unless(defined($force)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | ▶ | return $mod->{ok} unless( $force or !defined($mod->{ok}) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$force or not defined $mod->{"ok"}
MC/DC50%1/2
$force or not defined $mod->{"ok"}
$force
not defined $mod->{"ok"}
Truth table66%2/3
A or not(B)
A= $forceB= not defined $mod->{"ok"}
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | eval 'use PDL::Graphics::PLplot'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | if($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | $mod->{ok} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | $mod->{msg} = $@; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | # Module loaded OK, now try to extract valid devices from it. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # We would use a pipe, but Microsoft Windows doesn't play nice | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # with them - so we use a temp file instead. | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my ($fh1, $gzinta) = tempfile('pgs_gzinta_XXXX'); | |||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | close $fh1; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my ($fh2, $gzouta) = tempfile('pgs_gzouta_XXXX'); | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | close $fh2; | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | open FOO, ">$gzinta" or die "Couldn't write to temp file"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | print FOO "1\n"; #Just one line | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | close FOO; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if($^O =~ /MSWin32/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | eval {require Win32::Process}; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | die "Win32::Process didn't load: $@" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | if $@; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my $cmd_location = -e "\\Windows\\system32\\cmd.exe" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | ? "\\Windows\\system32\\cmd.exe" | ||||||||||||||||||||||||||||||||||||||||||
| 68 | : cmd_location(); | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | Win32::Process::Create( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | $ProcessObj, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | $cmd_location, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | "cmd /c \"$^X -MPDL -MPDL::Graphics::PLplot -e \"PDL::Graphics::PLplot->new() \" <$gzinta >$gzouta\"", | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 32, #NORMAL_PRIORITY_CLASS | ||||||||||||||||||||||||||||||||||||||||||
| 76 | ".")|| die ErrorReport(); | ||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $pid = fork(); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | unless(defined($pid)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | print STDERR "Fork failed in PLplot probe -- returning 0\n"; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if( $pid==0 ) { # assignment | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | # Daughter: try to create a PLplot window with a bogus device, to stimulate a driver listing | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | open STDOUT,">$gzouta"; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | open STDERR,">&STDOUT"; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | open STDIN, "<$gzinta"; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | PDL::Graphics::PLplot->new(DEV=>'?'); | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | exit(0); | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | # Parent - snarf up the results from the daughter | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | usleep(2e5); # hang around for 0.2 seconds | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | eval {kill 9,$pid;}; # kill it dead, just in case it buzzed or hung (I'm looking at you, Microsoft Windows) | |||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | waitpid($pid,0); # Clean up. | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sleep 1 if $^O =~ /MSWin32/i; # Don't read $gzouta before it's written | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | # Snarf up the file. | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | open FOO, "<$gzouta"; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | @lines = <FOO>; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | close FOO; | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | unlink $gzinta; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | unlink $gzouta; | |||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $mod->{devices} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | for my $l(@lines) { | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if( $l=~ m/^\s+\<\s*\d+\>\s+(\w+)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $mod->{devices}->{$1} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if( $mod->{devices}->{'xcairo'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $mod->{disp_dev} = 'xcairo'; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } elsif( $mod->{devices}->{'xwin'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $mod->{disp_dev} = 'xwin'; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } elsif( $mod->{devices}->{'wingcc'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $mod->{disp_dev} = 'wingcc'; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $mod->{ok} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | our $guess_filetypes = { | |||||||||||||||||||||||||||||||||||||||||
| 130 | ps => ['pscairo','psc', 'psttfc', 'ps'], | ||||||||||||||||||||||||||||||||||||||||||
| 131 | svg => ['svgcairo','svg'], | ||||||||||||||||||||||||||||||||||||||||||
| 132 | pdf => ['pdfcairo'], | ||||||||||||||||||||||||||||||||||||||||||
| 133 | png => ['pngcairo'] | ||||||||||||||||||||||||||||||||||||||||||
| 134 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | our $filetypes; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $filetypes = {}; | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | for $k(keys %{$guess_filetypes}) { | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | VAL:for $v( @{$guess_filetypes->{$k}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if($mod->{devices}->{$v}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $filetypes->{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | last VAL; | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | unless($filetypes->{ps}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $mod->{ok} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $mod->{ok} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | ########## | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # PDL::Graphics::Simple::PLplot::new | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | our $new_defaults ={ | |||||||||||||||||||||||||||||||||||||||||
| 161 | size => [8,6,'in'], | ||||||||||||||||||||||||||||||||||||||||||
| 162 | type => '', | ||||||||||||||||||||||||||||||||||||||||||
| 163 | output=>'', | ||||||||||||||||||||||||||||||||||||||||||
| 164 | multi=>undef | ||||||||||||||||||||||||||||||||||||||||||
| 165 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | my $pkg = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $opt_in = shift; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $opt = { iparse( $new_defaults, $opt_in ) }; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $pgw; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | # Force a recheck on failure, in case the user fixed PLplot. | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | unless(check()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | die "$mod->{shortname} appears nonfunctional\n" unless(check(1)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | # Figure the device name and size to feed to PLplot. | ||||||||||||||||||||||||||||||||||||||||||
| 180 | # size has already been regularized. | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $conv_tempfile; | |||||||||||||||||||||||||||||||||||||||||
| 182 | my $dev; | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my @params; | |||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if( $opt->{type} =~ m/^i/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | ## Interactive devices | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $dev = $mod->{disp_dev}; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | push(@params, DEV => $dev ); | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if($opt->{output}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | push(@params, FILE=>$opt->{output}); | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $ext; | |||||||||||||||||||||||||||||||||||||||||
| 196 | ## File devices | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if( $opt->{output} =~ m/\.(\w{2,4})$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $ext = $1; | |||||||||||||||||||||||||||||||||||||||||
| 200 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $ext = 'png'; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $opt->{output} .= ".png"; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | our $mod; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | unless( $filetypes->{$ext} and $mod->{devices}->{$filetypes->{$ext}} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$filetypes->{$ext} and $mod->{"devices"}{$filetypes->{$ext}}
MC/DC0%0/2
$filetypes->{$ext} and $mod->{"devices"}{$filetypes->{$ext}}
$filetypes->{$ext}
$mod->{"devices"}{$filetypes->{$ext}}
Truth table0%0/3
A and B
A= $filetypes->{$ext}B= $mod->{"devices"}{$filetypes->{$ext}}
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | ## Have to set up file conversion | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my($fh); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ($fh, $conv_tempfile) = tempfile('pgs_pgplot_XXXX'); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | unlink $conv_tempfile; # just to be sure... | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $conv_tempfile .= ".ps"; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $dev = $filetypes->{ps}; | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | push(@params, FILE=>$conv_tempfile); | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $dev = "$filetypes->{$ext}"; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | push(@params, FILE=>$opt->{output}); | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | push(@params, DEV=>$dev); | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $size = PDL::Graphics::Simple::_regularize_size($opt->{size},'px'); | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | push(@params, PAGESIZE => [ $size->[0], $size->[1] ]); | |||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $me = { opt=>$opt, conv_fn=>$conv_tempfile }; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if( defined($opt->{multi}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | push(@params, SUBPAGES => [$opt->{multi}->[0], $opt->{multi}->[1]] ); | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $me->{multi_cur} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $me->{multi_n} = $opt->{multi}->[0] * $opt->{multi}->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | my $creator = sub { my $w = PDL::Graphics::PLplot->new( @params ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | plsstrm($w->{STREAMNUMBER}); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | plspause(0); | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | return $w; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $pgw = eval { &$creator }; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | print STDERR $@ if($@); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $me->{creator} = $creator; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $me->{obj} = $pgw; | |||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | return bless($me, 'PDL::Graphics::Simple::PLplot'); | |||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||
| 252 | # Make sure X11 windows disappear when destroyed... | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | my $me = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | if( $me->{opt}->{type} =~ m/^i/i and defined($me->{obj}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$me->{"opt"}{"type"} =~ /^i/i and defined $me->{"obj"}
MC/DC0%0/2
$me->{"opt"}{"type"} =~ /^i/i and defined $me->{"obj"}
$me->{"opt"}{"type"} =~ /^i/i
defined $me->{"obj"}
Truth table0%0/3
A and B
A= $me->{"opt"}{"type"} =~ /^i/iB= defined $me->{"obj"}
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $me->{obj}->close; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | delete $me->{obj}; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | # if the value is a string, it's a PLOTTYPE parameter sent to xplot. Otherwise | ||||||||||||||||||||||||||||||||||||||||||
| 261 | # it's a plotting sub... | ||||||||||||||||||||||||||||||||||||||||||
| 262 | our $plplot_methods = { | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 'lines' => 'LINE', | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 'bins' => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | my ($me, $ipo, $data, $ppo) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $x = $data->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $x1 = $x->range( [[0],[-1]], [$x->dim(0)], 'e' )->average; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $x2 = $x->range( [[1],[0]], [$x->dim(0)], 'e' )->average; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my $newx = pdl($x1,$x2)->mv(-1,0)->clump(2)->sever; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my $y = $data->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my $newy = $y->dummy(0,2)->clump(2)->sever; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $me->{obj}->xyplot($newx, $newy, PLOTTYPE=>'LINE', %{$ppo}); | |||||||||||||||||||||||||||||||||||||||||
| 275 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 'points' => 'POINTS', | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 'errorbars' => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | my ($me, $ipo, $data, $ppo) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $me->{obj}->xyplot($data->[0], $data->[1], %{$ppo}, YERRORBAR=>$data->[2]*2); | |||||||||||||||||||||||||||||||||||||||||
| 280 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 'limitbars'=> sub { | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | my ($me, $ipo, $data, $ppo) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $me->{obj}->xyplot($data->[0], 0.5*($data->[2]+$data->[3]), %{$ppo}, | |||||||||||||||||||||||||||||||||||||||||
| 284 | YERRORBAR=>($data->[3]-$data->[2])->abs, | ||||||||||||||||||||||||||||||||||||||||||
| 285 | PLOTTYPE=>'POINTS', SYMBOLSIZE=>0.0001, %$ppo); | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $me->{obj}->xyplot($data->[0], $data->[1], PLOTTYPE=>'LINE', %$ppo); | |||||||||||||||||||||||||||||||||||||||||
| 287 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 'image' => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | my ($me,$ipo,$data,$ppo) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | # Hammer RGB into greyscale | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if($data->[2]->dims>2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $data->[2] = $data->[2]->mv(2,0)->average; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my ($immin,$immax) = $data->[2]->minmax; | |||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | $ppo->{ZRANGE} = [] unless defined($ppo->{ZRANGE}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | $ppo->{ZRANGE}->[0] = $immin unless defined($ppo->{ZRANGE}->[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | $ppo->{ZRANGE}->[1] = $immax unless defined($ppo->{ZRANGE}->[1]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $xmin = $data->[0]->min - 0.5 * ($data->[0]->max - $data->[0]->min) / $data->[0]->dim(0); | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my $xmax = $data->[0]->max + 0.5 * ($data->[0]->max - $data->[0]->min) / $data->[0]->dim(0); | |||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $ymin = $data->[1]->min - 0.5 * ($data->[1]->max - $data->[1]->min) / $data->[1]->dim(1); | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $ymax = $data->[1]->max + 0.5 * ($data->[1]->max - $data->[1]->min) / $data->[1]->dim(1); | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | my $min = ($ipo->{crange} and defined($ipo->{crange}->[0])) ? $ipo->{crange}->[0] : $data->[2]->min; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ipo->{"crange"} and defined $ipo->{"crange"}[0]
MC/DC0%0/2
$ipo->{"crange"} and defined $ipo->{"crange"}[0]
$ipo->{"crange"}
defined $ipo->{"crange"}[0]
Truth table0%0/3
A and B
A= $ipo->{"crange"}B= defined $ipo->{"crange"}[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my $max = ($ipo->{crange} and defined($ipo->{crange}->[1])) ? $ipo->{crange}->[1] : $data->[2]->max; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ipo->{"crange"} and defined $ipo->{"crange"}[1]
MC/DC0%0/2
$ipo->{"crange"} and defined $ipo->{"crange"}[1]
$ipo->{"crange"}
defined $ipo->{"crange"}[1]
Truth table0%0/3
A and B
A= $ipo->{"crange"}B= defined $ipo->{"crange"}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $nsteps = 128; | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my $obj = $me->{obj}; | |||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | plsstrm($obj->{STREAMNUMBER}); | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $obj->setparm(%$ppo); | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my($nx,$ny) = $data->[0]->dims; | |||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $obj->_setwindow; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | $obj->_drawlabels; | |||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | plcol0(1); | |||||||||||||||||||||||||||||||||||||||||
| 320 | plbox ($obj->{XTICK}, $obj->{NXSUB}, $obj->{YTICK}, $obj->{NYSUB}, | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $obj->{XBOX}, $obj->{YBOX}); # !!! note out of order call | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | # Set color map | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | my $r = (xvals(128)/127)->sqrt; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $g = (xvals(128)/127); | |||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $b = (xvals(128)/127)**2; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | plscmap1l( 1, xvals(128)/127, $r, $g, $b, ones(128)); | |||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $fill_width = 2; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $cont_color = 0; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my $cont_width = 0; | |||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $clevel = ((PDL->sequence($nsteps)*(($max - $min)/($nsteps-1))) + $min); | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | my $grid = plAlloc2dGrid($data->[0], $data->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | plshades( $data->[2], $xmin, $xmax, $ymin, $ymax, $clevel, $fill_width, $cont_color, $cont_width, 0, 0, \&pltr2, $grid ); | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | plFreeGrid($grid); | |||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | plflush(); | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | if($ipo->{wedge}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | # Work around PLplot justify bug | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | local($obj->{JUST}) = 0; | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $obj->colorkey($data->[2], 'v', VIEWPORT=>[0.93,0.96,0.15,0.85], TITLE=>""); | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 348 | 'circles'=> sub { | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | my ($me,$ipo,$data,$ppo) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $ang = PDL->xvals(362)*3.14159/180; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | my $c = $ang->cos; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $s = $ang->sin; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $s->slice("361") .= $c->slice("361") .= PDL->pdl(1.1)->acos; # NaN | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $dr = $data->[2]->flat; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $dx = ($data->[0]->flat->slice("*1") + $dr->slice("*1") * $c)->flat; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $dy = ($data->[1]->flat->slice("*1") + $dr->slice("*1") * $s)->flat; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $me->{obj}->xyplot( $dx, $dy, PLOTTYPE=>'LINE',%{$ppo}); | |||||||||||||||||||||||||||||||||||||||||
| 358 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 'labels'=>sub { | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | my ($me, $ipo, $data, $ppo) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | # Call xyplot to make sure the axes get set up. | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | $me->{obj}->xyplot( pdl(1.1)->asin, pdl(1.1)->asin, %{$ppo} ); | |||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | for $i(0..$data->[0]->dim(0)-1) { | |||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $j = 0; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | $s = $data->[2]->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if ($s =~ s/^([\<\|\> ])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | $j = 1 if($1 eq '>'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | $j = 0.5 if($1 eq '|'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $me->{obj}->text($s, TEXTPOSITION=>[ $data->[0]->at($i), $data->[1]->at($i), | |||||||||||||||||||||||||||||||||||||||||
| 373 | 1,0, | ||||||||||||||||||||||||||||||||||||||||||
| 374 | $j | ||||||||||||||||||||||||||||||||||||||||||
| 375 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 376 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | our @colors = qw/BLACK RED GREEN BLUE MAGENTA CYAN YELLOW TURQUOISE PINK AQUAMARINE LIGHTSEAGREEN GOLD2 BROWN VIOLET FORESTGREEN LIGHTGOLDENROD/; | |||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | ############################## | ||||||||||||||||||||||||||||||||||||||||||
| 384 | # PDL::Graphics::Simple::PLplot::plot | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | sub plot { | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | my $me = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plot: not called CC=28 SCAR=67.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $ipo = shift; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $ppo = {}; | |||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | $ppo->{TITLE} = $ipo->{title} if(defined($ipo->{title})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | $ppo->{XLAB} = $ipo->{xtitle} if(defined($ipo->{xtitle})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | $ppo->{YLAB} = $ipo->{ytitle} if(defined($ipo->{ytitle})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | $ppo->{ZRANGE} = $ipo->{crange} if(defined($ipo->{crange})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | unless( $ipo->{oplot} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $me->{style} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $me->{logaxis} = $ipo->{logaxis}; | |||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if($me->{opt}->{multi}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $me->{multi_cur}++; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | plsstrm($me->{obj}->{STREAMNUMBER}); | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | pladv($me->{multi_cur} or 1); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$me->{'multi_cur'} || 1
MC/DC0%0/1
$me->{'multi_cur'} || 1
$me->{'multi_cur'}
Truth table0%0/2
A
A= $me->{'multi_cur'}
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if(!defined($me->{multi_n}) or !($me->{multi_n}) or $me->{multi_n}==1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $me->{"multi_n"} && $me->{"multi_n"} or $me->{"multi_n"} == 1
defined $me->{'multi_n'} && $me->{'multi_n'}
MC/DC0%0/3
not defined $me->{"multi_n"} && $me->{"multi_n"} or $me->{"multi_n"} == 1
defined $me->{'multi_n'}
$me->{'multi_n'}
$me->{"multi_n"} == 1
Truth table0%0/4
not(A && B) or C
A= defined $me->{'multi_n'}B= $me->{'multi_n'}C= $me->{"multi_n"} == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | if($me->{opt}->{type}=~ m/^i/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | plsstrm($me->{obj}->{STREAMNUMBER}); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | pleop(); | |||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | plclear(); | |||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | plbop(); | |||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if($ipo->{logaxis} =~ m/x/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $me->{obj}->{XBOX} = 'bcnstl'; | |||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $ipo->{xrange} = [ log10($ipo->{xrange}->[0]), log10($ipo->{xrange}->[1]) ]; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if($ipo->{logaxis} =~ m/y/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | $me->{obj}->{YBOX} = 'bcnstl'; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $ipo->{yrange} = [ log10($ipo->{yrange}->[0]), log10($ipo->{yrange}->[1]) ]; | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | # plenv( $ipo->{xrange}->[0], $ipo->{xrange}->[1], $ipo->{yrange}->[0],$ipo->{yrange}->[1], $ipo->{justify}, 1); | ||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $me->{obj}->{BOX} = [ $ipo->{xrange}->[0], $ipo->{xrange}->[1], $ipo->{yrange}->[0],$ipo->{yrange}->[1] ]; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $me->{obj}->{VIEWPORT} = [0.1,0.87,0.13,0.82]; # copied from defaults in PLplot.pm. Blech. | |||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $me->{obj}->{JUST} = !!$ipo->{justify}; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | warn "P::G::S::PLplot: legends not implemented yet for PLplot" if($ipo->{legend}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | while(@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | my ($co, @data) = @{shift()}; | |||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my @extra_opts = (); | |||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if( defined($co->{style}) and $co->{style}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $co->{"style"} and $co->{"style"}
MC/DC0%0/2
defined $co->{"style"} and $co->{"style"}
defined $co->{"style"}
$co->{"style"}
Truth table0%0/3
A and B
A= defined $co->{"style"}B= $co->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $me->{style} = $co->{style}; | |||||||||||||||||||||||||||||||||||||||||
| 446 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $me->{style}++; | |||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $ppo->{COLOR} = $colors[$me->{style}%(@colors)]; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $ppo->{LINESTYLE} = (($me->{style}-1) % 8) + 1; | |||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | if( defined($co->{width}) and $co->{width} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $co->{"width"} and $co->{"width"}
MC/DC0%0/2
defined $co->{"width"} and $co->{"width"}
defined $co->{"width"}
$co->{"width"}
Truth table0%0/3
A and B
A= defined $co->{"width"}B= $co->{"width"}
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $ppo->{LINEWIDTH} = $co->{width}; | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $plpm = $plplot_methods->{$co->{with}}; | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | die "Unknown curve option 'with $co->{with}'!" unless($plpm); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my %plplot_opts = (%$ppo); | |||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my $plplot_opts = \%plplot_opts; | |||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | if($me->{logaxis} =~ m/x/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $data[0] = $data[0]->log10; | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | if($me->{logaxis} =~ m/y/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $data[1] = $data[1]->log10; | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | if(ref($plpm) eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | &$plpm($me, $ipo, \@data, $plplot_opts); | |||||||||||||||||||||||||||||||||||||||||
| 473 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my $str= sprintf('$me->{obj}->xyplot(@data,PLOTTYPE=>"%s",%s);%s',$plpm,'%plplot_opts',"\n"); | |||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | eval $str; | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | $me->{obj}->close if($me->{opt}->{type} =~ m/^f/i and !defined($me->{opt}->{multi})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$me->{"opt"}{"type"} =~ /^f/i and not defined $me->{"opt"}{"multi"}
MC/DC0%0/2
$me->{"opt"}{"type"} =~ /^f/i and not defined $me->{"opt"}{"multi"}
$me->{"opt"}{"type"} =~ /^f/i
not defined $me->{"opt"}{"multi"}
Truth table0%0/3
A and not(B)
A= $me->{"opt"}{"type"} =~ /^f/iB= not defined $me->{"opt"}{"multi"}
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | my $file = ( ($me->{conv_fn}) ? $me->{conv_fn} : $me->{output} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | if($me->{conv_fn}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | $a = rim($me->{conv_fn}); | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | wim($a->mv(1,0)->slice(':,-1:0:-1'), $me->{opt}->{output}); | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | unlink($me->{conv_fn}); | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | sub ErrorReport{ | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | print Win32::FormatMessage( Win32::GetLastError() ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ErrorReport: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | sub cmd_location { | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | my @path = File::Spec->path(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_location: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | for my $p(@path) { | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | if(-e "${p}\\cmd.exe") {return "${p}\\cmd.exe"} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | die "Can't locate cmd.exe"; | |||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||