Skip to content

Commit b3635b3

Browse files
Fix #101, bugfix parameter fitting
1 parent 35843f6 commit b3635b3

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

release-notes/next-release.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- breaking changes in units handling
33
- bugfix plotting `dimensionless` units in labels
44
- remove deprecated `distrib` and `sampling` functionality.
5+
- fixed typo in sensitivity
56

67
**parameter fitting**
78
- refactoring parameter fitting
@@ -18,3 +19,4 @@
1819
- ‘arctan’ : rho(z) = arctan(z). Limits a maximum loss on a single residual, has properties similar to ‘cauchy’.
1920
- figures closing in reports (#88)
2021
- improved parameter fitting plots and results (#32)
22+
- bugfix all NaN errors (#101)

src/sbmlsim/fit/optimization.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def initialize(
346346
# Changes to baseline, which is the first point
347347
y_ref = y_ref - y_ref[0]
348348

349+
# --- errors on data ---
349350
# Use errors for weighting (tries SD and falls back on SE)
350351
y_ref_err = None
351352
if data_ref.y_sd is not None:
@@ -356,15 +357,25 @@ def initialize(
356357
y_ref_err_type = "SE"
357358
else:
358359
y_ref_err_type = None
360+
# handle special case of all NaN
361+
if np.all(np.isnan(y_ref_err)):
362+
y_ref_err = None
363+
y_ref_err_type = None
359364

360365
# handle missing data (0.0 and NaN)
361366
if y_ref_err is not None:
362367
# remove 0.0 from y-error
363368
y_ref_err[(y_ref_err == 0.0)] = np.NAN
364369
if np.all(np.isnan(y_ref_err)):
365370
# handle special case of all NaN errors
371+
logger.warning(
372+
f"Errors are all NaN '{sid}.{mapping_id}' y data: "
373+
f"'{y_ref_err}'"
374+
)
366375
y_ref_err = None
376+
y_ref_err_type = None
367377
else:
378+
# FIXME: this must be based on coefficient of variation
368379
# some NaNs could exist (err is maximal error of all points)
369380
y_ref_err[np.isnan(y_ref_err)] = np.nanmax(y_ref_err)
370381

src/sbmlsim/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def default(self, o):
5757

5858
if hasattr(o, "to_dict"):
5959
# custom serializer
60-
print(type(o))
60+
# print(type(o))
6161
if isinstance(o, type):
6262
print(o.__name__)
6363
return o.to_dict()

0 commit comments

Comments
 (0)