6 # Don't edit the line below, it must look exactly like this.
7 # Everything above this line will be replaced #
17 $options{'precision'} = 4;
19 my $opts = { "h|?" => $options{'help'},
20 "help" => $options{'long_help'},
21 "debug:0" => $options{'debug'},
22 "debug_package:s" => $options{'debug_package'},
23 "debug_subroutine:s" => $options{'debug_subroutine'},
24 "compact_format:1" => $options{'compact_format'},
25 "csv" => $options{'csv'},
26 "precision:4" => $options{'precision'}};
29 my $res = GetOptions( \%options, %{$opts} );
33 if ( scalar( @ARGV ) < 1 and !($options{'help'} or $options{'long_help'}) ){
34 print "At least one list file must be specified. Use 'sumo.pl -h' for help.\n";
39 if($options{'help'} or $options{'long_help'}) {
44 Perl script for summarizing output data.
48 sumo.pl [ -h | -? ] [ -help ]
50 [ -debug_package='string' ]
51 [ -debug_subroutine='string' ]
56 if( $options{'long_help'} and !$options{'help'} ){
62 Sumo is short for SUmmarize Output. And it does exactly that. It
63 gathers some usefull information from NONMEM ouputfiles and prints
68 Get summary from an output file:
74 The following options are valid:
78 Print a list of options.
83 Print this, longer, help message.
90 This is mainly for developers who whish to debug PsN. By default
91 'integer' is zero but you can try setting it to '1' and you might
92 get some helpfull warnings. If you run in to problems that require
93 support, you might be told to crank this number up and send the
97 -debug_package='string'
99 Default value is: empty string
101 If use together with '-debug' it is possible to choose which part
102 of PsN you want to see debug messages from. Again this is mostly
106 -debug_subroutine='string'
108 Default value is: empty string
110 With this option it is possible to specify, with even finer
111 granularity, which part of PsN you want to see debug messages
112 from. This is definitly only for developers.
119 debug
-> level
( $options{'debug'} );
120 debug
-> package( $options{'debug_package'} );
121 debug
-> subroutine
( $options{'debug_subroutine'} );
123 my $form = '%.' . $options{'precision'} . 'g';
125 my $outfile = $ARGV[0];
127 my $outobj = output
-> new
('filename'=> $outfile);
130 my @output_matrix_sizes;
133 #print Dumper( $outobj );
135 print "$outfile\n\n";
137 for( my $problems = 0; $problems <= $#{$outobj -> problems}; $problems++){
139 for( my $sub_problems = 0; $sub_problems <= $#{$outobj -> problems -> [$problems] -> subproblems}; $sub_problems++){
141 my @thetas = defined $outobj -> thetas
-> [$problems][$sub_problems] ? @
{$outobj -> thetas
-> [$problems][$sub_problems]} : ();
142 my @thnam = defined $outobj -> thetanames
-> [$problems] ? @
{$outobj -> thetanames
-> [$problems]} : ();
143 my @sethet = defined $outobj -> sethetas
-> [$problems][$sub_problems] ? @
{$outobj -> sethetas
-> [$problems][$sub_problems]} : ();
145 my @omegas = defined $outobj -> comegas
-> [$problems][$sub_problems] ? @
{$outobj -> comegas
-> [$problems][$sub_problems]} : ();
146 my @omnam = defined $outobj -> omeganames
-> [$problems] ? @
{$outobj -> omeganames
-> [$problems]} : ();
148 my @sigmas = defined $outobj -> csigmas
-> [$problems][$sub_problems] ? @
{$outobj -> csigmas
-> [$problems][$sub_problems]} : ();
149 my @signam = defined $outobj -> sigmanames
-> [$problems] ? @
{$outobj -> sigmanames
-> [$problems]} : ();
151 my $ofv = $outobj -> ofv
-> [$problems][$sub_problems];
152 my $termess= $outobj -> minimization_message
-> [$problems][$sub_problems];
155 print join( "",@
{$termess} ), "\n";
158 if ( defined $ofv ) {
159 print "Objective function value: ",$ofv,"\n\n";
161 print "Objective function value: UNDEFINED\n\n";
169 @sethet = @
{$outobj -> cvsethetas
-> [$problems][$sub_problems]};
170 @seomeg = @
{$outobj -> cvseomegas
-> [$problems][$sub_problems]};
171 @sesigm = @
{$outobj -> cvsesigmas
-> [$problems][$sub_problems]};
175 push( @
{$output_matrix[$row_counter]}, "","THETA","","","OMEGA","","","SIGMA", "" );
176 for( my $i = 0; $i <= $#{$output_matrix[$row_counter]}; $i++ ){
177 if( $output_matrix_sizes[$i] < length( $output_matrix[$row_counter][$i] ) ){
178 $output_matrix_sizes[$i] = length( $output_matrix[$row_counter][$i] );
183 #printf "%-4s %-29s %-29s %-18s\n"," ","THETA","OMEGA","SIGMA";
185 my $max_par = $#thetas;
186 $max_par = $#omegas if ( $#omegas > $max_par );
187 $max_par = $#sigmas if ( $#sigmas > $max_par );
189 for ( my $i = 0; $i <= $max_par; $i++ ) {
191 if ( defined $thetas[$i] ) {
192 push( @row, $thnam[$i], sprintf( $form, $thetas[$i] ),
193 $sethet[$i] ?
sprintf( "($form)", $sethet[$i] ) : '' );
195 push( @row, '','','' );
197 if ( defined $omegas[$i] ) {
198 push( @row, $omnam[$i], sprintf( $form, $omegas[$i] ),
199 $seomeg[$i] ?
sprintf( "($form)", $seomeg[$i] ) : '' );
201 push( @row, '','','');
203 if ( defined $sigmas[$i] ) {
204 push( @row, $signam[$i], sprintf( $form, $sigmas[$i] ),
205 $sesigm[$i] ?
sprintf( "($form)", $sesigm[$i] ) : '' );
207 push( @row, '','','');
210 push(@
{$output_matrix[$row_counter]}, @row);
211 for( my $i = 0; $i <= $#{$output_matrix[$row_counter]}; $i++ ){
212 if( $output_matrix_sizes[$i] < length( $output_matrix[$row_counter][$i] ) ){
213 $output_matrix_sizes[$i] = length( $output_matrix[$row_counter][$i] );
222 #for( my $j = 0; $j <= $#output_matrix; $j++ ){
223 # for( my $i = 0; $i <= $#{$output_matrix[$j]}; $i++ ){
224 # if( $output_matrix_sizes[$i] < length( $output_matrix[$j][$i] ) ){
225 # $output_matrix_sizes[$i] = length( $output_matrix[$j][$i] );
230 foreach my $row ( @output_matrix ){
231 for( my $i = 0; $i <= $#{$row}; $i++ ){
232 my $spaces = $output_matrix_sizes[$i] - length($row -> [$i]);
233 if( $options{'csv'} ){
234 print $row -> [$i], ",";
236 print " " x
$spaces, $row -> [$i], " ";
251 # push(@plist,shift @thnam);
260 # push(@plist,shift @thetas);
269 # push(@plist,"(".(sprintf "%.3g",shift @sethet).")");
273 # push @plist," " and $f.="%-12s ";
276 # if ( defined $omegas[0] ) {
278 # # push(@om_str,shift @omnam);
282 # # push(@om_str," ");
287 # # my ( $omega, @om_str );
289 # # $omega = shift( @omegas );
290 # # unless( defined $omega and not $compact_format){
291 # # push( @om_str, "NaN" );
293 # # } elsif ( $omega != 0 or not $compact_format ) {
294 # # push(@om_str,$omega);
299 # # push(@plist," ");
304 # # my $seomega = shift( @seomeg );
305 # # if ( $omega != 0 ) {
306 # # push(@plist,"(".(sprintf "%.3g",$seomega).")");
311 # # push(@plist," ");
316 # push(@plist,shift @signam);
325 # push(@plist,shift @sigmas);
334 # push(@plist,"(".(sprintf "%.3g",shift @sesigm).")");