Skip to content

Commit

Permalink
Check if refcorr defined before using
Browse files Browse the repository at this point in the history
  • Loading branch information
rikardn committed Oct 16, 2023
1 parent 7fd336f commit 1ce331d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/tool/npc.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1594,18 +1594,20 @@ sub modelfit_setup
problem_numbers => [$self->simprobnum()]);
$model_sims[$i] -> _write(relative_data_path => $self->copy_data);

my %refcorr = %{$self->refcorr};
if (%refcorr) {
my $num = $i + 1;
my $path = "m1/" . $model_sims[$i]->filename;
my $destpath = "m1/${type}_simulation_refcorr.$num.mod";
my $refstr = "";
for my $k (keys %refcorr) {
$refstr .= "$k=" . $refcorr{$k};
}
PsN::call_pharmpy("data reference $path -o $destpath $refstr");
my $refmodel = model->new(filename => $destpath);
push @refcorr_models, $refmodel;
if (defined $self->refcorr) {
my %refcorr = %{$self->refcorr};
if (%refcorr) {
my $num = $i + 1;
my $path = "m1/" . $model_sims[$i]->filename;
my $destpath = "m1/${type}_simulation_refcorr.$num.mod";
my $refstr = "";
for my $k (keys %refcorr) {
$refstr .= "$k=" . $refcorr{$k};
}
PsN::call_pharmpy("data reference $path -o $destpath $refstr");
my $refmodel = model->new(filename => $destpath);
push @refcorr_models, $refmodel;
}
}
}
$model_orig -> remove_records(type => 'simulation');
Expand Down

0 comments on commit 1ce331d

Please sign in to comment.