Skip to content

Commit eef0eb3

Browse files
authored
Release 0.2.8
Merge pull request #245 from PEtab-dev/release_0.2.8
2 parents c7d93c3 + 4813832 commit eef0eb3

File tree

6 files changed

+45
-6
lines changed

6 files changed

+45
-6
lines changed

CHANGELOG.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
## 0.2 series
44

5+
### 0.2.8
6+
7+
* Fixed pandas `FutureWarning` in `petab/visualize/lint.py`
8+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/242
9+
* Added `petab.Problem.n_{estimated,measurements,priors}`
10+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/243
11+
* Require pyarrow
12+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/244
13+
14+
* **Full Changelog**: https://github.com/PEtab-dev/libpetab-python/compare/v0.2.7...v0.2.8
15+
516
### 0.2.7
617

718
* Fixed a bug in `flatten_timepoint_specific_output_overrides`, which
@@ -178,8 +189,8 @@ Features:
178189
* Argument forwarding for
179190
`Problem.get_optimization_to_simulation_parameter_mapping` by @dweindl in
180191
https://github.com/PEtab-dev/libpetab-python/pull/159
181-
* Added candidate schema for version 2 by @dweindl in
182-
https://github.com/PEtab-dev/libpetab-python/pull/142
192+
* Added candidate schema for version 2
193+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/142
183194
* `get_parameter_df`: Allow any collection of parameter tables by @dweindl in
184195
https://github.com/PEtab-dev/libpetab-python/pull/153,
185196
@m-philipps in https://github.com/PEtab-dev/libpetab-python/pull/156,
@@ -435,7 +446,7 @@ Documentation:
435446

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

petab/problem.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,3 +1004,21 @@ def scale_parameters(
10041004
)
10051005
for parameter_id, parameter_value in x_dict.items()
10061006
}
1007+
1008+
@property
1009+
def n_estimated(self) -> int:
1010+
"""The number of estimated parameters."""
1011+
return len(self.x_free_indices)
1012+
1013+
@property
1014+
def n_measurements(self) -> int:
1015+
"""Number of measurements."""
1016+
return self.measurement_df[MEASUREMENT].notna().sum()
1017+
1018+
@property
1019+
def n_priors(self) -> int:
1020+
"""Number of priors."""
1021+
if OBJECTIVE_PRIOR_PARAMETERS not in self.parameter_df:
1022+
return 0
1023+
1024+
return self.parameter_df[OBJECTIVE_PRIOR_PARAMETERS].notna().sum()

petab/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""PEtab library version"""
2-
__version__ = "0.2.7"
2+
__version__ = "0.2.8"

petab/visualize/lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def set_default(column: str, value):
144144
elif value is not None:
145145
if isinstance(value, str):
146146
vis_df[column] = vis_df[column].astype("object")
147-
vis_df[column].fillna(value, inplace=True)
147+
vis_df.fillna({column: value}, inplace=True)
148148

149149
set_default(C.PLOT_NAME, "")
150150
set_default(C.PLOT_TYPE_SIMULATION, C.LINE_PLOT)

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def absolute_links(txt):
6363
install_requires=[
6464
"numpy>=1.15.1",
6565
"pandas>=1.2.0",
66+
# remove when pandas >= 3, see also
67+
# https://github.com/pandas-dev/pandas/issues/54466
68+
"pyarrow",
6669
"python-libsbml>=5.17.0",
6770
"sympy",
6871
"colorama",

tests/test_petab.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def petab_problem():
4646
measurement_df = pd.DataFrame(
4747
data={
4848
OBSERVABLE_ID: ["obs1", "obs2"],
49+
MEASUREMENT: [0.1, 0.2],
4950
OBSERVABLE_PARAMETERS: ["", "p1;p2"],
5051
NOISE_PARAMETERS: ["p3;p4", "p5"],
5152
}
@@ -63,6 +64,7 @@ def petab_problem():
6364
data={
6465
PARAMETER_ID: ["dynamicParameter1", "dynamicParameter2"],
6566
PARAMETER_NAME: ["", "..."],
67+
ESTIMATE: [1, 0],
6668
}
6769
).set_index(PARAMETER_ID)
6870

@@ -92,13 +94,18 @@ def petab_problem():
9294
petab.write_observable_df(observable_df, observable_file_name)
9395

9496
with pytest.deprecated_call():
95-
yield petab.Problem.from_files(
97+
petab_problem = petab.Problem.from_files(
9698
sbml_file=sbml_file_name,
9799
measurement_file=measurement_file_name,
98100
condition_file=condition_file_name,
99101
parameter_file=parameter_file_name,
100102
observable_files=observable_file_name,
101103
)
104+
assert petab_problem.n_measurements == 2
105+
assert petab_problem.n_estimated == 1
106+
assert petab_problem.n_priors == 0
107+
108+
yield petab_problem
102109

103110

104111
@pytest.fixture

0 commit comments

Comments
 (0)