Pyvivc
Version 2.0
Stephen Checkley, October 2021.
Description
A Python 3 port of the Rivivc R package for IVIVC linear level A by Aleksander Mendyk and Sebastian Polak. The package contains a numerical deconvolution method working for inequal and incompatible timepoints between impulse and response curves. A numerical convolution method is also included.
This version faithfully reproduces the algorithm of Rivivc 0.9 and has no pandas dependency — curves are passed as plain numpy arrays with two columns: column 0 = time, column 1 = concentration.
Installation
Clone the repository and install with pip:
pip install .
or install with pip from the PyPi repository:
pip install pyvivc
Pyvivc example
from pyvivc import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
def load_curve(path):
# skip the "time,C" header; return an (n, 2) float array
return np.genfromtxt(path, delimiter=',', skip_header=1)
impulse = load_curve('data/impulse.csv')
response = load_curve('data/resp.csv')
inp = load_curve('data/input.csv')
out = pyivivc(inp, impulse, response,
explicit_interpolation=10, implicit_interpolation=5)
regression = out[0] # scipy linregress result
numeric = out[1] # numpy array: col 0 = time, col 1 = par
x = inp[:, 1] # input dissolution (fraction)
y = numeric[:, 1] # deconvolved input
rsquare_text = 'R squared = ' + str(round(regression.rvalue, 2))
plt.subplot(1, 2, 1)
plt.plot(x, y, 'o', label='data')
plt.plot(y, regression.intercept + regression.slope * y, 'r')
plt.annotate(rsquare_text, (0, 0.8), horizontalalignment='left',
verticalalignment='top', fontsize=8)
plt.xlabel('input data (#)')
plt.ylabel('deconvolved input (#)')
plt.legend()
plt.subplot(1, 2, 2)
plt.plot(numeric[:, 0], y, 'r', label='deconvolution')
plt.plot(inp[:, 0], inp[:, 1], 'o', label='data')
plt.xlabel('Time')
plt.ylabel('discovered input (%)')
plt.legend()
plt.show()
API
All curves are numpy arrays of shape (n, 2): column 0 = time, column 1 = concentration.
NumConv(impulse, input, conv_timescale=None, explicit_interpolation=1000)returns a dict with keysparandpar_explicit(each an(n, 2)numpy array).NumDeconv(impulse, response, dose_iv=None, dose_po=None, deconv_timescale=None, explicit_interpolation=20, implicit_interpolation=10, maxit_optim=200)returns a dict with keyspar,par_explicit, andpar_implicit.pyivivc(known_dat, impulse, second_profile, ...)returns[scipy_linregress_result, numeric_array].
Release files for pyvivc 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyvivc-2.0.tar.gz | 19.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyvivc-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.0 kB
Release files / pyvivc-2.0.tar.gz
| Download URL | pyvivc-2.0.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cbe6fa8e63d5cb3ff2e580b14ad41977ced7e93e0da3eb2069040a376b56eb7
|
|
BLAKE2b-256 checksum How to use checksums |
07c0e74adfe03451c0005160dda5259a811fa321dd1725e9623638dbeb090317
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / pyvivc-2.0-py3-none-any.whl
| Download URL | pyvivc-2.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
381bdea7f51bfe87f8766b4e5255689deed3f2d2c9de55f518a62d7954efb602
|
|
BLAKE2b-256 checksum How to use checksums |
6ad80e3dd8ccb8010a6fccdf3b1827d740715b6cc9c8189be1d772828c80e6a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|