drux 0.4__tar.gz → 0.6__tar.gz
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.
- {drux-0.4/drux.egg-info → drux-0.6}/PKG-INFO +189 -8
- {drux-0.4 → drux-0.6}/README.md +165 -4
- {drux-0.4 → drux-0.6}/drux/__init__.py +4 -0
- {drux-0.4 → drux-0.6}/drux/base_model.py +12 -3
- drux-0.6/drux/cubic.py +70 -0
- drux-0.6/drux/curve_fit.py +290 -0
- {drux-0.4 → drux-0.6}/drux/first_order.py +4 -4
- {drux-0.4 → drux-0.6}/drux/higuchi.py +5 -5
- {drux-0.4 → drux-0.6}/drux/hopfenberg.py +7 -7
- drux-0.6/drux/korsmeyer_peppas_1.py +74 -0
- drux-0.6/drux/messages.py +79 -0
- drux-0.6/drux/params.py +9 -0
- drux-0.6/drux/quadratic.py +66 -0
- {drux-0.4 → drux-0.6}/drux/weibull.py +5 -5
- {drux-0.4 → drux-0.6}/drux/zero_order.py +4 -4
- {drux-0.4 → drux-0.6/drux.egg-info}/PKG-INFO +189 -8
- {drux-0.4 → drux-0.6}/drux.egg-info/SOURCES.txt +9 -0
- {drux-0.4 → drux-0.6}/drux.egg-info/requires.txt +1 -0
- drux-0.6/pyproject.toml +3 -0
- {drux-0.4 → drux-0.6}/setup.py +11 -17
- drux-0.6/tests/test_cubic.py +149 -0
- drux-0.6/tests/test_curve_fit.py +492 -0
- drux-0.6/tests/test_korsmeyer_peppas_1.py +144 -0
- drux-0.6/tests/test_quadratic.py +145 -0
- drux-0.4/drux/messages.py +0 -46
- drux-0.4/drux/params.py +0 -4
- {drux-0.4 → drux-0.6}/AUTHORS.md +0 -0
- {drux-0.4 → drux-0.6}/LICENSE +0 -0
- {drux-0.4 → drux-0.6}/drux.egg-info/dependency_links.txt +0 -0
- {drux-0.4 → drux-0.6}/drux.egg-info/top_level.txt +0 -0
- {drux-0.4 → drux-0.6}/setup.cfg +0 -0
- {drux-0.4 → drux-0.6}/tests/test_first_order.py +0 -0
- {drux-0.4 → drux-0.6}/tests/test_higuchi.py +0 -0
- {drux-0.4 → drux-0.6}/tests/test_hopfenberg.py +0 -0
- {drux-0.4 → drux-0.6}/tests/test_weibull.py +0 -0
- {drux-0.4 → drux-0.6}/tests/test_zero_order.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: drux
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6
|
|
4
4
|
Summary: Drux: Drug Release Analysis Framework
|
|
5
5
|
Home-page: https://github.com/openscilab/drux
|
|
6
|
-
Download-URL: https://github.com/openscilab/drux/tarball/v0.
|
|
6
|
+
Download-URL: https://github.com/openscilab/drux/tarball/v0.6
|
|
7
7
|
Author: Drux Development Team
|
|
8
8
|
Author-email: drux@openscilab.com
|
|
9
9
|
License: MIT
|
|
@@ -11,7 +11,6 @@ Project-URL: Source, https://github.com/openscilab/drux
|
|
|
11
11
|
Keywords: drug-release drug-delivery mathematical-modeling simulation kinetics
|
|
12
12
|
Classifier: Development Status :: 3 - Alpha
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
14
|
Classifier: Operating System :: OS Independent
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.7
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -21,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
24
24
|
Classifier: Intended Audience :: Developers
|
|
25
25
|
Classifier: Intended Audience :: Education
|
|
26
26
|
Classifier: Intended Audience :: End Users/Desktop
|
|
@@ -37,6 +37,7 @@ License-File: LICENSE
|
|
|
37
37
|
License-File: AUTHORS.md
|
|
38
38
|
Requires-Dist: numpy>=1.21.0
|
|
39
39
|
Requires-Dist: matplotlib>=3.2.2
|
|
40
|
+
Requires-Dist: scipy>=1.7.3
|
|
40
41
|
Dynamic: author
|
|
41
42
|
Dynamic: author-email
|
|
42
43
|
Dynamic: classifier
|
|
@@ -56,7 +57,8 @@ Dynamic: summary
|
|
|
56
57
|
<div align="center">
|
|
57
58
|
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/logo.png" width="350">
|
|
58
59
|
<h1>Drux: Drug Release Analysis Framework</h1>
|
|
59
|
-
|
|
60
|
+
<p><i>Drux is dedicated to the memory of <a href="https://github.com/nazanin-nabi">Nazanin Nabinia</a>, one of its co-creators.</i></p>
|
|
61
|
+
<br/>
|
|
60
62
|
<a href="https://badge.fury.io/py/drux"><img src="https://badge.fury.io/py/drux.svg" alt="PyPI version"></a>
|
|
61
63
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
62
64
|
<a href="https://codecov.io/gh/openscilab/drux"><img src="https://codecov.io/gh/openscilab/drux/branch/dev/graph/badge.svg?token=5O41J3XX2L"></a>
|
|
@@ -118,9 +120,9 @@ Drux is a Python-based framework for simulating drug release profiles using math
|
|
|
118
120
|
|
|
119
121
|
### PyPI
|
|
120
122
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
121
|
-
- Run `pip install drux==0.
|
|
123
|
+
- Run `pip install drux==0.6`
|
|
122
124
|
### Source code
|
|
123
|
-
- Download [Version 0.
|
|
125
|
+
- Download [Version 0.6](https://github.com/openscilab/drux/archive/v0.6.zip) or [Latest Source](https://github.com/openscilab/drux/archive/dev.zip)
|
|
124
126
|
- Run `pip install .`
|
|
125
127
|
|
|
126
128
|
## Supported Models
|
|
@@ -228,6 +230,119 @@ where:
|
|
|
228
230
|
3. Transdermal Patches
|
|
229
231
|
4. Injectable depots
|
|
230
232
|
|
|
233
|
+
### Quadratic
|
|
234
|
+
The Quadratic model is an empirical model that describes drug release with a linear and a second-order term in time. It is useful for release profiles where the release rate changes linearly over time. A positive $k_2$ gives an increasing release rate, and a negative $k_2$ gives a decreasing release rate.
|
|
235
|
+
According to this model, the cumulative amount of drug released at time $t$ is given by:
|
|
236
|
+
|
|
237
|
+
$$
|
|
238
|
+
M_t = M_0 + k_1 t + k_2 t^2
|
|
239
|
+
$$
|
|
240
|
+
|
|
241
|
+
where:
|
|
242
|
+
- $M_t (mg)$ is the cumulative absolute amount of drug released at time $t$
|
|
243
|
+
- $M_0 (mg)$ is the initial amount of drug in the system. $M_0$ defaults to zero in this model.
|
|
244
|
+
- $k_1 (\frac{mg}{s})$ is the linear release coefficient (the release rate at $t = 0$)
|
|
245
|
+
- $k_2 (\frac{mg}{s^2})$ is the quadratic release coefficient
|
|
246
|
+
|
|
247
|
+
#### Applications
|
|
248
|
+
1. Empirical fitting of dissolution data
|
|
249
|
+
2. Comparison of dissolution profiles
|
|
250
|
+
3. Release profiles with an increasing or a decreasing release rate
|
|
251
|
+
|
|
252
|
+
### Cubic
|
|
253
|
+
The Cubic model is an empirical model that describes drug release with a linear, a second-order, and a third-order term in time. Its release rate is a quadratic function of time, so it can describe release profiles with an inflection point, where the release rate changes from increasing to decreasing or vice versa.
|
|
254
|
+
According to this model, the cumulative amount of drug released at time $t$ is given by:
|
|
255
|
+
|
|
256
|
+
$$
|
|
257
|
+
M_t = M_0 + k_1 t + k_2 t^2 + k_3 t^3
|
|
258
|
+
$$
|
|
259
|
+
|
|
260
|
+
where:
|
|
261
|
+
- $M_t (mg)$ is the cumulative absolute amount of drug released at time $t$
|
|
262
|
+
- $M_0 (mg)$ is the initial amount of drug in the system. $M_0$ defaults to zero in this model.
|
|
263
|
+
- $k_1 (\frac{mg}{s})$ is the linear release coefficient (the release rate at $t = 0$)
|
|
264
|
+
- $k_2 (\frac{mg}{s^2})$ is the quadratic release coefficient
|
|
265
|
+
- $k_3 (\frac{mg}{s^3})$ is the cubic release coefficient
|
|
266
|
+
|
|
267
|
+
#### Applications
|
|
268
|
+
1. Empirical fitting of dissolution data
|
|
269
|
+
2. Release from polymeric nanoparticles
|
|
270
|
+
3. Release profiles with an inflection point
|
|
271
|
+
|
|
272
|
+
### Korsmeyer-Peppas-1
|
|
273
|
+
The Korsmeyer-Peppas-1 model describes drug release from a polymeric system with a power law of time. The release exponent $n$ shows the release mechanism. This model also supports an initial amount of drug in the solution, $M_0$, for example from a burst release.
|
|
274
|
+
According to this model, the cumulative amount of drug released at time $t$ is given by:
|
|
275
|
+
|
|
276
|
+
$$
|
|
277
|
+
M_t = M_0 + k t^n
|
|
278
|
+
$$
|
|
279
|
+
|
|
280
|
+
where:
|
|
281
|
+
- $M_t (mg)$ is the cumulative absolute amount of drug released at time $t$
|
|
282
|
+
- $M_0 (mg)$ is the initial amount of drug in the system. $M_0$ defaults to zero in this model, which gives the original Korsmeyer-Peppas model.
|
|
283
|
+
- $k (\frac{mg}{s^n})$ is the release rate constant
|
|
284
|
+
- $n$ is the release exponent
|
|
285
|
+
|
|
286
|
+
For cylindrical tablets, $n \le 0.45$ shows Fickian diffusion, $0.45 < n < 0.89$ shows non-Fickian transport, $n = 0.89$ shows Case II (relaxational) transport, and $n > 0.89$ shows super Case II transport.
|
|
287
|
+
|
|
288
|
+
⚠️ To find the release mechanism, use only the part of the release profile where $\frac{M_t}{M_\infty} < 0.6$.
|
|
289
|
+
|
|
290
|
+
#### Applications
|
|
291
|
+
1. Polymeric matrix tablets
|
|
292
|
+
2. Microcapsules and microspheres
|
|
293
|
+
3. Identification of the drug release mechanism
|
|
294
|
+
|
|
295
|
+
## Curve Fitting
|
|
296
|
+
The models above calculate a release profile from known parameters. The `CurveFit` class does the opposite operation. It calculates the parameters of a model from measured experimental data. `CurveFit` uses the non-linear least squares method. This method decreases the difference between the measured release and the calculated release.
|
|
297
|
+
|
|
298
|
+
`CurveFit` gives the quality of the fit as the coefficient of determination:
|
|
299
|
+
|
|
300
|
+
$$
|
|
301
|
+
R^2 = 1 - \frac{\sum_i \left(M_i - \hat{M}_i\right)^2}{\sum_i \left(M_i - \bar{M}\right)^2}
|
|
302
|
+
$$
|
|
303
|
+
|
|
304
|
+
where:
|
|
305
|
+
- $M_i (mg)$ is the measured drug release at time $t_i$
|
|
306
|
+
- $\hat{M}_i (mg)$ is the drug release that the model calculates at time $t_i$
|
|
307
|
+
- $\bar{M} (mg)$ is the mean value of the measured drug release
|
|
308
|
+
|
|
309
|
+
An $R^2$ value near 1 shows a good fit. A low value shows that the model does not describe the data correctly.
|
|
310
|
+
|
|
311
|
+
You can fit all the models above. This table gives the name and the parameters of each model:
|
|
312
|
+
|
|
313
|
+
| Model Name | Parameters |
|
|
314
|
+
|----------------------| -------------------------- |
|
|
315
|
+
| `zero_order` | `M0`, `k0` |
|
|
316
|
+
| `first_order` | `M0`, `k` |
|
|
317
|
+
| `higuchi` | `D`, `c0`, `cs` |
|
|
318
|
+
| `weibull` | `M`, `a`, `b` |
|
|
319
|
+
| `hopfenberg` | `M`, `k0`, `c0`, `a0`, `n` |
|
|
320
|
+
| `quadratic` | `M0`, `k1`, `k2` |
|
|
321
|
+
| `cubic` | `M0`, `k1`, `k2`, `k3` |
|
|
322
|
+
| `korsmeyer_peppas_1` | `M0`, `k`, `n` |
|
|
323
|
+
|
|
324
|
+
The `fit` method starts from a value of 1 for each unknown parameter, and keeps all the parameters positive. If the result is not good, give your own values in the `initial_guess` and `bounds` arguments. These arguments contain only the unknown parameters. The `get_result` method gives the result of the last fit again.
|
|
325
|
+
|
|
326
|
+
The `fit` method returns a `FitResult` object, where:
|
|
327
|
+
- `model_name` is the name of the fitted model
|
|
328
|
+
- `parameters` is a dictionary of the known and the calculated parameter values
|
|
329
|
+
- `r_squared` is the fit's coefficient of determination
|
|
330
|
+
- `model` is a model object with the calculated parameters. You can simulate and plot this model.
|
|
331
|
+
|
|
332
|
+
### Known Parameters
|
|
333
|
+
If you know the value of a parameter, give it in the `known_parameters` argument. Use the parameter names in the table above. `CurveFit` keeps these values constant and calculates only the other parameters.
|
|
334
|
+
|
|
335
|
+
⚠️ All the parameters of a model cannot always be calculated from a release profile. Some models use a group of parameters only as one product or one ratio. Many different combinations of these parameters give the same value for this group. Thus, the fit has no unique solution, and the calculated values can be different from the true physical values. To prevent this problem, give at least **two** parameters of each group in the `known_parameters` argument. Two of the models have such a group:
|
|
336
|
+
- The Higuchi model uses $D$, $c_0$ and $c_s$ only in the product $D(2c_0 - c_s)c_s$. Give two of these three parameters, for example `known_parameters={"c0": 1, "cs": 0.5}`.
|
|
337
|
+
- The Hopfenberg model uses $k_0$, $c_0$ and $a_0$ only in the ratio $\frac{k_0}{c_0 a_0}$. Give two of these three parameters, and also the geometry factor $n$, for example `known_parameters={"c0": 0.0374, "a0": 3.51, "n": 2}`. Also, $n$ is always assumed to be known because the user should know the shape of the device.
|
|
338
|
+
|
|
339
|
+
### Applications
|
|
340
|
+
1. Analysis of dissolution test data
|
|
341
|
+
2. Estimation of the release rate constants
|
|
342
|
+
3. Selection of the correct model for an experiment
|
|
343
|
+
4. Comparison of different formulations
|
|
344
|
+
5. Quality control of production batches
|
|
345
|
+
|
|
231
346
|
## Usage
|
|
232
347
|
### Zero-Order Model
|
|
233
348
|
```python
|
|
@@ -276,6 +391,51 @@ model.plot(show=True)
|
|
|
276
391
|
```
|
|
277
392
|
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/hopfenberg_plot.png" alt="Hopfenberg Plot">
|
|
278
393
|
|
|
394
|
+
### Quadratic Model
|
|
395
|
+
|
|
396
|
+
```python
|
|
397
|
+
from drux import QuadraticModel
|
|
398
|
+
model = QuadraticModel(k1=0.1, k2=0.00005, M0=0)
|
|
399
|
+
model.simulate(duration=1000, time_step=10)
|
|
400
|
+
model.plot(show=True)
|
|
401
|
+
```
|
|
402
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/quadratic_plot.png" alt="Quadratic Plot">
|
|
403
|
+
|
|
404
|
+
### Cubic Model
|
|
405
|
+
|
|
406
|
+
```python
|
|
407
|
+
from drux import CubicModel
|
|
408
|
+
model = CubicModel(k1=0.1, k2=0.00005, k3=0.00000005, M0=0)
|
|
409
|
+
model.simulate(duration=1000, time_step=10)
|
|
410
|
+
model.plot(show=True)
|
|
411
|
+
```
|
|
412
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/cubic_plot.png" alt="Cubic Plot">
|
|
413
|
+
|
|
414
|
+
### Korsmeyer-Peppas-1 Model
|
|
415
|
+
|
|
416
|
+
```python
|
|
417
|
+
from drux import KorsmeyerPeppas1Model
|
|
418
|
+
model = KorsmeyerPeppas1Model(k=0.1, n=0.6, M0=0)
|
|
419
|
+
model.simulate(duration=1000, time_step=10)
|
|
420
|
+
model.plot(show=True)
|
|
421
|
+
```
|
|
422
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/korsmeyer_peppas_1_plot.png" alt="Korsmeyer-Peppas-1 Plot">
|
|
423
|
+
|
|
424
|
+
### Curve Fitting
|
|
425
|
+
|
|
426
|
+
```python
|
|
427
|
+
from drux import CurveFit
|
|
428
|
+
time = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
|
|
429
|
+
release_profile = [0, 0.35, 0.48, 0.57, 0.63, 0.69, 0.73, 0.77, 0.80, 0.83, 0.85]
|
|
430
|
+
fitter = CurveFit(model_name="weibull", time=time, release_profile=release_profile)
|
|
431
|
+
result = fitter.fit()
|
|
432
|
+
print(result.parameters)
|
|
433
|
+
print(result.r_squared)
|
|
434
|
+
result.model.simulate(duration=100, time_step=1)
|
|
435
|
+
result.model.plot(show=True)
|
|
436
|
+
```
|
|
437
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/curve_fit_plot.png" alt="Curve Fit Plot">
|
|
438
|
+
|
|
279
439
|
|
|
280
440
|
## Issues & bug reports
|
|
281
441
|
|
|
@@ -295,11 +455,13 @@ You can also join our discord server
|
|
|
295
455
|
<blockquote>2- D. R. Paul, "Elaborations on the Higuchi model for drug delivery," <i>International Journal of Pharmaceutics</i>, vol. 418, no. 1, pp. 13–17, 2011.</blockquote>
|
|
296
456
|
<blockquote>3- R. T. Medarametla, K. V. Gopaiah, J. N. Suresh Kumar, G. Anand Babu, M. Shaggir, G. Raghavendra, D. Naveen Reddy, and B. Venkamma, "Drug Release Kinetics and Mathematical Models," <i>International Journal of Science and Research Methodology</i>, vol. 27, no. 9, pp. 12–19, Sep. 2024.</blockquote>
|
|
297
457
|
<blockquote>4- R. Vaju and K. V. Murthy, "Development and validation of new discriminative dissolution method for carvedilol tablets," <i>Indian Journal of Pharmaceutical Sciences</i>, vol. 73, no. 5, pp. 527–536, Sep. 2011.</blockquote>
|
|
298
|
-
<blockquote>5- S. Dash, "Kinetic modeling on drug release from controlled drug delivery systems," <i>Acta Poloniae Pharmaceutica</i>, 2010.</blockquote>
|
|
458
|
+
<blockquote>5- S. Dash, P. N. Murthy, L. Nath, and P. Chowdhury, "Kinetic modeling on drug release from controlled drug delivery systems," <i>Acta Poloniae Pharmaceutica</i>, vol. 67, no. 3, pp. 217–223, 2010.</blockquote>
|
|
299
459
|
<blockquote>6- K. H. Ramteke, P. A. Dighe, A. R. Kharat, S. V. Patil, <i>Mathematical models of drug dissolution: A review</i>, <i>Sch. Acad. J. Pharm.</i>, vol. 3, no. 5, pp. 388-396, 2014.</blockquote>
|
|
300
460
|
<blockquote>7- C. Corsaro, G. Neri, A. M. Mezzasalma, and E. Fazio, "Weibull modeling of controlled drug release from Ag-PMA nanosystems," <i>Polymers</i>, vol. 13, no. 17, p. 2897, 2021.</blockquote>
|
|
301
461
|
<blockquote>8- H. B. Hopfenberg, "Controlled release from erodible slabs, cylinders, and spheres," in <i>Controlled Release Polymeric Formulations</i>, ACS Symposium Series, vol. 33, pp. 26–32, 1976.</blockquote>
|
|
302
462
|
<blockquote>9- H. V. Chavda, M. S. Patel, and C. N. Patel, "Preparation and in vitro evaluation of guar gum based triple-layer matrix tablet of diclofenac sodium," <i>Research in Pharmaceutical Sciences</i>, vol. 7, no. 1, pp. 57–64, Jan. 2012.</blockquote>
|
|
463
|
+
<blockquote>10- Y. Zhang, M. Huo, J. Zhou, A. Zou, W. Li, C. Yao, and S. Xie, "DDSolver: An add-in program for modeling and comparison of drug dissolution profiles," <i>The AAPS Journal</i>, vol. 12, no. 3, pp. 263–271, 2010.</blockquote>
|
|
464
|
+
<blockquote>11- N. S. Heredia, K. Vizuete, M. Flores-Calero, K. Pazmiño V., F. Pilaquinga, B. Kumar, and A. Debut, "Comparative statistical analysis of the release kinetics models for nanoprecipitated drug delivery systems based on poly(lactic-co-glycolic acid)," <i>PLoS ONE</i>, vol. 17, no. 3, Art. no. e0264825, 2022.</blockquote>
|
|
303
465
|
|
|
304
466
|
|
|
305
467
|
## Show your support
|
|
@@ -319,6 +481,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
319
481
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
320
482
|
|
|
321
483
|
## [Unreleased]
|
|
484
|
+
## [0.6] - 2026-11-16
|
|
485
|
+
### Added
|
|
486
|
+
- Quadratic model
|
|
487
|
+
- Cubic model
|
|
488
|
+
- Korsmeyer-Peppas-1 model
|
|
489
|
+
### Changed
|
|
490
|
+
- `Python 3.15` added to `test.yml`
|
|
491
|
+
- Build system modified
|
|
492
|
+
## [0.5] - 2026-10-14
|
|
493
|
+
### Added
|
|
494
|
+
- `CurveFit` class
|
|
495
|
+
- `CurveFit` class documentation
|
|
496
|
+
- `FitResult` class
|
|
497
|
+
### Changed
|
|
498
|
+
- `_model_function` method refactored
|
|
499
|
+
- `_model_function` method renamed to `model_function`
|
|
500
|
+
- Dependencies structure modified
|
|
322
501
|
## [0.4] - 2026-05-18
|
|
323
502
|
### Added
|
|
324
503
|
- Hopfenberg model
|
|
@@ -345,7 +524,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
345
524
|
- Higuchi model
|
|
346
525
|
|
|
347
526
|
|
|
348
|
-
[Unreleased]: https://github.com/openscilab/drux/compare/v0.
|
|
527
|
+
[Unreleased]: https://github.com/openscilab/drux/compare/v0.6...dev
|
|
528
|
+
[0.6]: https://github.com/openscilab/drux/compare/v0.5...v0.6
|
|
529
|
+
[0.5]: https://github.com/openscilab/drux/compare/v0.4...v0.5
|
|
349
530
|
[0.4]: https://github.com/openscilab/drux/compare/v0.3...v0.4
|
|
350
531
|
[0.3]: https://github.com/openscilab/drux/compare/v0.2...v0.3
|
|
351
532
|
[0.2]: https://github.com/openscilab/drux/compare/v0.1...v0.2
|
{drux-0.4 → drux-0.6}/README.md
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/logo.png" width="350">
|
|
3
3
|
<h1>Drux: Drug Release Analysis Framework</h1>
|
|
4
|
-
|
|
4
|
+
<p><i>Drux is dedicated to the memory of <a href="https://github.com/nazanin-nabi">Nazanin Nabinia</a>, one of its co-creators.</i></p>
|
|
5
|
+
<br/>
|
|
5
6
|
<a href="https://badge.fury.io/py/drux"><img src="https://badge.fury.io/py/drux.svg" alt="PyPI version"></a>
|
|
6
7
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
7
8
|
<a href="https://codecov.io/gh/openscilab/drux"><img src="https://codecov.io/gh/openscilab/drux/branch/dev/graph/badge.svg?token=5O41J3XX2L"></a>
|
|
@@ -63,9 +64,9 @@ Drux is a Python-based framework for simulating drug release profiles using math
|
|
|
63
64
|
|
|
64
65
|
### PyPI
|
|
65
66
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
66
|
-
- Run `pip install drux==0.
|
|
67
|
+
- Run `pip install drux==0.6`
|
|
67
68
|
### Source code
|
|
68
|
-
- Download [Version 0.
|
|
69
|
+
- Download [Version 0.6](https://github.com/openscilab/drux/archive/v0.6.zip) or [Latest Source](https://github.com/openscilab/drux/archive/dev.zip)
|
|
69
70
|
- Run `pip install .`
|
|
70
71
|
|
|
71
72
|
## Supported Models
|
|
@@ -173,6 +174,119 @@ where:
|
|
|
173
174
|
3. Transdermal Patches
|
|
174
175
|
4. Injectable depots
|
|
175
176
|
|
|
177
|
+
### Quadratic
|
|
178
|
+
The Quadratic model is an empirical model that describes drug release with a linear and a second-order term in time. It is useful for release profiles where the release rate changes linearly over time. A positive $k_2$ gives an increasing release rate, and a negative $k_2$ gives a decreasing release rate.
|
|
179
|
+
According to this model, the cumulative amount of drug released at time $t$ is given by:
|
|
180
|
+
|
|
181
|
+
$$
|
|
182
|
+
M_t = M_0 + k_1 t + k_2 t^2
|
|
183
|
+
$$
|
|
184
|
+
|
|
185
|
+
where:
|
|
186
|
+
- $M_t (mg)$ is the cumulative absolute amount of drug released at time $t$
|
|
187
|
+
- $M_0 (mg)$ is the initial amount of drug in the system. $M_0$ defaults to zero in this model.
|
|
188
|
+
- $k_1 (\frac{mg}{s})$ is the linear release coefficient (the release rate at $t = 0$)
|
|
189
|
+
- $k_2 (\frac{mg}{s^2})$ is the quadratic release coefficient
|
|
190
|
+
|
|
191
|
+
#### Applications
|
|
192
|
+
1. Empirical fitting of dissolution data
|
|
193
|
+
2. Comparison of dissolution profiles
|
|
194
|
+
3. Release profiles with an increasing or a decreasing release rate
|
|
195
|
+
|
|
196
|
+
### Cubic
|
|
197
|
+
The Cubic model is an empirical model that describes drug release with a linear, a second-order, and a third-order term in time. Its release rate is a quadratic function of time, so it can describe release profiles with an inflection point, where the release rate changes from increasing to decreasing or vice versa.
|
|
198
|
+
According to this model, the cumulative amount of drug released at time $t$ is given by:
|
|
199
|
+
|
|
200
|
+
$$
|
|
201
|
+
M_t = M_0 + k_1 t + k_2 t^2 + k_3 t^3
|
|
202
|
+
$$
|
|
203
|
+
|
|
204
|
+
where:
|
|
205
|
+
- $M_t (mg)$ is the cumulative absolute amount of drug released at time $t$
|
|
206
|
+
- $M_0 (mg)$ is the initial amount of drug in the system. $M_0$ defaults to zero in this model.
|
|
207
|
+
- $k_1 (\frac{mg}{s})$ is the linear release coefficient (the release rate at $t = 0$)
|
|
208
|
+
- $k_2 (\frac{mg}{s^2})$ is the quadratic release coefficient
|
|
209
|
+
- $k_3 (\frac{mg}{s^3})$ is the cubic release coefficient
|
|
210
|
+
|
|
211
|
+
#### Applications
|
|
212
|
+
1. Empirical fitting of dissolution data
|
|
213
|
+
2. Release from polymeric nanoparticles
|
|
214
|
+
3. Release profiles with an inflection point
|
|
215
|
+
|
|
216
|
+
### Korsmeyer-Peppas-1
|
|
217
|
+
The Korsmeyer-Peppas-1 model describes drug release from a polymeric system with a power law of time. The release exponent $n$ shows the release mechanism. This model also supports an initial amount of drug in the solution, $M_0$, for example from a burst release.
|
|
218
|
+
According to this model, the cumulative amount of drug released at time $t$ is given by:
|
|
219
|
+
|
|
220
|
+
$$
|
|
221
|
+
M_t = M_0 + k t^n
|
|
222
|
+
$$
|
|
223
|
+
|
|
224
|
+
where:
|
|
225
|
+
- $M_t (mg)$ is the cumulative absolute amount of drug released at time $t$
|
|
226
|
+
- $M_0 (mg)$ is the initial amount of drug in the system. $M_0$ defaults to zero in this model, which gives the original Korsmeyer-Peppas model.
|
|
227
|
+
- $k (\frac{mg}{s^n})$ is the release rate constant
|
|
228
|
+
- $n$ is the release exponent
|
|
229
|
+
|
|
230
|
+
For cylindrical tablets, $n \le 0.45$ shows Fickian diffusion, $0.45 < n < 0.89$ shows non-Fickian transport, $n = 0.89$ shows Case II (relaxational) transport, and $n > 0.89$ shows super Case II transport.
|
|
231
|
+
|
|
232
|
+
⚠️ To find the release mechanism, use only the part of the release profile where $\frac{M_t}{M_\infty} < 0.6$.
|
|
233
|
+
|
|
234
|
+
#### Applications
|
|
235
|
+
1. Polymeric matrix tablets
|
|
236
|
+
2. Microcapsules and microspheres
|
|
237
|
+
3. Identification of the drug release mechanism
|
|
238
|
+
|
|
239
|
+
## Curve Fitting
|
|
240
|
+
The models above calculate a release profile from known parameters. The `CurveFit` class does the opposite operation. It calculates the parameters of a model from measured experimental data. `CurveFit` uses the non-linear least squares method. This method decreases the difference between the measured release and the calculated release.
|
|
241
|
+
|
|
242
|
+
`CurveFit` gives the quality of the fit as the coefficient of determination:
|
|
243
|
+
|
|
244
|
+
$$
|
|
245
|
+
R^2 = 1 - \frac{\sum_i \left(M_i - \hat{M}_i\right)^2}{\sum_i \left(M_i - \bar{M}\right)^2}
|
|
246
|
+
$$
|
|
247
|
+
|
|
248
|
+
where:
|
|
249
|
+
- $M_i (mg)$ is the measured drug release at time $t_i$
|
|
250
|
+
- $\hat{M}_i (mg)$ is the drug release that the model calculates at time $t_i$
|
|
251
|
+
- $\bar{M} (mg)$ is the mean value of the measured drug release
|
|
252
|
+
|
|
253
|
+
An $R^2$ value near 1 shows a good fit. A low value shows that the model does not describe the data correctly.
|
|
254
|
+
|
|
255
|
+
You can fit all the models above. This table gives the name and the parameters of each model:
|
|
256
|
+
|
|
257
|
+
| Model Name | Parameters |
|
|
258
|
+
|----------------------| -------------------------- |
|
|
259
|
+
| `zero_order` | `M0`, `k0` |
|
|
260
|
+
| `first_order` | `M0`, `k` |
|
|
261
|
+
| `higuchi` | `D`, `c0`, `cs` |
|
|
262
|
+
| `weibull` | `M`, `a`, `b` |
|
|
263
|
+
| `hopfenberg` | `M`, `k0`, `c0`, `a0`, `n` |
|
|
264
|
+
| `quadratic` | `M0`, `k1`, `k2` |
|
|
265
|
+
| `cubic` | `M0`, `k1`, `k2`, `k3` |
|
|
266
|
+
| `korsmeyer_peppas_1` | `M0`, `k`, `n` |
|
|
267
|
+
|
|
268
|
+
The `fit` method starts from a value of 1 for each unknown parameter, and keeps all the parameters positive. If the result is not good, give your own values in the `initial_guess` and `bounds` arguments. These arguments contain only the unknown parameters. The `get_result` method gives the result of the last fit again.
|
|
269
|
+
|
|
270
|
+
The `fit` method returns a `FitResult` object, where:
|
|
271
|
+
- `model_name` is the name of the fitted model
|
|
272
|
+
- `parameters` is a dictionary of the known and the calculated parameter values
|
|
273
|
+
- `r_squared` is the fit's coefficient of determination
|
|
274
|
+
- `model` is a model object with the calculated parameters. You can simulate and plot this model.
|
|
275
|
+
|
|
276
|
+
### Known Parameters
|
|
277
|
+
If you know the value of a parameter, give it in the `known_parameters` argument. Use the parameter names in the table above. `CurveFit` keeps these values constant and calculates only the other parameters.
|
|
278
|
+
|
|
279
|
+
⚠️ All the parameters of a model cannot always be calculated from a release profile. Some models use a group of parameters only as one product or one ratio. Many different combinations of these parameters give the same value for this group. Thus, the fit has no unique solution, and the calculated values can be different from the true physical values. To prevent this problem, give at least **two** parameters of each group in the `known_parameters` argument. Two of the models have such a group:
|
|
280
|
+
- The Higuchi model uses $D$, $c_0$ and $c_s$ only in the product $D(2c_0 - c_s)c_s$. Give two of these three parameters, for example `known_parameters={"c0": 1, "cs": 0.5}`.
|
|
281
|
+
- The Hopfenberg model uses $k_0$, $c_0$ and $a_0$ only in the ratio $\frac{k_0}{c_0 a_0}$. Give two of these three parameters, and also the geometry factor $n$, for example `known_parameters={"c0": 0.0374, "a0": 3.51, "n": 2}`. Also, $n$ is always assumed to be known because the user should know the shape of the device.
|
|
282
|
+
|
|
283
|
+
### Applications
|
|
284
|
+
1. Analysis of dissolution test data
|
|
285
|
+
2. Estimation of the release rate constants
|
|
286
|
+
3. Selection of the correct model for an experiment
|
|
287
|
+
4. Comparison of different formulations
|
|
288
|
+
5. Quality control of production batches
|
|
289
|
+
|
|
176
290
|
## Usage
|
|
177
291
|
### Zero-Order Model
|
|
178
292
|
```python
|
|
@@ -221,6 +335,51 @@ model.plot(show=True)
|
|
|
221
335
|
```
|
|
222
336
|
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/hopfenberg_plot.png" alt="Hopfenberg Plot">
|
|
223
337
|
|
|
338
|
+
### Quadratic Model
|
|
339
|
+
|
|
340
|
+
```python
|
|
341
|
+
from drux import QuadraticModel
|
|
342
|
+
model = QuadraticModel(k1=0.1, k2=0.00005, M0=0)
|
|
343
|
+
model.simulate(duration=1000, time_step=10)
|
|
344
|
+
model.plot(show=True)
|
|
345
|
+
```
|
|
346
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/quadratic_plot.png" alt="Quadratic Plot">
|
|
347
|
+
|
|
348
|
+
### Cubic Model
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
from drux import CubicModel
|
|
352
|
+
model = CubicModel(k1=0.1, k2=0.00005, k3=0.00000005, M0=0)
|
|
353
|
+
model.simulate(duration=1000, time_step=10)
|
|
354
|
+
model.plot(show=True)
|
|
355
|
+
```
|
|
356
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/cubic_plot.png" alt="Cubic Plot">
|
|
357
|
+
|
|
358
|
+
### Korsmeyer-Peppas-1 Model
|
|
359
|
+
|
|
360
|
+
```python
|
|
361
|
+
from drux import KorsmeyerPeppas1Model
|
|
362
|
+
model = KorsmeyerPeppas1Model(k=0.1, n=0.6, M0=0)
|
|
363
|
+
model.simulate(duration=1000, time_step=10)
|
|
364
|
+
model.plot(show=True)
|
|
365
|
+
```
|
|
366
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/korsmeyer_peppas_1_plot.png" alt="Korsmeyer-Peppas-1 Plot">
|
|
367
|
+
|
|
368
|
+
### Curve Fitting
|
|
369
|
+
|
|
370
|
+
```python
|
|
371
|
+
from drux import CurveFit
|
|
372
|
+
time = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
|
|
373
|
+
release_profile = [0, 0.35, 0.48, 0.57, 0.63, 0.69, 0.73, 0.77, 0.80, 0.83, 0.85]
|
|
374
|
+
fitter = CurveFit(model_name="weibull", time=time, release_profile=release_profile)
|
|
375
|
+
result = fitter.fit()
|
|
376
|
+
print(result.parameters)
|
|
377
|
+
print(result.r_squared)
|
|
378
|
+
result.model.simulate(duration=100, time_step=1)
|
|
379
|
+
result.model.plot(show=True)
|
|
380
|
+
```
|
|
381
|
+
<img src="https://github.com/openscilab/drux/raw/main/otherfiles/curve_fit_plot.png" alt="Curve Fit Plot">
|
|
382
|
+
|
|
224
383
|
|
|
225
384
|
## Issues & bug reports
|
|
226
385
|
|
|
@@ -240,11 +399,13 @@ You can also join our discord server
|
|
|
240
399
|
<blockquote>2- D. R. Paul, "Elaborations on the Higuchi model for drug delivery," <i>International Journal of Pharmaceutics</i>, vol. 418, no. 1, pp. 13–17, 2011.</blockquote>
|
|
241
400
|
<blockquote>3- R. T. Medarametla, K. V. Gopaiah, J. N. Suresh Kumar, G. Anand Babu, M. Shaggir, G. Raghavendra, D. Naveen Reddy, and B. Venkamma, "Drug Release Kinetics and Mathematical Models," <i>International Journal of Science and Research Methodology</i>, vol. 27, no. 9, pp. 12–19, Sep. 2024.</blockquote>
|
|
242
401
|
<blockquote>4- R. Vaju and K. V. Murthy, "Development and validation of new discriminative dissolution method for carvedilol tablets," <i>Indian Journal of Pharmaceutical Sciences</i>, vol. 73, no. 5, pp. 527–536, Sep. 2011.</blockquote>
|
|
243
|
-
<blockquote>5- S. Dash, "Kinetic modeling on drug release from controlled drug delivery systems," <i>Acta Poloniae Pharmaceutica</i>, 2010.</blockquote>
|
|
402
|
+
<blockquote>5- S. Dash, P. N. Murthy, L. Nath, and P. Chowdhury, "Kinetic modeling on drug release from controlled drug delivery systems," <i>Acta Poloniae Pharmaceutica</i>, vol. 67, no. 3, pp. 217–223, 2010.</blockquote>
|
|
244
403
|
<blockquote>6- K. H. Ramteke, P. A. Dighe, A. R. Kharat, S. V. Patil, <i>Mathematical models of drug dissolution: A review</i>, <i>Sch. Acad. J. Pharm.</i>, vol. 3, no. 5, pp. 388-396, 2014.</blockquote>
|
|
245
404
|
<blockquote>7- C. Corsaro, G. Neri, A. M. Mezzasalma, and E. Fazio, "Weibull modeling of controlled drug release from Ag-PMA nanosystems," <i>Polymers</i>, vol. 13, no. 17, p. 2897, 2021.</blockquote>
|
|
246
405
|
<blockquote>8- H. B. Hopfenberg, "Controlled release from erodible slabs, cylinders, and spheres," in <i>Controlled Release Polymeric Formulations</i>, ACS Symposium Series, vol. 33, pp. 26–32, 1976.</blockquote>
|
|
247
406
|
<blockquote>9- H. V. Chavda, M. S. Patel, and C. N. Patel, "Preparation and in vitro evaluation of guar gum based triple-layer matrix tablet of diclofenac sodium," <i>Research in Pharmaceutical Sciences</i>, vol. 7, no. 1, pp. 57–64, Jan. 2012.</blockquote>
|
|
407
|
+
<blockquote>10- Y. Zhang, M. Huo, J. Zhou, A. Zou, W. Li, C. Yao, and S. Xie, "DDSolver: An add-in program for modeling and comparison of drug dissolution profiles," <i>The AAPS Journal</i>, vol. 12, no. 3, pp. 263–271, 2010.</blockquote>
|
|
408
|
+
<blockquote>11- N. S. Heredia, K. Vizuete, M. Flores-Calero, K. Pazmiño V., F. Pilaquinga, B. Kumar, and A. Debut, "Comparative statistical analysis of the release kinetics models for nanoprecipitated drug delivery systems based on poly(lactic-co-glycolic acid)," <i>PLoS ONE</i>, vol. 17, no. 3, Art. no. e0264825, 2022.</blockquote>
|
|
248
409
|
|
|
249
410
|
|
|
250
411
|
## Show your support
|
|
@@ -7,5 +7,9 @@ from .zero_order import ZeroOrderModel, ZeroOrderParameters
|
|
|
7
7
|
from .first_order import FirstOrderModel, FirstOrderParameters
|
|
8
8
|
from .weibull import WeibullModel, WeibullParameters
|
|
9
9
|
from .hopfenberg import HopfenbergModel, HopfenbergParameters
|
|
10
|
+
from .quadratic import QuadraticModel, QuadraticParameters
|
|
11
|
+
from .cubic import CubicModel, CubicParameters
|
|
12
|
+
from .korsmeyer_peppas_1 import KorsmeyerPeppas1Model, KorsmeyerPeppas1Parameters
|
|
13
|
+
from .curve_fit import CurveFit, FitResult
|
|
10
14
|
|
|
11
15
|
__version__ = DRUX_VERSION
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import matplotlib.pyplot as plt
|
|
5
5
|
from abc import ABC, abstractmethod
|
|
6
|
+
from dataclasses import asdict
|
|
6
7
|
from typing import Any, Optional
|
|
7
8
|
|
|
8
9
|
from .messages import (
|
|
@@ -23,12 +24,13 @@ class DrugReleaseModel(ABC):
|
|
|
23
24
|
mathematical models of drug release from delivery systems.
|
|
24
25
|
|
|
25
26
|
Subclasses should implement:
|
|
26
|
-
-
|
|
27
|
+
- model_function(): Core model equation, as a static method
|
|
27
28
|
- _validate_parameters(): Parameter validation
|
|
28
29
|
"""
|
|
29
30
|
|
|
30
31
|
def __init__(self):
|
|
31
32
|
"""Initialize the drug release model."""
|
|
33
|
+
self._parameters = None
|
|
32
34
|
self._time_points = None
|
|
33
35
|
self._release_profile = None
|
|
34
36
|
self._plot_parameters = {
|
|
@@ -46,18 +48,25 @@ class DrugReleaseModel(ABC):
|
|
|
46
48
|
"""
|
|
47
49
|
pass
|
|
48
50
|
|
|
51
|
+
@staticmethod
|
|
49
52
|
@abstractmethod
|
|
50
|
-
def
|
|
53
|
+
def model_function(t: float, **parameters: Any) -> float:
|
|
51
54
|
"""
|
|
52
55
|
Model function that calculates drug release profile over time.
|
|
53
56
|
|
|
57
|
+
Subclasses must implement this as a @staticmethod, computing the release
|
|
58
|
+
purely from time and explicit model parameters (no instance state), so the
|
|
59
|
+
formula is defined once and can be evaluated independently of a model instance.
|
|
60
|
+
|
|
54
61
|
:param t: time point at which to calculate drug release
|
|
62
|
+
:param parameters: model parameters, matching the model's parameter dataclass fields
|
|
55
63
|
"""
|
|
56
64
|
pass
|
|
57
65
|
|
|
58
66
|
def _get_release_profile(self) -> np.ndarray:
|
|
59
67
|
"""Calculate the drug release profile over the specified time points."""
|
|
60
|
-
|
|
68
|
+
parameters = asdict(self._parameters)
|
|
69
|
+
return np.vectorize(lambda t: self.model_function(t, **parameters))(self._time_points)
|
|
61
70
|
|
|
62
71
|
def _validate_plot(self) -> tuple:
|
|
63
72
|
"""
|
drux-0.6/drux/cubic.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Drux cubic model implementation."""
|
|
3
|
+
|
|
4
|
+
from .base_model import DrugReleaseModel
|
|
5
|
+
from .messages import ERROR_CUBIC_INITIAL_AMOUNT
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class CubicParameters:
|
|
11
|
+
"""
|
|
12
|
+
Parameters for the cubic model.
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
M0 (float): initial amount of drug in the solution (most times, M0 = 0) (mg)
|
|
16
|
+
k1 (float): linear release coefficient (mg/s)
|
|
17
|
+
k2 (float): quadratic release coefficient (mg/s^2)
|
|
18
|
+
k3 (float): cubic release coefficient (mg/s^3)
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
M0: float
|
|
22
|
+
k1: float
|
|
23
|
+
k2: float
|
|
24
|
+
k3: float
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CubicModel(DrugReleaseModel):
|
|
28
|
+
"""Simulator for the cubic drug release model."""
|
|
29
|
+
|
|
30
|
+
def __init__(self, k1: float, k2: float, k3: float, M0: float = 0) -> None:
|
|
31
|
+
"""
|
|
32
|
+
Initialize the cubic model with the given parameters.
|
|
33
|
+
|
|
34
|
+
:param k1: linear release coefficient (mg/s)
|
|
35
|
+
:param k2: quadratic release coefficient (mg/s^2)
|
|
36
|
+
:param k3: cubic release coefficient (mg/s^3)
|
|
37
|
+
:param M0: initial amount of drug in the solution (mg), default is 0
|
|
38
|
+
"""
|
|
39
|
+
super().__init__()
|
|
40
|
+
self._parameters = CubicParameters(M0=M0, k1=k1, k2=k2, k3=k3)
|
|
41
|
+
self._plot_parameters["label"] = "Cubic Model"
|
|
42
|
+
|
|
43
|
+
def __repr__(self):
|
|
44
|
+
"""Return a string representation of the cubic model."""
|
|
45
|
+
return (
|
|
46
|
+
f"drux.CubicModel(k1={self._parameters.k1}, k2={self._parameters.k2}, "
|
|
47
|
+
f"k3={self._parameters.k3}, M0={self._parameters.M0})"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def model_function(t: float, M0: float, k1: float, k2: float, k3: float) -> float:
|
|
52
|
+
"""
|
|
53
|
+
Calculate the drug release at time t using the cubic model.
|
|
54
|
+
|
|
55
|
+
Formula:
|
|
56
|
+
- M(t) = M0 + k1 * t + k2 * t^2 + k3 * t^3
|
|
57
|
+
:param t: time (s)
|
|
58
|
+
:param M0: initial amount of drug in the solution (mg)
|
|
59
|
+
:param k1: linear release coefficient (mg/s)
|
|
60
|
+
:param k2: quadratic release coefficient (mg/s^2)
|
|
61
|
+
:param k3: cubic release coefficient (mg/s^3)
|
|
62
|
+
"""
|
|
63
|
+
Mt = M0 + k1 * t + k2 * t**2 + k3 * t**3
|
|
64
|
+
|
|
65
|
+
return Mt
|
|
66
|
+
|
|
67
|
+
def _validate_parameters(self) -> None:
|
|
68
|
+
"""Validate the parameters of the cubic model."""
|
|
69
|
+
if self._parameters.M0 < 0:
|
|
70
|
+
raise ValueError(ERROR_CUBIC_INITIAL_AMOUNT)
|