mxlpy 0.19.0__py3-none-any.whl → 0.21.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mxlpy/__init__.py +4 -10
- mxlpy/carousel.py +166 -0
- mxlpy/compare.py +240 -0
- mxlpy/experimental/diff.py +15 -3
- mxlpy/fit.py +279 -38
- mxlpy/fns.py +37 -42
- mxlpy/identify.py +16 -10
- mxlpy/integrators/__init__.py +4 -3
- mxlpy/integrators/int_assimulo.py +6 -6
- mxlpy/integrators/int_scipy.py +6 -6
- mxlpy/label_map.py +4 -2
- mxlpy/linear_label_map.py +4 -2
- mxlpy/mc.py +26 -34
- mxlpy/mca.py +11 -9
- mxlpy/meta/__init__.py +6 -4
- mxlpy/meta/codegen_latex.py +179 -86
- mxlpy/meta/codegen_modebase.py +3 -1
- mxlpy/meta/codegen_py.py +11 -3
- mxlpy/meta/source_tools.py +8 -4
- mxlpy/model.py +42 -14
- mxlpy/nn/_keras.py +10 -3
- mxlpy/nn/_torch.py +7 -1
- mxlpy/parallel.py +12 -8
- mxlpy/parameterise.py +11 -3
- mxlpy/plot.py +203 -50
- mxlpy/report.py +33 -8
- mxlpy/sbml/__init__.py +3 -3
- mxlpy/sbml/_data.py +7 -6
- mxlpy/sbml/_mathml.py +8 -7
- mxlpy/sbml/_name_conversion.py +5 -1
- mxlpy/scan.py +44 -37
- mxlpy/simulator.py +36 -33
- mxlpy/surrogates/_keras.py +2 -0
- mxlpy/surrogates/_poly.py +6 -2
- mxlpy/surrogates/_qss.py +4 -1
- mxlpy/surrogates/_torch.py +6 -2
- mxlpy/symbolic/__init__.py +5 -3
- mxlpy/symbolic/strikepy.py +5 -2
- mxlpy/symbolic/symbolic_model.py +12 -3
- mxlpy/types.py +5 -10
- {mxlpy-0.19.0.dist-info → mxlpy-0.21.0.dist-info}/METADATA +8 -4
- mxlpy-0.21.0.dist-info/RECORD +56 -0
- mxlpy-0.19.0.dist-info/RECORD +0 -54
- {mxlpy-0.19.0.dist-info → mxlpy-0.21.0.dist-info}/WHEEL +0 -0
- {mxlpy-0.19.0.dist-info → mxlpy-0.21.0.dist-info}/licenses/LICENSE +0 -0
mxlpy/scan.py
CHANGED
@@ -15,19 +15,6 @@ Functions:
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
17
17
|
|
18
|
-
from mxlpy.integrators import DefaultIntegrator
|
19
|
-
|
20
|
-
__all__ = [
|
21
|
-
"ProtocolWorker",
|
22
|
-
"SteadyStateWorker",
|
23
|
-
"TimeCourse",
|
24
|
-
"TimeCourseWorker",
|
25
|
-
"TimePoint",
|
26
|
-
"steady_state",
|
27
|
-
"time_course",
|
28
|
-
"time_course_over_protocol",
|
29
|
-
]
|
30
|
-
|
31
18
|
from dataclasses import dataclass
|
32
19
|
from functools import partial
|
33
20
|
from typing import TYPE_CHECKING, Protocol, Self, cast
|
@@ -37,12 +24,7 @@ import pandas as pd
|
|
37
24
|
|
38
25
|
from mxlpy.parallel import Cache, parallelise
|
39
26
|
from mxlpy.simulator import Result, Simulator
|
40
|
-
from mxlpy.types import
|
41
|
-
IntegratorType,
|
42
|
-
ProtocolByPars,
|
43
|
-
SteadyStates,
|
44
|
-
TimeCourseByPars,
|
45
|
-
)
|
27
|
+
from mxlpy.types import IntegratorType, ProtocolByPars, SteadyStates, TimeCourseByPars
|
46
28
|
|
47
29
|
if TYPE_CHECKING:
|
48
30
|
from collections.abc import Callable
|
@@ -51,6 +33,18 @@ if TYPE_CHECKING:
|
|
51
33
|
from mxlpy.types import Array
|
52
34
|
|
53
35
|
|
36
|
+
__all__ = [
|
37
|
+
"ProtocolWorker",
|
38
|
+
"SteadyStateWorker",
|
39
|
+
"TimeCourse",
|
40
|
+
"TimeCourseWorker",
|
41
|
+
"TimePoint",
|
42
|
+
"steady_state",
|
43
|
+
"time_course",
|
44
|
+
"time_course_over_protocol",
|
45
|
+
]
|
46
|
+
|
47
|
+
|
54
48
|
def _update_parameters_and_initial_conditions[T](
|
55
49
|
pars: pd.Series,
|
56
50
|
fn: Callable[[Model], T],
|
@@ -286,7 +280,8 @@ class SteadyStateWorker(Protocol):
|
|
286
280
|
model: Model,
|
287
281
|
*,
|
288
282
|
rel_norm: bool,
|
289
|
-
integrator: IntegratorType,
|
283
|
+
integrator: IntegratorType | None,
|
284
|
+
y0: dict[str, float] | None,
|
290
285
|
) -> TimePoint:
|
291
286
|
"""Call the worker function."""
|
292
287
|
...
|
@@ -300,7 +295,8 @@ class TimeCourseWorker(Protocol):
|
|
300
295
|
model: Model,
|
301
296
|
time_points: Array,
|
302
297
|
*,
|
303
|
-
integrator: IntegratorType,
|
298
|
+
integrator: IntegratorType | None,
|
299
|
+
y0: dict[str, float] | None,
|
304
300
|
) -> TimeCourse:
|
305
301
|
"""Call the worker function."""
|
306
302
|
...
|
@@ -314,7 +310,8 @@ class ProtocolWorker(Protocol):
|
|
314
310
|
model: Model,
|
315
311
|
protocol: pd.DataFrame,
|
316
312
|
*,
|
317
|
-
integrator: IntegratorType,
|
313
|
+
integrator: IntegratorType | None,
|
314
|
+
y0: dict[str, float] | None,
|
318
315
|
time_points_per_step: int = 10,
|
319
316
|
) -> TimeCourse:
|
320
317
|
"""Call the worker function."""
|
@@ -325,7 +322,8 @@ def _steady_state_worker(
|
|
325
322
|
model: Model,
|
326
323
|
*,
|
327
324
|
rel_norm: bool,
|
328
|
-
integrator: IntegratorType,
|
325
|
+
integrator: IntegratorType | None,
|
326
|
+
y0: dict[str, float] | None,
|
329
327
|
) -> TimePoint:
|
330
328
|
"""Simulate the model to steady state and return concentrations and fluxes.
|
331
329
|
|
@@ -341,7 +339,7 @@ def _steady_state_worker(
|
|
341
339
|
"""
|
342
340
|
try:
|
343
341
|
res = (
|
344
|
-
Simulator(model, integrator=integrator)
|
342
|
+
Simulator(model, integrator=integrator, y0=y0)
|
345
343
|
.simulate_to_steady_state(rel_norm=rel_norm)
|
346
344
|
.get_result()
|
347
345
|
)
|
@@ -353,7 +351,8 @@ def _steady_state_worker(
|
|
353
351
|
def _time_course_worker(
|
354
352
|
model: Model,
|
355
353
|
time_points: Array,
|
356
|
-
|
354
|
+
y0: dict[str, float] | None,
|
355
|
+
integrator: IntegratorType | None,
|
357
356
|
) -> TimeCourse:
|
358
357
|
"""Simulate the model to steady state and return concentrations and fluxes.
|
359
358
|
|
@@ -369,7 +368,7 @@ def _time_course_worker(
|
|
369
368
|
"""
|
370
369
|
try:
|
371
370
|
res = (
|
372
|
-
Simulator(model, integrator=integrator)
|
371
|
+
Simulator(model, integrator=integrator, y0=y0)
|
373
372
|
.simulate_time_course(time_points=time_points)
|
374
373
|
.get_result()
|
375
374
|
)
|
@@ -386,7 +385,8 @@ def _protocol_worker(
|
|
386
385
|
model: Model,
|
387
386
|
protocol: pd.DataFrame,
|
388
387
|
*,
|
389
|
-
integrator: IntegratorType
|
388
|
+
integrator: IntegratorType | None,
|
389
|
+
y0: dict[str, float] | None,
|
390
390
|
time_points_per_step: int = 10,
|
391
391
|
) -> TimeCourse:
|
392
392
|
"""Simulate the model over a protocol and return concentrations and fluxes.
|
@@ -404,7 +404,7 @@ def _protocol_worker(
|
|
404
404
|
"""
|
405
405
|
try:
|
406
406
|
res = (
|
407
|
-
Simulator(model, integrator=integrator)
|
407
|
+
Simulator(model, integrator=integrator, y0=y0)
|
408
408
|
.simulate_over_protocol(
|
409
409
|
protocol=protocol,
|
410
410
|
time_points_per_step=time_points_per_step,
|
@@ -435,7 +435,7 @@ def steady_state(
|
|
435
435
|
rel_norm: bool = False,
|
436
436
|
cache: Cache | None = None,
|
437
437
|
worker: SteadyStateWorker = _steady_state_worker,
|
438
|
-
integrator: IntegratorType =
|
438
|
+
integrator: IntegratorType | None = None,
|
439
439
|
) -> SteadyStates:
|
440
440
|
"""Get steady-state results over supplied values.
|
441
441
|
|
@@ -484,6 +484,7 @@ def steady_state(
|
|
484
484
|
worker,
|
485
485
|
rel_norm=rel_norm,
|
486
486
|
integrator=integrator,
|
487
|
+
y0=None,
|
487
488
|
),
|
488
489
|
model=model,
|
489
490
|
),
|
@@ -491,8 +492,8 @@ def steady_state(
|
|
491
492
|
cache=cache,
|
492
493
|
parallel=parallel,
|
493
494
|
)
|
494
|
-
concs = pd.DataFrame({k: v.variables.T for k, v in res
|
495
|
-
fluxes = pd.DataFrame({k: v.fluxes.T for k, v in res
|
495
|
+
concs = pd.DataFrame({k: v.variables.T for k, v in res}).T
|
496
|
+
fluxes = pd.DataFrame({k: v.fluxes.T for k, v in res}).T
|
496
497
|
idx = (
|
497
498
|
pd.Index(to_scan.iloc[:, 0])
|
498
499
|
if to_scan.shape[1] == 1
|
@@ -511,8 +512,8 @@ def time_course(
|
|
511
512
|
y0: dict[str, float] | None = None,
|
512
513
|
parallel: bool = True,
|
513
514
|
cache: Cache | None = None,
|
515
|
+
integrator: IntegratorType | None = None,
|
514
516
|
worker: TimeCourseWorker = _time_course_worker,
|
515
|
-
integrator: IntegratorType = DefaultIntegrator,
|
516
517
|
) -> TimeCourseByPars:
|
517
518
|
"""Get time course for each supplied parameter.
|
518
519
|
|
@@ -564,6 +565,8 @@ def time_course(
|
|
564
565
|
|
565
566
|
|
566
567
|
"""
|
568
|
+
# We update the initial conditions separately here, because `to_scan` might also
|
569
|
+
# contain initial conditions.
|
567
570
|
if y0 is not None:
|
568
571
|
model.update_variables(y0)
|
569
572
|
|
@@ -574,6 +577,7 @@ def time_course(
|
|
574
577
|
worker,
|
575
578
|
time_points=time_points,
|
576
579
|
integrator=integrator,
|
580
|
+
y0=None, # See comment above
|
577
581
|
),
|
578
582
|
model=model,
|
579
583
|
),
|
@@ -581,8 +585,8 @@ def time_course(
|
|
581
585
|
cache=cache,
|
582
586
|
parallel=parallel,
|
583
587
|
)
|
584
|
-
concs = cast(dict, {k: v.variables for k, v in res
|
585
|
-
fluxes = cast(dict, {k: v.fluxes for k, v in res
|
588
|
+
concs = cast(dict, {k: v.variables for k, v in res})
|
589
|
+
fluxes = cast(dict, {k: v.fluxes for k, v in res})
|
586
590
|
return TimeCourseByPars(
|
587
591
|
parameters=to_scan,
|
588
592
|
variables=pd.concat(concs, names=["n", "time"]),
|
@@ -600,7 +604,7 @@ def time_course_over_protocol(
|
|
600
604
|
parallel: bool = True,
|
601
605
|
cache: Cache | None = None,
|
602
606
|
worker: ProtocolWorker = _protocol_worker,
|
603
|
-
integrator: IntegratorType =
|
607
|
+
integrator: IntegratorType | None = None,
|
604
608
|
) -> ProtocolByPars:
|
605
609
|
"""Get protocol series for each supplied parameter.
|
606
610
|
|
@@ -631,6 +635,8 @@ def time_course_over_protocol(
|
|
631
635
|
TimeCourseByPars: Protocol series results for each parameter set.
|
632
636
|
|
633
637
|
"""
|
638
|
+
# We update the initial conditions separately here, because `to_scan` might also
|
639
|
+
# contain initial conditions.
|
634
640
|
if y0 is not None:
|
635
641
|
model.update_variables(y0)
|
636
642
|
|
@@ -642,6 +648,7 @@ def time_course_over_protocol(
|
|
642
648
|
protocol=protocol,
|
643
649
|
time_points_per_step=time_points_per_step,
|
644
650
|
integrator=integrator,
|
651
|
+
y0=None,
|
645
652
|
),
|
646
653
|
model=model,
|
647
654
|
),
|
@@ -649,8 +656,8 @@ def time_course_over_protocol(
|
|
649
656
|
cache=cache,
|
650
657
|
parallel=parallel,
|
651
658
|
)
|
652
|
-
concs = cast(dict, {k: v.variables for k, v in res
|
653
|
-
fluxes = cast(dict, {k: v.fluxes for k, v in res
|
659
|
+
concs = cast(dict, {k: v.variables for k, v in res})
|
660
|
+
fluxes = cast(dict, {k: v.fluxes for k, v in res})
|
654
661
|
return ProtocolByPars(
|
655
662
|
parameters=to_scan,
|
656
663
|
protocol=protocol,
|
mxlpy/simulator.py
CHANGED
@@ -21,14 +21,17 @@ from sympy import lambdify
|
|
21
21
|
from mxlpy.integrators import DefaultIntegrator
|
22
22
|
from mxlpy.symbolic import to_symbolic_model
|
23
23
|
|
24
|
-
__all__ = ["Result", "Simulator"]
|
25
|
-
|
26
24
|
if TYPE_CHECKING:
|
27
25
|
from collections.abc import Iterator
|
28
26
|
|
29
27
|
from mxlpy.model import Model
|
30
28
|
from mxlpy.types import Array, ArrayLike, IntegratorProtocol, IntegratorType
|
31
29
|
|
30
|
+
__all__ = [
|
31
|
+
"Result",
|
32
|
+
"Simulator",
|
33
|
+
]
|
34
|
+
|
32
35
|
|
33
36
|
def _normalise_split_results(
|
34
37
|
results: list[pd.DataFrame],
|
@@ -332,7 +335,7 @@ class Simulator:
|
|
332
335
|
self,
|
333
336
|
model: Model,
|
334
337
|
y0: dict[str, float] | None = None,
|
335
|
-
integrator: IntegratorType =
|
338
|
+
integrator: IntegratorType | None = None,
|
336
339
|
*,
|
337
340
|
use_jacobian: bool = False,
|
338
341
|
test_run: bool = True,
|
@@ -351,7 +354,7 @@ class Simulator:
|
|
351
354
|
self.model = model
|
352
355
|
self.y0 = model.get_initial_conditions() if y0 is None else y0
|
353
356
|
|
354
|
-
self._integrator_type = integrator
|
357
|
+
self._integrator_type = DefaultIntegrator if integrator is None else integrator
|
355
358
|
self._time_shift = None
|
356
359
|
self.variables = None
|
357
360
|
self.dependent = None
|
@@ -500,6 +503,35 @@ class Simulator:
|
|
500
503
|
self._handle_simulation_results(time, results, skipfirst=True)
|
501
504
|
return self
|
502
505
|
|
506
|
+
def simulate_over_protocol(
|
507
|
+
self,
|
508
|
+
protocol: pd.DataFrame,
|
509
|
+
time_points_per_step: int = 10,
|
510
|
+
) -> Self:
|
511
|
+
"""Simulate the model over a given protocol.
|
512
|
+
|
513
|
+
Examples:
|
514
|
+
>>> Simulator(model).simulate_over_protocol(
|
515
|
+
... protocol,
|
516
|
+
... time_points_per_step=10
|
517
|
+
... )
|
518
|
+
|
519
|
+
Args:
|
520
|
+
protocol: DataFrame containing the protocol.
|
521
|
+
time_points_per_step: Number of time points per step.
|
522
|
+
|
523
|
+
Returns:
|
524
|
+
The Simulator instance with updated results.
|
525
|
+
|
526
|
+
"""
|
527
|
+
for t_end, pars in protocol.iterrows():
|
528
|
+
t_end = cast(pd.Timedelta, t_end)
|
529
|
+
self.model.update_parameters(pars.to_dict())
|
530
|
+
self.simulate(t_end.total_seconds(), steps=time_points_per_step)
|
531
|
+
if self.variables is None:
|
532
|
+
break
|
533
|
+
return self
|
534
|
+
|
503
535
|
def simulate_to_steady_state(
|
504
536
|
self,
|
505
537
|
tolerance: float = 1e-6,
|
@@ -535,35 +567,6 @@ class Simulator:
|
|
535
567
|
)
|
536
568
|
return self
|
537
569
|
|
538
|
-
def simulate_over_protocol(
|
539
|
-
self,
|
540
|
-
protocol: pd.DataFrame,
|
541
|
-
time_points_per_step: int = 10,
|
542
|
-
) -> Self:
|
543
|
-
"""Simulate the model over a given protocol.
|
544
|
-
|
545
|
-
Examples:
|
546
|
-
>>> Simulator(model).simulate_over_protocol(
|
547
|
-
... protocol,
|
548
|
-
... time_points_per_step=10
|
549
|
-
... )
|
550
|
-
|
551
|
-
Args:
|
552
|
-
protocol: DataFrame containing the protocol.
|
553
|
-
time_points_per_step: Number of time points per step.
|
554
|
-
|
555
|
-
Returns:
|
556
|
-
The Simulator instance with updated results.
|
557
|
-
|
558
|
-
"""
|
559
|
-
for t_end, pars in protocol.iterrows():
|
560
|
-
t_end = cast(pd.Timedelta, t_end)
|
561
|
-
self.model.update_parameters(pars.to_dict())
|
562
|
-
self.simulate(t_end.total_seconds(), steps=time_points_per_step)
|
563
|
-
if self.variables is None:
|
564
|
-
break
|
565
|
-
return self
|
566
|
-
|
567
570
|
def get_result(self) -> Result | None:
|
568
571
|
"""Get result of the simulation.
|
569
572
|
|
mxlpy/surrogates/_keras.py
CHANGED
mxlpy/surrogates/_poly.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
|
2
3
|
from dataclasses import dataclass
|
3
|
-
from typing import Literal
|
4
|
+
from typing import TYPE_CHECKING, Literal
|
4
5
|
|
5
6
|
import numpy as np
|
6
7
|
import pandas as pd
|
@@ -8,6 +9,9 @@ from numpy import polynomial
|
|
8
9
|
|
9
10
|
from mxlpy.types import AbstractSurrogate, ArrayLike, Derived
|
10
11
|
|
12
|
+
if TYPE_CHECKING:
|
13
|
+
from collections.abc import Iterable
|
14
|
+
|
11
15
|
__all__ = [
|
12
16
|
"PolynomialExpansion",
|
13
17
|
"Surrogate",
|
mxlpy/surrogates/_qss.py
CHANGED
mxlpy/surrogates/_torch.py
CHANGED
@@ -1,18 +1,22 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
from collections.abc import Callable
|
2
4
|
from dataclasses import dataclass
|
3
|
-
from typing import Self
|
5
|
+
from typing import TYPE_CHECKING, Self
|
4
6
|
|
5
7
|
import numpy as np
|
6
8
|
import pandas as pd
|
7
9
|
import torch
|
8
10
|
from torch import nn
|
9
11
|
from torch.optim.adam import Adam
|
10
|
-
from torch.optim.optimizer import ParamsT
|
11
12
|
|
12
13
|
from mxlpy.nn._torch import MLP, DefaultDevice
|
13
14
|
from mxlpy.nn._torch import train as _train
|
14
15
|
from mxlpy.types import AbstractSurrogate, Derived
|
15
16
|
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
from torch.optim.optimizer import ParamsT
|
19
|
+
|
16
20
|
type LossFn = Callable[[torch.Tensor, torch.Tensor], torch.Tensor]
|
17
21
|
|
18
22
|
__all__ = [
|
mxlpy/symbolic/__init__.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
"""Symbolic utilities."""
|
2
2
|
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from .strikepy import check_identifiability
|
6
|
+
from .symbolic_model import SymbolicModel, to_symbolic_model
|
7
|
+
|
3
8
|
__all__ = [
|
4
9
|
"SymbolicModel",
|
5
10
|
"check_identifiability",
|
6
11
|
"to_symbolic_model",
|
7
12
|
]
|
8
|
-
|
9
|
-
from .strikepy import check_identifiability
|
10
|
-
from .symbolic_model import SymbolicModel, to_symbolic_model
|
mxlpy/symbolic/strikepy.py
CHANGED
@@ -10,13 +10,15 @@ FIXME:
|
|
10
10
|
- performance issues of generic_rank
|
11
11
|
"""
|
12
12
|
|
13
|
+
from __future__ import annotations
|
14
|
+
|
13
15
|
import textwrap
|
14
16
|
from concurrent.futures import ProcessPoolExecutor
|
15
17
|
from dataclasses import dataclass, field
|
16
18
|
from functools import partial
|
17
19
|
from math import ceil, inf
|
18
20
|
from time import time
|
19
|
-
from typing import cast
|
21
|
+
from typing import TYPE_CHECKING, cast
|
20
22
|
|
21
23
|
import numpy as np
|
22
24
|
import numpy.typing as npt
|
@@ -27,7 +29,8 @@ import tqdm
|
|
27
29
|
from sympy import Matrix
|
28
30
|
from sympy.matrices import zeros
|
29
31
|
|
30
|
-
|
32
|
+
if TYPE_CHECKING:
|
33
|
+
from .symbolic_model import SymbolicModel
|
31
34
|
|
32
35
|
__all__ = [
|
33
36
|
"Options",
|
mxlpy/symbolic/symbolic_model.py
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
# ruff: noqa: D100, D101, D102, D103, D104, D105, D106, D107, D200, D203, D400, D401
|
2
2
|
|
3
3
|
|
4
|
-
from
|
4
|
+
from __future__ import annotations
|
5
|
+
|
5
6
|
from dataclasses import dataclass
|
7
|
+
from typing import TYPE_CHECKING
|
6
8
|
|
7
9
|
import sympy
|
8
10
|
|
9
11
|
from mxlpy.meta.source_tools import fn_to_sympy
|
10
|
-
from mxlpy.model import Model
|
11
12
|
|
12
|
-
|
13
|
+
if TYPE_CHECKING:
|
14
|
+
from collections.abc import Iterable
|
15
|
+
|
16
|
+
from mxlpy.model import Model
|
17
|
+
|
18
|
+
__all__ = [
|
19
|
+
"SymbolicModel",
|
20
|
+
"to_symbolic_model",
|
21
|
+
]
|
13
22
|
|
14
23
|
|
15
24
|
@dataclass
|
mxlpy/types.py
CHANGED
@@ -17,9 +17,13 @@ Classes:
|
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
19
|
from abc import abstractmethod
|
20
|
+
from collections.abc import Callable, Iterable, Iterator, Mapping
|
20
21
|
from dataclasses import dataclass, field
|
22
|
+
from typing import TYPE_CHECKING, Any, ParamSpec, Protocol, TypeVar, cast
|
21
23
|
|
24
|
+
import numpy as np
|
22
25
|
import pandas as pd
|
26
|
+
from numpy.typing import NDArray
|
23
27
|
|
24
28
|
__all__ = [
|
25
29
|
"AbstractEstimator",
|
@@ -27,7 +31,6 @@ __all__ = [
|
|
27
31
|
"Array",
|
28
32
|
"ArrayLike",
|
29
33
|
"Derived",
|
30
|
-
"Float",
|
31
34
|
"IntegratorProtocol",
|
32
35
|
"IntegratorType",
|
33
36
|
"McSteadyStates",
|
@@ -46,15 +49,7 @@ __all__ = [
|
|
46
49
|
"unwrap2",
|
47
50
|
]
|
48
51
|
|
49
|
-
|
50
|
-
from typing import TYPE_CHECKING, Any, ParamSpec, Protocol, TypeVar, cast
|
51
|
-
|
52
|
-
import numpy as np
|
53
|
-
import numpy.typing as npt
|
54
|
-
from numpy.typing import NDArray
|
55
|
-
|
56
|
-
type Float = npt.NDArray[np.floating[Any]] | float
|
57
|
-
type RateFn = Callable[..., Float]
|
52
|
+
type RateFn = Callable[..., float]
|
58
53
|
type Array = NDArray[np.floating[Any]]
|
59
54
|
type ArrayLike = NDArray[np.floating[Any]] | list[float]
|
60
55
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mxlpy
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.21.0
|
4
4
|
Summary: A package to build metabolic models
|
5
5
|
Author-email: Marvin van Aalst <marvin.vanaalst@gmail.com>
|
6
6
|
Maintainer-email: Marvin van Aalst <marvin.vanaalst@gmail.com>
|
@@ -51,10 +51,12 @@ Requires-Dist: torch>=2.5.1; extra == 'torch'
|
|
51
51
|
Description-Content-Type: text/markdown
|
52
52
|
|
53
53
|
<p align="center">
|
54
|
-
<img src="docs/assets/logo-diagram.png" width="600px" alt='mxlpy-logo'>
|
54
|
+
<img src="https://raw.githubusercontent.com/Computational-Biology-Aachen/MxlPy/refs/heads/main/docs/assets/logo-diagram.png" width="600px" alt='mxlpy-logo'>
|
55
55
|
</p>
|
56
56
|
|
57
|
-
|
57
|
+
|
58
|
+
|
59
|
+
# MxlPy
|
58
60
|
|
59
61
|
[](https://pypi.python.org/pypi/mxlpy)
|
60
62
|
[![docs][docs-badge]][docs]
|
@@ -67,11 +69,13 @@ Description-Content-Type: text/markdown
|
|
67
69
|
[docs-badge]: https://img.shields.io/badge/docs-main-green.svg?style=flat-square
|
68
70
|
[docs]: https://computational-biology-aachen.github.io/mxlpy/
|
69
71
|
|
72
|
+
MxlPy (pronounced "em axe el pie") is a Python package for mechanistic learning (Mxl) - the combination of mechanistic modeling and machine learning to deliver explainable, data-informed solutions.
|
73
|
+
|
70
74
|
## Installation
|
71
75
|
|
72
76
|
You can install mxlpy using pip: `pip install mxlpy`.
|
73
77
|
|
74
|
-
Due to their sizes, the machine learning are optional dependencies. You
|
78
|
+
Due to their sizes, the machine learning packages are optional dependencies. You can install them using
|
75
79
|
|
76
80
|
```shell
|
77
81
|
# One of them respectively
|
@@ -0,0 +1,56 @@
|
|
1
|
+
mxlpy/__init__.py,sha256=4pbDeyLhQjfL76h2oXdodARzKkrkX5wESV7kEjwC3K8,4399
|
2
|
+
mxlpy/carousel.py,sha256=o72YKzfPCDhT5oHhow4oNvIShG-i3-Z0UMEQLt2iE5A,4699
|
3
|
+
mxlpy/compare.py,sha256=6iIl6yKXP9guSVLgqqnaqILP_BF_oqyx7DTGbdpwAjM,7800
|
4
|
+
mxlpy/distributions.py,sha256=ce6RTqn19YzMMec-u09fSIUA8A92M6rehCuHuXWcX7A,8734
|
5
|
+
mxlpy/fit.py,sha256=vJGd_kl-MqyI7db96uM9STeBnvPVu1VGLCiGuH8mEKc,19009
|
6
|
+
mxlpy/fns.py,sha256=NLxYwa3ylS7SkISBjw_TgQSKEm7WnkZF9wPigX_ZCAM,13915
|
7
|
+
mxlpy/identify.py,sha256=yU6ccd0yDJhtyo5gkemMuecZALzjR1KzT0vKPmlL4kg,2107
|
8
|
+
mxlpy/label_map.py,sha256=Zla9tey-7_POTE57XNEuCSeTqdAbMWZdj_j_OwokngY,17823
|
9
|
+
mxlpy/linear_label_map.py,sha256=5FyD0MMdSGsC3eKeBnpd1LBHyVBqIDWCDjgR8_q6XZo,10289
|
10
|
+
mxlpy/mc.py,sha256=bt2DrMaovWO_LM3PfkVr0cvK6k_ZSjLRnudasgC5SRM,17132
|
11
|
+
mxlpy/mca.py,sha256=B1bRb_EHim3uJ90KJkTZ5HXrVOBjrctcRCsQG4PXU-U,9351
|
12
|
+
mxlpy/model.py,sha256=14gncyYft39rwoiJPb5AynL3whXnZrJY3N7SLExH0Qk,62056
|
13
|
+
mxlpy/parallel.py,sha256=yLQLw5O4vnPVp_Zmtw1UhPWtB3483foimxQB-TwFKPg,5016
|
14
|
+
mxlpy/parameterise.py,sha256=IgbvfEnkmaqVq_5GgFjHqApGUN9CJrsVD3Fr7pg9iFA,758
|
15
|
+
mxlpy/paths.py,sha256=TK2wO4N9lG-UV1JGfeB64q48JVDbwqIUj63rl55MKuQ,1022
|
16
|
+
mxlpy/plot.py,sha256=PA7tAmy2XXACxBLtdnfpxKUFRzi-lnCQjr7gw_nzxKU,32544
|
17
|
+
mxlpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
+
mxlpy/report.py,sha256=6V_kH5usFtar2lUGLjG5k7WIJjUi1TD5qIO7V_6V3Gc,8773
|
19
|
+
mxlpy/scan.py,sha256=_MwwTiL-IQPlUU9e2L1Wc-V95sElcaPw-DkxoXYanzc,19421
|
20
|
+
mxlpy/simulator.py,sha256=tdxTUbsWo3SdYi7a1lsMah9D_Dz_FqnMjTfK-3oT2Gk,21091
|
21
|
+
mxlpy/types.py,sha256=FXBkwHgQ3v_k4ER49hDqyFMIA6i1BQf8isPma97LJdg,12605
|
22
|
+
mxlpy/experimental/__init__.py,sha256=kZTE-92OErpHzNRqmgSQYH4CGXrogGJ5EL35XGZQ81M,206
|
23
|
+
mxlpy/experimental/diff.py,sha256=MoM15rbMAHa7p9Zva8NxIc7K585kHJYKFaD1LnN5e10,9088
|
24
|
+
mxlpy/integrators/__init__.py,sha256=OLdcNCDIOiD1Z2LO143YtD47cMadNJt0app41nLAx5o,456
|
25
|
+
mxlpy/integrators/int_assimulo.py,sha256=8gLR1D4zJ-TnJ9DTkfkqA2uVE0H2w_npZhZ8RoWZOX8,5013
|
26
|
+
mxlpy/integrators/int_scipy.py,sha256=MEwhTNhMMVQE2UFWxv5fifN6TKVjRsyDmyibuuNNiHI,4649
|
27
|
+
mxlpy/meta/__init__.py,sha256=Z3LnN3a9qDAJTukHZs_nF_G6DrjKXOqBvOb47rSsAsM,314
|
28
|
+
mxlpy/meta/codegen_latex.py,sha256=ocdn_mrjPXllYBwImOBQcFzjFR6LONnBs3fhRIA0yzs,22875
|
29
|
+
mxlpy/meta/codegen_modebase.py,sha256=ziUuwod1F10ak7WTj5gcuVL7MLtK65kUhqKGCxgn3mY,3131
|
30
|
+
mxlpy/meta/codegen_py.py,sha256=bpwXrGUaf8lO81VVcIh0cbtf4cd84CYDZrL3ngf1FHo,3587
|
31
|
+
mxlpy/meta/source_tools.py,sha256=8kZD0_FnO2t8MTG9FvEFOhhU52uXKNpQJW6xDOGWGck,13540
|
32
|
+
mxlpy/nn/__init__.py,sha256=Qjr-ERsY2lbD75sFBOhCUwEasQDSJKcpBn_kReLZ6oA,633
|
33
|
+
mxlpy/nn/_keras.py,sha256=-5zjHRu8OjSiZeuBSIZFyB63uBsNNH5o9y4kBcPnhx8,2263
|
34
|
+
mxlpy/nn/_torch.py,sha256=GUJmLU282VU4O-fs3Sz90SEaAnfuXN2MPlBr_tHmvn4,5775
|
35
|
+
mxlpy/npe/__init__.py,sha256=hBHCUD2JYDBBGS2kTY8mTCfWB3u1R7m5l--wUupZt6o,1270
|
36
|
+
mxlpy/npe/_keras.py,sha256=ytvXMPK9KUCGOzTQm08_SgafiMb-MOIUdZQV7JjAO40,9721
|
37
|
+
mxlpy/npe/_torch.py,sha256=v3joh6lFJJxvYJj--wzmKXL9UMTaIN3h6hPNq0uX9NU,11250
|
38
|
+
mxlpy/sbml/__init__.py,sha256=Mt97CddpLi3wIrA1b_5cagLmDdNxAVF_S7QV57Pzw8s,226
|
39
|
+
mxlpy/sbml/_data.py,sha256=yYli7ZQ1_pnH9kt5EmcuHM0moQoa43rrFVdrseXlG0o,1136
|
40
|
+
mxlpy/sbml/_export.py,sha256=4tU3SVxfEvl0E1urZWHyphkiAeH5HeRO1cODvvrczAQ,20342
|
41
|
+
mxlpy/sbml/_import.py,sha256=5odQBdpD93mQJp2bVIabmPo6NK60nxqrdSVB8fEsF_A,22099
|
42
|
+
mxlpy/sbml/_mathml.py,sha256=oaU9q5yb9jvDGxDJrqOkbOiurCB1Vv_P99oUwJ7v1VE,24437
|
43
|
+
mxlpy/sbml/_name_conversion.py,sha256=93muW47M7qJoE227HKHmThWpPeWsXDN9eM8cRH2pqPs,1340
|
44
|
+
mxlpy/sbml/_unit_conversion.py,sha256=dW_I6_Ou09ccwnp6LIdrPriIQnQUK5lJcjzM2Fawm6U,1927
|
45
|
+
mxlpy/surrogates/__init__.py,sha256=cz9qr0ToYSutIK45IvKrMe1mPP7Lj0I_V0HYGixfpZU,916
|
46
|
+
mxlpy/surrogates/_keras.py,sha256=r2pR3iTJOaMqtATbsCm5CF94TYG9b-9cKljc8kMOplQ,3852
|
47
|
+
mxlpy/surrogates/_poly.py,sha256=z2g3JTdVyQJ8dIiXP4BOun_yMZOrlYpPNvQ0wmFYDTk,3672
|
48
|
+
mxlpy/surrogates/_qss.py,sha256=9w-hPPhdcwybkyaSX0sIfYfvcKu1U5j4HHj4SlgZcYQ,723
|
49
|
+
mxlpy/surrogates/_torch.py,sha256=gU0secuRBYgewhNqZmSo6_Xf804dSzwWwIYmdKA7y60,6389
|
50
|
+
mxlpy/symbolic/__init__.py,sha256=_vM5YM5I6OH0QDbFt9uGYKO8Z5Vly0wbGuvUScVrPRU,258
|
51
|
+
mxlpy/symbolic/strikepy.py,sha256=tzo3uvPpXLDex09hWTuitVzuTNwbgl7jWGjD8g6a8iI,20033
|
52
|
+
mxlpy/symbolic/symbolic_model.py,sha256=JFzcIdyfJihvKjef748DMXU6WI8nHjgjIk5BwUuB4HQ,2543
|
53
|
+
mxlpy-0.21.0.dist-info/METADATA,sha256=ZKxvZTNcrNCaadkRmKSU_6bQlSsJdTtuz_idNVEVbVs,4601
|
54
|
+
mxlpy-0.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
55
|
+
mxlpy-0.21.0.dist-info/licenses/LICENSE,sha256=lHX9Eu70g3Iv1aOxXTWNHa3vq9vaVYSPQx4jOLYmDpw,1096
|
56
|
+
mxlpy-0.21.0.dist-info/RECORD,,
|
mxlpy-0.19.0.dist-info/RECORD
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
mxlpy/__init__.py,sha256=ODndmfAX0zFTSqK1kVQN2s4W3FDqxuu5Mvf1pnv0IdE,4421
|
2
|
-
mxlpy/distributions.py,sha256=ce6RTqn19YzMMec-u09fSIUA8A92M6rehCuHuXWcX7A,8734
|
3
|
-
mxlpy/fit.py,sha256=WNg98wW47xkd4gNEgj3t8eNNTqfVpHEJTbXMRQBe22o,12457
|
4
|
-
mxlpy/fns.py,sha256=VxDDyEdtGD7fEoT5LiiEaRqFk-0fIunRXHr1dCMpCdE,14002
|
5
|
-
mxlpy/identify.py,sha256=veYYCjTDAlzibrWtciX2egfEWWgosOpqgLBgbfVj42g,2130
|
6
|
-
mxlpy/label_map.py,sha256=_bStQJtQ4RlmTQyrW34W62pyXFF_XFVbTXv-ybdly0s,17816
|
7
|
-
mxlpy/linear_label_map.py,sha256=DqzN_akacPccZwzYAR3ANIdzAU_GU6Xe6gWV9DHAAWU,10282
|
8
|
-
mxlpy/mc.py,sha256=oYd8a3ycyZLyh-ZxTYUjDRNfsCcwSQaLWssxv0yC5Cc,17399
|
9
|
-
mxlpy/mca.py,sha256=1_qBX9lHI6svXSebtwvMldAMwPlLqMylAPmxMbMQdWw,9359
|
10
|
-
mxlpy/model.py,sha256=ykdFmh7AejqN8qJUXddc9tFVhDWED4CZ8QgRyyCrmK0,60784
|
11
|
-
mxlpy/parallel.py,sha256=kX4Td5YoovDwZp6kX_3cfO6QtHSS9ieJ0bMZiKs3Xv8,5002
|
12
|
-
mxlpy/parameterise.py,sha256=2jMhhO-bHTFP_0kXercJekeATAZYBg5FrK1MQ_mWGpk,654
|
13
|
-
mxlpy/paths.py,sha256=TK2wO4N9lG-UV1JGfeB64q48JVDbwqIUj63rl55MKuQ,1022
|
14
|
-
mxlpy/plot.py,sha256=MiV2Oi5kvI04VjjWiiVbAzRCGaZWue58_hQIRGzS4ik,28879
|
15
|
-
mxlpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
mxlpy/report.py,sha256=ZwnjquPAvo4A8UqK-BT19SZFSEUOy1FALqoh7uTmbAI,7793
|
17
|
-
mxlpy/scan.py,sha256=FBPpjv66v4IWZ5OwG_EWUdrucLWR9gq_XEsLFC-otaw,18969
|
18
|
-
mxlpy/simulator.py,sha256=9Ne4P5Jrwgx4oAlljPvCqSCCy98_5Lv1B87y1AkbI4c,21041
|
19
|
-
mxlpy/types.py,sha256=swhRTCRNbmI8-2Z3Y0YA9QkxrTxwzYJlMz2qFcfpRsA,12698
|
20
|
-
mxlpy/experimental/__init__.py,sha256=kZTE-92OErpHzNRqmgSQYH4CGXrogGJ5EL35XGZQ81M,206
|
21
|
-
mxlpy/experimental/diff.py,sha256=cxr3GkZOkhUaWDj1eXHbjKSVKciGIp_IUf7Jkh0FdEE,8968
|
22
|
-
mxlpy/integrators/__init__.py,sha256=kqmV6a0TRyLGR_XqbyAI652AfptYnXAUpqbSFg0CpP8,450
|
23
|
-
mxlpy/integrators/int_assimulo.py,sha256=H092idSPeFkPKAOVbr8M8iGdDpfc-MlPeDvh3-tP4rY,5013
|
24
|
-
mxlpy/integrators/int_scipy.py,sha256=87nAVMY0DLQ_RAIDNa7pN6Xw8NFv5ifyZd8EmPT9rgY,4649
|
25
|
-
mxlpy/meta/__init__.py,sha256=Jyy4063fZy6iT4LSwjPyEAVr4N_3xxcLc8wDBoDPyKc,278
|
26
|
-
mxlpy/meta/codegen_latex.py,sha256=OjDgfRRvibs9Bg75J_FSl9fh_MTs8Vqu4Wm9L2JTOCk,19982
|
27
|
-
mxlpy/meta/codegen_modebase.py,sha256=_ZAW4NvXhKwJQLGz5hkwwZpL2JMAJlfG-GUWkYIiNvw,3124
|
28
|
-
mxlpy/meta/codegen_py.py,sha256=xSdeuEGPGc-QKRMgJO4VSPGMlxCPEV5prkKjNQ2D2hg,3483
|
29
|
-
mxlpy/meta/source_tools.py,sha256=GSSFgH2lZ24e6eQxJ-lx4WSwawoPYdIwj_klt5Kr0h8,13464
|
30
|
-
mxlpy/nn/__init__.py,sha256=Qjr-ERsY2lbD75sFBOhCUwEasQDSJKcpBn_kReLZ6oA,633
|
31
|
-
mxlpy/nn/_keras.py,sha256=wffBYvQDNGp5me6x2yW4EwpKsnMojCJbXHfKE156a-w,2175
|
32
|
-
mxlpy/nn/_torch.py,sha256=Omq7iMx2kbUXht2It-egiIYT2DzLGPbkpTCX-h17teI,5752
|
33
|
-
mxlpy/npe/__init__.py,sha256=hBHCUD2JYDBBGS2kTY8mTCfWB3u1R7m5l--wUupZt6o,1270
|
34
|
-
mxlpy/npe/_keras.py,sha256=ytvXMPK9KUCGOzTQm08_SgafiMb-MOIUdZQV7JjAO40,9721
|
35
|
-
mxlpy/npe/_torch.py,sha256=v3joh6lFJJxvYJj--wzmKXL9UMTaIN3h6hPNq0uX9NU,11250
|
36
|
-
mxlpy/sbml/__init__.py,sha256=AS7IwrBzBgN8coUZkyBEtiYa9ICWyY1wzp1ujVm5ItA,226
|
37
|
-
mxlpy/sbml/_data.py,sha256=XwT1sSxn6KLTXYMbk4ORbEAEgZhQDBfoyrjMBDAoY_s,1135
|
38
|
-
mxlpy/sbml/_export.py,sha256=4tU3SVxfEvl0E1urZWHyphkiAeH5HeRO1cODvvrczAQ,20342
|
39
|
-
mxlpy/sbml/_import.py,sha256=5odQBdpD93mQJp2bVIabmPo6NK60nxqrdSVB8fEsF_A,22099
|
40
|
-
mxlpy/sbml/_mathml.py,sha256=bNk9RQ_NQFDhY1R354p-gwqqHaIiyAwZ1xLPHHhiguQ,24436
|
41
|
-
mxlpy/sbml/_name_conversion.py,sha256=XK9DEyzhrD0GBBwwjK9RA0yORrDX5c-Uvx0VtKMR5rA,1325
|
42
|
-
mxlpy/sbml/_unit_conversion.py,sha256=dW_I6_Ou09ccwnp6LIdrPriIQnQUK5lJcjzM2Fawm6U,1927
|
43
|
-
mxlpy/surrogates/__init__.py,sha256=cz9qr0ToYSutIK45IvKrMe1mPP7Lj0I_V0HYGixfpZU,916
|
44
|
-
mxlpy/surrogates/_keras.py,sha256=y4nW626Nr4OQrTdZneDf-Ox2sKmqKmGmEbjpuQMEl10,3816
|
45
|
-
mxlpy/surrogates/_poly.py,sha256=qhwiWMQsQGq6qBEzagR-riM7Yp33FilsudMkGZ7mkEU,3598
|
46
|
-
mxlpy/surrogates/_qss.py,sha256=q-CoULIntdXclArm7eHGHlZpgBKQmJrZ0ZaG2Q3B_Pg,712
|
47
|
-
mxlpy/surrogates/_torch.py,sha256=lGKjLgHmUsD0iAbKzQUeKfN8C88ChQPg1pqidiYucWg,6315
|
48
|
-
mxlpy/symbolic/__init__.py,sha256=3hQjCMw8-6iOxeUdfnCg8449fF_BRF2u6lCM1GPpkRY,222
|
49
|
-
mxlpy/symbolic/strikepy.py,sha256=UMx2LMRwCkASKjdCYEvh9tKlW9dk3nDoWM9NNJXWL_8,19960
|
50
|
-
mxlpy/symbolic/symbolic_model.py,sha256=lxkDW7L00Og_8Rwf7j0Gek0nQxRu7kyboioY4ZUqfx0,2435
|
51
|
-
mxlpy-0.19.0.dist-info/METADATA,sha256=YValpHti39pA32FnMfkI0zLgmD7yVG8M_WGWNytSrm8,4307
|
52
|
-
mxlpy-0.19.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
53
|
-
mxlpy-0.19.0.dist-info/licenses/LICENSE,sha256=lHX9Eu70g3Iv1aOxXTWNHa3vq9vaVYSPQx4jOLYmDpw,1096
|
54
|
-
mxlpy-0.19.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|