3 start include statements
4 # A Perl module for parsing NONMEM output files
5 use Digest
::MD5
'md5_hex';
9 use ext
::Math
::SigFigs
;
11 end include statements
13 # }}} include statements
17 # No method, just documentation
19 # The PsN output class is built to ease the (often trivial,
20 # but still time consuming) task of gathering and structuring the
21 # information contained in NONMEM output files. The major parts of a
22 # NONMEM output file are parsed and in the L</methods> section
23 # you can find a listing of the routines that are available.
33 # my $out_obj = output -> new ( filename => 'run1.lst' );
35 # my @thetas = @{$out_obj -> thetas};
36 # my @omegas = @{$out_obj -> omegas};
37 # my @ofvs = @{$out_obj -> ofvs};
47 # <a HREF="data.html">data</a>, <a HREF="model.html">model</a>
48 # <a HREF="tool/modelfit.html">tool::modelfit</a>,
49 # <a HREF="tool.html">tool</a>
55 # data, model, tool::modelfit, tool
68 # $outputObject -> new( filename => 'run1.lst' );
70 # The basic usage above creates a output object with the data
71 # in file.out parsed into memory.
73 # $outputObject -> new( filename => 'run1.lst',
76 # If I<target> is set to 'disk', the data in "run1.lst" will
77 # be left on disk in an effort to preserve memory. The file
78 # will be read if needed.
80 if ( defined $this -> {'filename'} and $this -> {'filename'} ne '' ) {
81 ( $this -> {'directory'}, $this -> {'filename'} ) =
82 OSspecific
::absolute_path
( $this -> {'directory'},$this->{'filename'} );
83 if( -e
$this -> full_name
){
84 if($this -> {'target'} eq 'mem'){
85 $this -> _read_problems
;
88 debug
-> die( message
=> "The NONMEM output file ".
89 $this -> full_name
." does not exist" )
90 unless $this -> {'ignore_missing_files'};
93 debug
-> die( message
=> "No filename specified or filename equals empty string!" );
100 # {{{ register_in_database
102 start register_in_database
103 if ( $PsN::config
-> {'_'} -> {'use_database'} ) {
105 if( -e
$self -> full_name
){
107 $md5sum = md5_hex
(OSspecific
::slurp_file
($self-> full_name
));
109 # Backslashes messes up the sql syntax
110 my $file_str = $self->{'filename'};
111 my $dir_str = $self->{'directory'};
112 $file_str =~ s/\\/\//g
;
113 $dir_str =~ s/\\/\//g
;
115 my $dbh = DBI
-> connect("DBI:mysql:host=".$PsN::config
-> {'_'} -> {'database_server'}.
116 ";databse=".$PsN::config
-> {'_'} -> {'project'},
117 $PsN::config
-> {'_'} -> {'user'},
118 $PsN::config
-> {'_'} -> {'password'},
119 {'RaiseError' => 1});
125 my $sth = $dbh -> prepare
( "SELECT output_id FROM ".$PsN::config
-> {'_'} -> {'project'}.
127 "WHERE filename = '$file_str' AND ".
128 "directory = '$dir_str' AND ".
129 "md5sum = '".$md5sum."'" );
130 $sth -> execute
or debug
-> die( message
=> $sth->errstr ) ;
132 $select_arr = $sth -> fetchall_arrayref
;
135 if ( scalar @
{$select_arr} > 0 ) {
136 debug
-> warn( level
=> 1,
137 message
=> "Found an old entry in the database matching the ".
138 "current output file" );
139 if ( scalar @
{$select_arr} > 1 ) {
140 debug
-> warn( level
=> 1,
141 message
=> "Found more than one matching entry in database".
142 ", using the first" );
144 $self -> {'output_id'} = $select_arr->[0][0];
145 # Maybe we should update the table with a new model_id if such is supplied to us?
146 $self -> {'model_id'} = $select_arr->[0][1];
148 my ( $date_str, $time_str );
149 if ( $Config{osname
} eq 'MSWin32' ) {
150 $date_str = `date /T`;
151 $time_str = ' '.`time /T`;
158 my $date_time = $date_str.$time_str;
159 my @mod_str = ('','');
160 if ( defined $model_id ) {
161 @mod_str = ('model_id, ',"$model_id, ");
163 $sth = $dbh -> prepare
("INSERT INTO ".$PsN::config
-> {'_'} -> {'project'}.
166 "filename, date, directory, md5sum ) ".
167 "VALUES (".$mod_str[1].
168 "'$file_str', '$date_time', ".
169 "'$dir_str', '".$md5sum."' )");
172 $self -> {'output_id'} = $sth->{'mysql_insertid'};
173 $self -> {'model_id'} = $model_id;
177 if ( defined $self -> {'output_id'} ) {
178 foreach my $problem ( @
{$self -> {'problems'}} ) {
179 $problem -> register_in_database
( output_id
=> $self -> {'output_id'},
180 model_id
=> $model_id );
184 end register_in_database
186 # }}} register_in_database
191 $full_name = $self -> {'directory'} . $self -> {'filename'};
200 $new_output = Storable
::dclone
( $self );
205 # {{{ Definitions and help text for all accessors
208 # Since PsN output objects are read-only, once they are
209 # initialized (probably through parsing a NONMEM output file) the
210 # methods of the output class are only used to extract
211 # information, not to set any.
213 # The general structure of the values returned by the methods
214 # reflect the level where the attributes belong (problems or sub
215 # problems) and of course also the structure of the attribute
216 # itself (scalar (ofv), array (thetas) or matrix
217 # (raw_cormatrix)). Taking ofv as example, this means that the
218 # returned variable will be a (reference to a) two-dimensional
219 # array, with the indexes problem and subproblem since ofv is a
220 # scalar on the sub problem level.
222 # Most methods take two optional arguments, I<problems> and
223 # I<subproblems>. These can be used to specify which problem or sub
224 # problem that the method should extract the required information
225 # from. problems and subproblems should be references to arrays of
226 # numbers. Some methods that return information related to model
227 # parameters also take I<parameter_numbers> as another optional
228 # argument and this can be used to specify a subset of parameters.
232 # Return the standard errors for omega 1 and 3 (in all problems
235 # @seomega = @{$output_object -> seomegas( parameter_numbers => [1,3] )};
238 # comegas returns the standard deviation for elements on the
239 # diagonal and correlation coefficients for off-diagonal elements.
242 start condition_number
243 # condition_number returns the 2-norm condition number for the correlation matrix, i.e.
244 # the largest eigen value divided by the smallest.
245 # See L</comegas> for details of the method arguments.
250 start covariance_step_run
251 # Returns 1 if the covariance step was run, 0 otherwise. See
252 # L</comegas> for details.
255 end covariance_step_run
257 start covariance_step_successful
258 # Returns 1 if the covariance step was successful, 0
259 # otherwise. See L</comegas> for details on the method arguments.
262 end covariance_step_successful
264 start covariance_step_warnings
265 # Returns 0 if there were no warnings or errors printed during the
266 # covariance step, 1 otherwise. See L</comegas> for details on the
270 end covariance_step_warnings
273 # csigmas returns the standard deviation for elements on the
274 # diagonal and correlation coefficients for off-diagonal elements.
275 # See L</comegas> for details on the method arguments.
281 # cvseomegas returns the relative standard error for the omegas, i.e. SE/estimate.
282 # See L</comegas> for details on the method arguments.
288 # cvsesigmas returns the relative standard error for the sigmas, i.e. SE/estimate.
289 # See L</comegas> for details on the method arguments.
295 # cvsethetas returns the relative standard error for the thetas, i.e. SE/estimate.
296 # See L</comegas> for details on the method arguments.
302 # eigens returns the eigen values.
303 # See L</comegas> for details of the method arguments.
309 # etabar returns the ETABAR estimates.
310 # See L</comegas> for details of the method arguments.
316 # feval returns the number of function evaluations.
317 # See L</comegas> for details of the method arguments.
323 # finalparam returns the final parameter vector as it appears in the monitoring of search section.
324 # See L</comegas> for details of the method arguments.
329 start final_gradients
330 # final_gradients returns the final gradient vector as it appears in the monitoring of search section.
331 # See L</comegas> for details of the method arguments.
337 # fixedomegas returns the a vector of booleans; 1's if
338 # the parameters were fixed during the model fit, 0's
340 # See L</comegas> for details of the method arguments.
346 # fixedsigmas returns the a vector of booleans; 1's if
347 # the parameters were fixed during the model fit, 0's
349 # See L</comegas> for details of the method arguments.
355 # fixedthetas returns the a vector of booleans; 1's if
356 # the parameters were fixed during the model fit, 0's
358 # See L</comegas> for details of the method arguments.
364 # funcevalpath returns the number of function evaluations for each printed iteration in the monitoring of search section.
365 # See L</comegas> for details of the method arguments.
371 # gradient_path returns the gradients for each printed iteration in the monitoring of search section (returns a matrix for each sub problem).
372 # See L</comegas> for details of the method arguments.
378 # Returns 1 if the output object is initialized, i.e. if the I<problems>
379 # or I<filename> attributes are set. Returns 0 otherwise.
383 # initgrad returns the initial gradient vector in the monitoring of search section.
384 # See L</comegas> for details of the method arguments.
390 # initomegas returns the initial omega values.
391 # See L</comegas> for details of the method arguments.
397 # initsigmas returns the initial sigma values.
398 # See L</comegas> for details of the method arguments.
404 # initthetas returns the initial theta values.
405 # See L</comegas> for details of the method arguments.
411 # iternum returns a vector of the iteration numbers in the monitoring of search section.
412 # See L</comegas> for details of the method arguments.
418 # nind returns the number of individuals.
419 # See L</comegas> for details of the method arguments.
425 # nobs returns the number of observations.
426 # See L</comegas> for details of the method arguments.
432 # npofv returns the non-parametric objective function value.
433 # See L</comegas> for details of the method arguments.
439 # nrecs returns the number of records.
440 # See L</comegas> for details of the method arguments.
446 # npomegas returns the non-parametric omega estimates.
447 # See L</comegas> for details of the method arguments.
453 # npthetas returns the non-parametric theta estimates.
454 # See L</comegas> for details of the method arguments.
460 # nth returns the number of thetas.
461 # See L</comegas> for details of the method arguments.
467 # ofvpath returns the objective [function] values in the monitoring of search section.
468 # See L</comegas> for details of the method arguments.
474 # ofv returns the objective function value(s).
475 # See L</comegas> for details of the method arguments.
480 start omega_block_structure
481 # omega_block_structure returns the block structure for
482 # the omega parameters in a lower triangular matrix form
483 # as in the OMEGA HAS BLOCK FORM section in the NONMEM output file.
484 # See L</comegas> for details of the method arguments.
487 end omega_block_structure
490 # omeganameval returns (at the sub problem level) a hash
491 # with default parameter names , i.e. OM1, OM1_2 etc as keys
492 # and parameter estimates as values.
493 # See L</comegas> for details of the method arguments.
499 # omeganames returns the default parameter names, e.g. OM1, OM1_2, OM2, etc
500 # See L</comegas> for details of the method arguments.
506 # omegas returns the omega parameter estimates.
507 # See L</comegas> for details of the method arguments.
513 # parameter_path returns the (normalized) parameter estimates for each iteration in the monitoring of search section (Matrix returned).
514 # See L</comegas> for details of the method arguments.
520 # pval returns the P VAL (reflects the probability that the etas are not centered around zero).
521 # See L</comegas> for details of the method arguments.
527 # raw_covmatrix returns the (raw) covariance matrix including empty matrix elements marked as '.........'.
528 # See L</comegas> for details of the method arguments.
533 start raw_invcovmatrix
534 # raw_invcovmatrix returns the (raw) inverse covariance matrix including empty matrix elements marked as '.........'.
535 # See L</comegas> for details of the method arguments.
541 # raw_cormatrix returns the (raw) correlation matrix including empty matrix elements marked as '.........'.
542 # See L</comegas> for details of the method arguments.
548 # raw_omegas returns the (raw) omegas.
549 # See L</comegas> for details of the method arguments.
555 # raw_seomegas returns the (raw) omega standard error estimates.
556 # See L</comegas> for details of the method arguments.
562 # raw_sesigmas returns the (raw) sigma standard error estimates.
563 # See L</comegas> for details of the method arguments.
569 # raw_sigmas returns the (raw) sigmas.
570 # See L</comegas> for details of the method arguments.
576 # raw_tmatrix returns the (raw) T-matrix.
577 # See L</comegas> for details of the method arguments.
583 # seomegas returns the omega standard error estimates.
584 # See L</comegas> for details of the method arguments.
590 # sesigmas returns the sigma standard error estimates.
591 # See L</comegas> for details of the method arguments.
597 # sethetas returns the theta standard error estimates.
598 # See L</comegas> for details of the method arguments.
603 start significant_digits
604 # significant_digits returns the number of significant digits for the model fit.
605 # See L</comegas> for details of the method arguments.
608 end significant_digits
610 start sigma_block_structure
611 # sigma_block_structure returns the block structure for
612 # the sigma parameters in a lower triangular matrix form
613 # as in the sigma HAS BLOCK FORM section in the NONMEM output file.
614 # See L</csigmas> for details of the method arguments.
617 end sigma_block_structure
620 # sigmanameval returns (at the sub problem level) a hash
621 # with default parameter names , i.e. SI1, SI1_2 etc as keys
622 # and parameter estimates as values.
623 # See L</comegas> for details of the method arguments.
629 # sigmanames returns the default parameter names, i.e. SI1, SI1_2, SI2 etc.
630 # See L</comegas> for details of the method arguments.
636 # sigmas returns the sigma parameter estimates.
637 # See L</comegas> for details of the method arguments.
643 # simulationstep returns a boolean value 1 or 0, reflecting
644 # whether a simulation was performed or not. See L</comegas> for
645 # Details of the method arguments.
650 start minimization_successful
651 # minimization_successful returns a boolean value 1 or 0,
652 # reflecting whether the minimization was successful or not. See
653 # L</comegas> for details of the method arguments.
656 end minimization_successful
658 start minimization_message
659 # minimization_message returns the minimization message, i.e
660 # MINIMIZATION SUCCESSFUL...
661 # See L</comegas> for details of the method arguments.
664 end minimization_message
667 # thetanameval returns (at the sub problem level) a hash
668 # with default parameter names , i.e. TH1, TH2 etc as keys
669 # and parameter estimates as values.
670 # See L</comegas> for details of the method arguments.
676 # thetanames returns the default theta parameter names, TH1, TH2 etc.
677 # See L</comegas> for details of the method arguments.
683 # thetas returns the theta parameter estimates.
684 # See L</comegas> for details of the method arguments.
689 # }}} Definitions and help text for all accessors
694 # have_output returns true if the output files exits or if there
695 # is output data in memory.
696 if( -e
$self -> full_name
|| defined @
{$self -> {'problems'}}){
709 # This is a private method, and should not be used outside
712 @
{$self -> {'lstfile'}} = OSspecific
::slurp_file
($self-> full_name
) ;
713 $self -> {'lstfile_pos'} = 0;
715 # {{{ Old db code. Keep for now
716 # if ( $PsN::config -> {'_'} -> {'use_database'} and
717 # $self -> {'register_in_database'} and
718 # defined $self -> {'output_id'} ) {
719 # my $md5sum = md5_hex(@{$self -> {'lstfile'}});
720 # my $dbh = DBI -> connect("DBI:mysql:host=".$PsN::config -> {'_'} -> {'database_server'}.
721 # ";databse=".$PsN::config -> {'_'} -> {'project'},
722 # $PsN::config -> {'_'} -> {'user'},
723 # $PsN::config -> {'_'} -> {'password'},
724 # {'RaiseError' => 1});
726 # my $sth = $dbh -> prepare( "UPDATE ".$PsN::config -> {'_'} -> {'project'}.
727 # ".output SET md5sum='$md5sum' ".
728 # "WHERE output_id = ".$self -> {'output_id'});
729 # $sth -> execute or debug -> die( message => $sth->errstr ) ;
732 # $dbh -> disconnect;
738 while ( $_ = @
{$self -> {'lstfile'}}[ $self -> {'lstfile_pos'} ++ ] ) {
739 if ( /^ PROBLEM NO\.:\s+\d+\s+$/ or $self -> {'lstfile_pos'} >
740 $#{$self -> {'lstfile'}} ) {
741 if ( defined $problem_start ) {
742 my @problem_lstfile =
743 @
{$self -> {'lstfile'} } [$problem_start .. ($self ->
744 {'lstfile_pos'} - 2)];
745 $self -> add_problem
( init_data
=>
746 { lstfile
=> \
@problem_lstfile,
747 output_id
=> $self -> {'output_id'},
748 model_id
=> $self -> {'model_id'} } );
749 @problem_lstfile = undef;
752 $problem_start = $self -> {'lstfile_pos' };
755 $self -> {'lstfile'} = undef;
757 if( $self -> {'abort_on_fail'} ){
758 debug
-> die( message
=> 'The listfile "' . $self -> full_name
. '" seems malformatted or is missing.' );
760 debug
-> warn( level
=> 1,
761 message
=> 'The listfile "' . $self -> full_name
. '" seems malformatted or is missing.' );
765 $self -> {'parsed_successfully'} = 1;
767 $self -> {'parsed'} = 1;
777 # You should not really use access_any but instead the
778 # specific selector for the information you want, such as
779 # L</sigmas>, L</raw_tmatrix> or similar.
782 # TODO: Add sanity checking of parameter values (more than
783 # the automatic). e.g check that parameter_numbers is a two-
786 if ( $self -> have_output
) {
787 unless ( defined $self -> {'problems'} and
788 scalar @
{$self -> {'problems'}} > 0) {
789 $self -> _read_problems
;
792 debug
-> die( message
=> "Trying to access output object, that have no data on file(".
793 $self->full_name.") or in memory" );
795 unless( $#problems > 0 ){
796 debug
-> warn(level
=> 2,
797 message
=> "Problems undefined, using all" );
798 @problems = (1 .. scalar @
{$self -> {'problems'}});
800 my @own_problems = @
{$self -> {'problems'}};
801 foreach my $i ( @problems ) {
802 if ( defined $own_problems[$i-1] ) {
803 if ( defined( $own_problems[$i-1] -> can
( $attribute ) ) ) {
804 debug
-> warn(level
=> 2,
805 message
=> "method $attribute defined on the problem level" );
806 my $meth_ret = $own_problems[$i-1] -> $attribute;
807 if ( ref ($meth_ret) ) {
808 my @prob_attr = @
{$meth_ret};
809 if ( scalar @parameter_numbers > 0 ) {
811 foreach my $num ( @parameter_numbers ) {
812 if ( $num > 0 and $num <= scalar @prob_attr ) {
813 push( @tmp_arr, $prob_attr[$num-1] );
815 debug
-> die( message
=> "( $attribute ): no such parameter number $num!".
816 "(".scalar @prob_attr." exists)" );
819 @prob_attr = @tmp_arr;
821 push( @return_value, \
@prob_attr );
823 push( @return_value, $meth_ret ) if defined $meth_ret;
826 debug
-> warn(level
=> 2,
827 message
=> "method $attribute defined on the subproblem level" );
829 $own_problems[$i-1] ->
830 access_any
( attribute
=> $attribute,
831 subproblems
=> \
@subproblems,
832 parameter_numbers
=> \
@parameter_numbers );
833 push( @return_value, $problem_ret ) if defined $problem_ret;
836 debug
-> die( message
=> "No such problem ".($i-1) );
839 # Check the return_value to see if we have empty arrays
840 # if ( $#return_value == 0 and ref $return_value[0] and scalar @{$return_value[0]} < 1 ) {
841 # @return_value = ();
848 # {{{ high_correlations
849 start high_correlations
851 my $correlation_matrix = $self -> correlation_matrix
( problems
=> \
@problems,
852 subproblems
=> \
@subproblems );
853 my @thetanames = @
{$self -> thetanames
( problems
=> \
@problems,
854 subproblems
=> \
@subproblems )};
855 my @omeganames = @
{$self -> omeganames
( problems
=> \
@problems,
856 subproblems
=> \
@subproblems )};
857 my @sigmanames = @
{$self -> sigmanames
( problems
=> \
@problems,
858 subproblems
=> \
@subproblems )};
859 my @estimated_thetas = @
{$self -> estimated_thetas
( problems
=> \
@problems,
860 subproblems
=> \
@subproblems )};
861 my @estimated_omegas = @
{$self -> estimated_omegas
( problems
=> \
@problems,
862 subproblems
=> \
@subproblems )};
863 my @estimated_sigmas = @
{$self -> estimated_sigmas
( problems
=> \
@problems,
864 subproblems
=> \
@subproblems )};
866 for ( my $i = 0; $i < scalar @
{$correlation_matrix}; $i++ ) {
867 my ( @prob_corr, @pf_corr );
868 my @names = ( @
{$thetanames[$i]}, @
{$omeganames[$i]}, @
{$sigmanames[$i]} );
869 my @estimated = ( @
{$estimated_thetas[$i]}, @
{$estimated_omegas[$i]}, @
{$estimated_sigmas[$i]} );
870 for ( my $j = 0; $j < scalar @
{$correlation_matrix -> [$i]}; $j++ ) {
871 my ( @sp_corr, @spf_corr );;
873 for ( my $row = 1; $row <= scalar @names; $row++ ) {
874 for ( my $col = 1; $col <= $row; $col++ ) {
875 if ( ( $estimated[$row-1] and $estimated[$col-1] ) ) {
876 if ( not ( $row == $col ) and
877 $correlation_matrix -> [$i][$j][$idx] > $limit or
878 $correlation_matrix -> [$i][$j][$idx] < -$limit ) {
879 push( @sp_corr, $names[$row-1]."-".$names[$col-1] );
880 push( @spf_corr, $correlation_matrix -> [$i][$j][$idx] );
887 # my @names = ( @{$thetanames[$i]}, @{$omeganames[$i]}, @{$sigmanames[$i]} );
888 # my ( @sp_corr, @spf_corr );;
889 # my ( $row, $col ) = ( 1, 1 );
890 # foreach my $element ( @{$correlation_matrix -> [$i][$j]} ) {
891 # if ( $col == $row ) {
895 # if ( $element > $limit or $element < -$limit ) {
896 # push( @sp_corr, $names[$row-1]."-".$names[$col-1] );
897 # push( @spf_corr, $element );
903 push( @prob_corr, \
@sp_corr );
904 push( @pf_corr, \
@spf_corr );
906 push( @high_correlations, \
@prob_corr );
907 push( @found_correlations, \
@pf_corr );
910 end high_correlations
911 # }}} high_correlations
913 # {{{ large_standard_errors
914 start large_standard_errors
916 foreach my $param ( 'theta', 'omega', 'sigma' ) {
917 my @names = eval( '@{$self -> '.$param.'names( problems => \@problems,'.
918 'subproblems => \@subproblems )}' );
919 my @cvs = eval( '@{$self -> cvse'.$param.'s( problems => \@problems,'.
920 'subproblems => \@subproblems )}' );
921 for ( my $i = 0; $i <= $#cvs; $i++ ) {
922 if ( $param eq 'theta' ) {
923 $large_standard_errors[$i] = [];
926 for ( my $j = 0; $j < scalar @
{$cvs[$i]}; $j++ ) {
927 if ( $param eq 'theta' ) {
928 $large_standard_errors[$i][$j] = [];
929 $found_cv[$i][$j] = [];
931 for ( my $k = 0; $k < scalar @
{$cvs[$i][$j]}; $k++ ) {
932 if ( abs($cvs[$i][$j][$k]) > eval('$'.$param.'_cv_limit') ) {
933 push( @
{$large_standard_errors[$i][$j]}, $names[$i][$k] );
934 push( @
{$found_cv[$i][$j]}, $cvs[$i][$j][$k] );
941 end large_standard_errors
942 # }}} large_standard_errors
949 my ( $number, $goal, $sigdig, $zerolim ) = @_;
950 $number = &FormatSigFigs
($number, $sigdig );
953 $test = abs($number) < $zerolim ?
1 : 0;
955 $goal = &FormatSigFigs
($goal, $sigdig );
956 $test = $number eq $goal ?
1 : 0;
961 my @thetanames = @
{$self -> thetanames
};
962 my @omeganames = @
{$self -> omeganames
};
963 my @sigmanames = @
{$self -> sigmanames
};
967 foreach my $param ( 'theta', 'omega', 'sigma' ) {
968 my @estimates = eval( '@{$self -> '.$param.'s}' );
969 my @bounds = eval( '@{$self -> '.$param.'s}' );
970 @indexes = eval( '@{$self -> '.$param.'_indexes}' ) unless ( $param eq 'theta' );
971 for ( my $i = 0; $i <= $#estimates; $i++ ) {
972 if ( $param eq 'theta' ) {
973 $near_bounds[$i] = [];
974 $found_bounds[$i] = [];
975 $found_estimates[$i] = [];
977 for ( my $j = 0; $j < scalar @
{$estimates[$i]}; $j++ ) {
978 if ( $param eq 'theta' ) {
979 $near_bounds[$i][$j] = [];
980 $found_bounds[$i][$j] = [];
981 $found_estimates[$i][$j] = [];
983 for ( my $k = 0; $k < scalar @
{$estimates[$i][$j]}; $k++ ) {
984 # Unless the parameter is fixed:
985 if ( not eval( '$self -> fixed'.$param.'s->[$i][$k]' ) ) {
986 if ( $param eq 'theta' ) {
987 if ( test_sigdig
( $estimates[$i][$j][$k],
988 $self -> lower_theta_bounds
-> [$i][$k],
989 $significant_digits, $zero_limit ) ) {
990 push( @
{$near_bounds[$i][$j]}, eval('$'.$param."names[$i][$k]") );
991 push( @
{$found_bounds[$i][$j]}, $self -> lower_theta_bounds
-> [$i][$k] );
992 push( @
{$found_estimates[$i][$j]}, $estimates[$i][$j][$k] );
994 if ( test_sigdig
( $estimates[$i][$j][$k],
995 $self -> upper_theta_bounds
-> [$i][$k],
996 $significant_digits, $zero_limit ) ) {
997 push( @
{$near_bounds[$i][$j]}, eval('$'.$param."names[$i][$k]") );
998 push( @
{$found_bounds[$i][$j]}, $self -> upper_theta_bounds
-> [$i][$k] );
999 push( @
{$found_estimates[$i][$j]}, $estimates[$i][$j][$k] );
1002 my ( $upper, $lower, $sigdig );
1003 if ( $indexes[$i][$k][0] == $indexes[$i][$k][1] ) { # on diagonal
1004 ( $lower, $upper, $sigdig ) = ( 0, 1000000, $significant_digits );
1006 ( $lower, $upper, $sigdig ) = ( -1, 1, $off_diagonal_sign_digits );
1008 if ( test_sigdig
( $estimates[$i][$j][$k], $lower, $sigdig, $zero_limit ) ) {
1009 push( @
{$near_bounds[$i][$j]}, eval('$'.$param."names[$i][$k]" ) );
1010 push( @
{$found_bounds[$i][$j]}, $lower );
1011 push( @
{$found_estimates[$i][$j]}, $estimates[$i][$j][$k] );
1013 if ( test_sigdig
( $estimates[$i][$j][$k], $upper, $sigdig, $zero_limit ) ) {
1014 push( @
{$near_bounds[$i][$j]}, eval('$'.$param."names[$i][$k]" ) );
1015 push( @
{$found_bounds[$i][$j]}, $upper );
1016 push( @
{$found_estimates[$i][$j]}, $estimates[$i][$j][$k] );
1029 # {{{ problem_structure
1030 start problem_structure
1033 unless( defined $self -> {'problems'} ) {
1034 # Try to read from disk
1035 $self -> _read_problems
;
1038 if( defined $self -> {'problems'} ) {
1039 for(my $problem = 0; $problem < @
{$self -> {'problems'}}; $problem++ ){
1040 $structure[$problem] = scalar @
{$self -> {'problems'} -> [$problem] -> {'subproblems'}};
1042 $self -> flush
if( $flush );
1045 end problem_structure
1050 # labels is this far only a wrap-around for L</thetanames>,
1051 # L</omeganames> and L</sigmanames>
1052 # The functionality of these could be moved here later on.
1054 if ( not defined $parameter_type or
1055 $parameter_type eq '' ) {
1056 my @thetanames = @
{$self -> thetanames
};
1057 my @omeganames = @
{$self -> omeganames
};
1058 my @sigmanames = @
{$self -> sigmanames
};
1059 for ( my $i = 0; $i <= $#thetanames; $i++ ) {
1060 if( defined $thetanames[$i] ){
1061 push( @
{$labels[$i]}, @
{$thetanames[$i]} );
1063 if( defined $omeganames[$i] ){
1064 push( @
{$labels[$i]}, @
{$omeganames[$i]} );
1066 if( defined $sigmanames[$i] ){
1067 push( @
{$labels[$i]}, @
{$sigmanames[$i]} );
1071 my $accessor = $parameter_type.'names';
1072 @labels = @
{$self -> $accessor};
1081 # flush is not an accessor method. As its name implies it flushes the
1082 # output objects memory by setting the I<problems> attribute to undef.
1083 # This method can be useful when many output objects are handled and
1084 # the memory is limited.
1086 # Flushes the object to save memory. There is no need to
1087 # synchronize the ouptut object before this since they are read-
1091 $self -> {'problems'} = undef;