pyVBRc
pyVBRc is a python package for working with output from the Very Broadband Rheology Calculator. pyVBRc is currently (very) experimental and is likely to change drastically between early versions, but feel free to use it.
Installation
To install the latest release:
pip install pyVBRc
To install the latest development version, see the Contributing Guidelines.
Usage
As of now, the primary uses of the pyVBRc are to:
- load a VBR structure
- interpolate between calculated values in the VBR structure
Loading a VBR structure
The primary gateway into working with VBRc data is the VBRstruct object.
Note that the following examples rely on a tiny VBR output file, VBRc_sample_LUT.mat, included in pyVBRc to allow
simple testing of functionality. For any real application, you should generate your own VBR structure (in MATLAB or Octave).
The most basic usage of the VBRCstruct object is to load a .mat file containing a VBR structure that you have saved:
from pyVBRc.vbrc_structure import VBRCstruct
from pyVBRc.sample_data import get_sample_filename
file = get_sample_filename("VBRc_sample_LUT.mat")
vbr = VBRCstruct(file)
The vbr object will mirror the standard VBR structure (see here)
with the exception that the in and out structures of the matlab VBR structure are replaced with input and output
in the python class.
Once loaded, you can access the data just as in matlab. This .mat file contains a VBR structure that was run with
varying temperature (T_K), melt fraction (phi) and grain size(dg_um) at two frequencies. The following example
plots the temperature dependence of attenuation for the Andrade pseuodo-period scaling at a fixed grain size,
melt fraction and frequency:
import matplotlib.pyplot as plt
T_K = vbr.input.SV.T_K[:, 0, 0]
Qinv = vbr.output.anelastic.andrade_psp.Qinv[:, 0, 0, 0]
plt.semilogy(T_K, Qinv, '.k')
plt.xlabel("T [Kelvin]")
plt.ylabel("Q^{-1}, andrade pseudo-period")
plt.show()
Interpolating
In some situations, it may be useful to interpolate VBRc results at arbitrary points between calculated points. The sample file,"VBRc_sample_LUT.mat" was calculated for a very coarse grid of temperature (T_K), melt fraction (phi) and grain size(dg_um) at two frequencies to serve as a simple look-up table (LUT). You can provide these variable names to the lut_dimensions keyword argument when initializing the VBRCstruct:
from pyVBRc.vbrc_structure import VBRCstruct
from pyVBRc.sample_data import get_sample_filename
file = get_sample_filename("VBRc_sample_LUT.mat")
vbr = VBRCstruct(file, lut_dimensions=["T_K", "phi", "dg_um"])
Now, you can build a grid interpolator for a single method-array and a single frequency index with the interpolator method. This method also accepts the log_vars keyword argument that you can use to specify LUT fields that you want to interpolate in log-space:
import numpy as np
interp = vbr.interpolator(
("anelastic", "andrade_psp", "V"), 0, log_vars=["phi", "dg_um"]
)
# evaluate at one arbitrary point
# (T in K, log(phi), log(dg in micrometer))
target = (1333 + 273.0, np.log10(0.0012), np.log10(1131))
Vs_interp = interp(target)
print(Vs_interp)
Note that the array to interpolate is specified as a tuple of output fieldnames: ("anelastic", "andrade_psp", "V") corresponds to accessing VBR.output.anelastic.andrade_psp.V. To interpolate at more than one point, you can provide an array of points:
import matplotlib.pyplot as plt
# resample at a higher resolution
T = vbr.input.SV.T_K[:, 0, 0]
nT = len(T)
T_targets = np.linspace(T.min(), T.max(), nT * 2)
phival = vbr.input.SV.phi.min()
dgval = vbr.input.SV.dg_um.min()
phi_targets = np.full(T_targets.shape, np.log10(phival))
dg_targets = np.full(T_targets.shape, np.log10(dgval))
targets = np.column_stack((T_targets, phi_targets, dg_targets))
Vs_interp = interp(targets)
# compare to actual Vs along curve
actual_Vs = vbr.output.anelastic.andrade_psp.V[:, 0, 0, 0]
plt.plot(T_targets, Vs_interp, label="interpolated output", marker=".")
plt.plot(T, actual_Vs, ".k", label="actual VBRc output", markersize=12)
plt.legend()
plt.xlabel("T [K]")
plt.ylabel("Vs [m/s]")
plt.show()
which yields
NOTE that the validity of any interpolation will depend on the underlying VBR structure that you have built.
Isotropic Mixtures and Anistropy
The pyVBRc includes some limited functionality for calculating properties of Isotropic mixture as well as
anistropic properties. See the Examples for a description.
Examples
The examples directory contains a number of jupyter notebooks that demonstrate usage.
Getting help
If you find a bug, please open an issue.
If you have questions, feel free to ask in the VBRc slack channel (see here for how to join.)
Getting involved
Interested in extending pyVBRc? check out the Contributing Guidelines.
Metadata
Release files for pyVBRc 0.4.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 | Provenance | Actions |
|---|---|---|---|---|
| pyvbrc-0.4.0.tar.gz | 777.4 kB | With provenance | Details for pyvbrc-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyvbrc-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for pyvbrc-0.4.0-py3-none-any.whl |
Total release size: 1.6 MB
Release files / pyvbrc-0.4.0.tar.gz
| Download URL | pyvbrc-0.4.0.tar.gz |
|---|---|
| Size | 777.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d87fe75e9a257a398833c98eef1c8324a00bae5a776b7d382311288fb295f4b
|
|
BLAKE2b-256 checksum How to use checksums |
de9a6a42111634e6524753dd7377f47ad0b4c7a487d37dbe37d460e35bb53be2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pyvbrc-0.4.0-py3-none-any.whl
| Download URL | pyvbrc-0.4.0-py3-none-any.whl |
|---|---|
| Size | 774.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8dcbe470dde80d1965927a5495c725add5b7db6532806f90065f22c56b9607f5
|
|
BLAKE2b-256 checksum How to use checksums |
32d1b9dd68d10f2a882cd0818177f41920b4555089d23b36bbb140ee3ed5f0d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for pyVBRc 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyvbrc-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.