Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion petab/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import tempfile
from math import nan
from pathlib import Path, PurePosixPath
from typing import Dict, Iterable, List, Optional, Union, TYPE_CHECKING
from urllib.parse import unquote, urlparse, urlunparse
Expand Down Expand Up @@ -660,7 +661,11 @@ def get_x_nominal(self, free: bool = True, fixed: bool = True,
-------
The parameter nominal values.
"""
v = list(self.parameter_df[NOMINAL_VALUE])
if NOMINAL_VALUE in self.parameter_df:
v = list(self.parameter_df[NOMINAL_VALUE])
else:
v = [nan] * len(self.parameter_df)

if scaled:
v = list(parameters.map_scale(
v, self.parameter_df[PARAMETER_SCALE]))
Expand Down
5 changes: 5 additions & 0 deletions tests/test_petab.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ def test_parameter_properties(petab_problem): # pylint: disable=W0621
assert petab_problem.x_nominal_free_scaled == [7, np.log(8)]
assert petab_problem.x_nominal_fixed_scaled == [np.log10(9)]

# Check that a missing nominalValues column is handled correctly
del petab_problem.parameter_df[NOMINAL_VALUE]
assert len(petab_problem.x_nominal) == 3
assert np.isnan(petab_problem.x_nominal).all()


def test_to_float_if_float():
to_float_if_float = petab.core.to_float_if_float
Expand Down