Skip to content

Commit

Permalink
Release 0.2.8
Browse files Browse the repository at this point in the history
Merge pull request #245 from PEtab-dev/release_0.2.8
  • Loading branch information
dweindl authored Jan 21, 2024
2 parents c7d93c3 + 4813832 commit eef0eb3
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 6 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## 0.2 series

### 0.2.8

* Fixed pandas `FutureWarning` in `petab/visualize/lint.py`
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/242
* Added `petab.Problem.n_{estimated,measurements,priors}`
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/243
* Require pyarrow
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/244

* **Full Changelog**: https://github.com/PEtab-dev/libpetab-python/compare/v0.2.7...v0.2.8

### 0.2.7

* Fixed a bug in `flatten_timepoint_specific_output_overrides`, which
Expand Down Expand Up @@ -178,8 +189,8 @@ Features:
* Argument forwarding for
`Problem.get_optimization_to_simulation_parameter_mapping` by @dweindl in
https://github.com/PEtab-dev/libpetab-python/pull/159
* Added candidate schema for version 2 by @dweindl in
https://github.com/PEtab-dev/libpetab-python/pull/142
* Added candidate schema for version 2
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/142
* `get_parameter_df`: Allow any collection of parameter tables by @dweindl in
https://github.com/PEtab-dev/libpetab-python/pull/153,
@m-philipps in https://github.com/PEtab-dev/libpetab-python/pull/156,
Expand Down Expand Up @@ -435,7 +446,7 @@ Documentation:

* In README, add to the overview table the coverage for the supporting tools,
and links and usage examples (various commits)
* Show REAMDE on readthedocs documentation front page (PEtab-dev/PEtab#400)
* Show README on readthedocs documentation front page (PEtab-dev/PEtab#400)
* Correct description of observable and noise formulas (PEtab-dev/PEtab#401)
* Update documentation on optional visualization values (PEtab-dev/PEtab#405, PEtab-dev/PEtab#419)

Expand Down
18 changes: 18 additions & 0 deletions petab/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,3 +1004,21 @@ def scale_parameters(
)
for parameter_id, parameter_value in x_dict.items()
}

@property
def n_estimated(self) -> int:
"""The number of estimated parameters."""
return len(self.x_free_indices)

@property
def n_measurements(self) -> int:
"""Number of measurements."""
return self.measurement_df[MEASUREMENT].notna().sum()

@property
def n_priors(self) -> int:
"""Number of priors."""
if OBJECTIVE_PRIOR_PARAMETERS not in self.parameter_df:
return 0

return self.parameter_df[OBJECTIVE_PRIOR_PARAMETERS].notna().sum()
2 changes: 1 addition & 1 deletion petab/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""PEtab library version"""
__version__ = "0.2.7"
__version__ = "0.2.8"
2 changes: 1 addition & 1 deletion petab/visualize/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def set_default(column: str, value):
elif value is not None:
if isinstance(value, str):
vis_df[column] = vis_df[column].astype("object")
vis_df[column].fillna(value, inplace=True)
vis_df.fillna({column: value}, inplace=True)

set_default(C.PLOT_NAME, "")
set_default(C.PLOT_TYPE_SIMULATION, C.LINE_PLOT)
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def absolute_links(txt):
install_requires=[
"numpy>=1.15.1",
"pandas>=1.2.0",
# remove when pandas >= 3, see also
# https://github.com/pandas-dev/pandas/issues/54466
"pyarrow",
"python-libsbml>=5.17.0",
"sympy",
"colorama",
Expand Down
9 changes: 8 additions & 1 deletion tests/test_petab.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def petab_problem():
measurement_df = pd.DataFrame(
data={
OBSERVABLE_ID: ["obs1", "obs2"],
MEASUREMENT: [0.1, 0.2],
OBSERVABLE_PARAMETERS: ["", "p1;p2"],
NOISE_PARAMETERS: ["p3;p4", "p5"],
}
Expand All @@ -63,6 +64,7 @@ def petab_problem():
data={
PARAMETER_ID: ["dynamicParameter1", "dynamicParameter2"],
PARAMETER_NAME: ["", "..."],
ESTIMATE: [1, 0],
}
).set_index(PARAMETER_ID)

Expand Down Expand Up @@ -92,13 +94,18 @@ def petab_problem():
petab.write_observable_df(observable_df, observable_file_name)

with pytest.deprecated_call():
yield petab.Problem.from_files(
petab_problem = petab.Problem.from_files(
sbml_file=sbml_file_name,
measurement_file=measurement_file_name,
condition_file=condition_file_name,
parameter_file=parameter_file_name,
observable_files=observable_file_name,
)
assert petab_problem.n_measurements == 2
assert petab_problem.n_estimated == 1
assert petab_problem.n_priors == 0

yield petab_problem


@pytest.fixture
Expand Down

0 comments on commit eef0eb3

Please sign in to comment.