RUSpectroscopy_tools
-
A tool to solve the inverse problem in RUS (Resonant Ultrasound Spectroscopy) of cubic materials using Machine Learning.
-
Model used for the tool available at HuggingFace.
-
Solves forward problem also using all your CPU cores (written in C). Working on support for GPU
Forward
A C extension module for getting the resonance frequencies given the estic constants, the dimension and the shpe of the sample.
Inverse
Uses a neural network model to get the constants of a cubic (more complex crystal structures coming soon) solid (parallelepiped shape, other shapes comming soon) given the dimensions and 20 resonence frequencies. No rotations supported yet.
Authors
If the tool or any of the code is useful to you please cite:
Cubillos Muñoz, J. (2025). A machine learning approach to the inverse problem in resonant ultrasound spectroscopy of cubic and isotropic solids. Universidad de los Andes. Available at: Repositorio Seneca Uniandes
Installation
pip3 install ruspectroscopy-tools
Import
from rusmodules import rus
Forward Problem Usage
Getting the resonance frequencies from the elastic constants
from rusmodules import eigenvals
frequencies = eigenvals.forward_problem(m, C, dimensions, N, shape)
Where:
-
m (float) Is the mass of the sample
-
N (int) represents the maximim grade of the polynomials of the basis functions (default: 6)
-
C (np.array) 6x6 matrix with the elastic constants
-
dimensions (np.array>) (3,) shape array containing the dimensions of the sample: [Lx, Ly, Lz]
-
shape (str) Currently supports "Parallelepiped", "Cylinder" and "Ellipsoid"
Inverse problem usage
Getting the elastic constants from the resonence frequencies
from rusmodules import inverse
inverse_data = inverse.inverse_problem(m, omega, dimensions, model_data)
Where:
-
m (float) Is the mass of the sample
-
omega (np.array) Resonance omegas (frequencies in radians NOT in Hz)
-
dimensions (np.array) (3,) shape array containing the dimensions of the sample: [Lx, Ly, Lz]
-
model_data (dict) A dictionary containing the machine learning model and statistics of the training data that was used to generate the model.
The machine learning models can be found in hugging face: Cubos/HuggingFace and the statistics of each model can be found in Means and Averages of the feeding.
Inverse Problem example usage
To use the model you must download it from huggingFace and store it in you preferred location i.e: ./models/:
mkdir models
wget https://huggingface.co/Cubos/InverseRUS/resolve/main/cubico_L4.keras
To use the model trained in this work you can follow this example. The stats of the training data of the model can be found at repo/notebooks/models/cubico_L4.csv.
import os
import numpy as np
from rusmodules import inverse
import torch
os.environ["KERAS_BACKEND"] = "torch"
import keras
import pandas as pd
m = 0.1254 #g
path_model = "models/cubico_L4.keras"
stats_model = pd.read_csv("https://raw.githubusercontent.com/cubos-d/RUSpectroscopy_Tools/refs/heads/main/notebooks/models/cubico_L4_stats.csv")
stats_model = stats_model.set_index("Unnamed: 0")
dic_stats = dict(map(lambda x: (x, dict(map(lambda y: (y, stats_model[y][x]),stats_model.keys()))), ["mean", "std"]))
model = keras.models.load_model(path_model)
omega = [1.50926584, 1.65836575, 1.75117538, 2.01686081, 2.06256988,
2.19098222, 2.34152748, 2.8107501 , 2.89962897, 2.90586193,
2.98053128, 3.01687171, 3.04870302, 3.0491472 , 3.11933117,
3.54120588, 3.65460307, 3.69446139, 3.75998903, 3.78313654] #This must be a list of 20 values all in units of radians
dimensions = np.array([0.30529, 0.20353, 0.25334]) #cm
model_data = {**dic_stats, "model": model}
inverse_data = inverse.inverse_problem(m, omega, dimensions, model_data)
The dictionary that returns inverse_problem (inverse_data) function looks like this:
{
'constants': {
'C00': np.float64(1.30054267050163),
'C01': np.float64(1.1006489848946313),
'C33': np.float64(0.8854417640647991)
},
'MAE': np.float64(0.02978091807048346),
'frequencies': array([1.52869445, 1.67824553, 1.77995932,
2.04882852, 2.09089336, 2.226468 , 2.35439033, 2.75882012,
2.85318217, 2.93387907, 3.00654262, 3.0245675 , 3.04501862,
3.05716655, 3.06015376, 3.5581114 , 3.56426523, 3.65992212,
3.69013139, 3.75229874])
}
The returned frequencies in radians (NOT Hz) are the ones to compare to the original frequencies. MAE is the mean absolute error between the experimental frequencies and the computed frequencies from the predicted constants.
Metadata
Release files for ruspectroscopy-tools 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ruspectroscopy_tools-0.0.3.tar.gz | 17.9 kB | Details |
Built distributions (wheels)
Total release size: 1.3 MB
Release files / ruspectroscopy_tools-0.0.3.tar.gz
| Download URL | ruspectroscopy_tools-0.0.3.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4fa28a929a5e4a43e3e78f7162d39b20a7a8f9721b5cd28419d2a6614e7c4f7
|
|
BLAKE2b-256 checksum How to use checksums |
51a614e819ceef1a23b1bb3fe20165be633079d83c4cfdf35cf5f4d5cf0fe0c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 148.9 kB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
7e222e6fe961a80319aaf308ababb0888cc414e1cf67e794c735f597ae44e150
|
|
BLAKE2b-256 checksum How to use checksums |
05e19ae74cbc92171396308985a33c1af4f5da9bf7561d9a3e07593d90f659d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp313-cp313-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 181.5 kB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
5c8d48de70f76c41d2381d76b86d323067108b7dd799a48e368ffb7721b42a61
|
|
BLAKE2b-256 checksum How to use checksums |
64428d4120d44751c31b94608769daca949cd8abfd714547aa04542bc5d165a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp313-cp313-musllinux_1_2_i686.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp313-cp313-musllinux_1_2_i686.whl |
|---|---|
| Size | 189.9 kB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-32 |
|
SHA-256 checksum How to use checksums |
1d9123bc9445fb336ec82a504a46b3b8dc99436dc4305fde1f1127c3015ad70a
|
|
BLAKE2b-256 checksum How to use checksums |
fba21cff65156f08ad0e407c0293f7be72d3c55bc41e6ab9ff1670c23e3e83b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 106.4 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
714ed093517ec1c625633b33fa3a46e908010d9361c6a88f2d8d7fbb0e934a8c
|
|
BLAKE2b-256 checksum How to use checksums |
3e0840e03c884cf437dafe5b1d978a663f2fb4f4ac861a390fefe877b636b7d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 107.6 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-32 |
|
SHA-256 checksum How to use checksums |
1c8bb026248b163e625bd2d5f765ebb8bfdf307a82a83bef329c0aa243de9191
|
|
BLAKE2b-256 checksum How to use checksums |
dc0d2abfd088ad451eb80caf408bc33bc274d75fea1ccec1b1b89542dc3cd156
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp312-cp312-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 181.5 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
f903895e1ae53d561f50a6e36e835a994460920f4b488108f9a9a2fb1ff69349
|
|
BLAKE2b-256 checksum How to use checksums |
f1622e43bb61b52148dcc07fba8450127ea141d58e8012dea578bebb8aeacf1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp312-cp312-musllinux_1_2_i686.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp312-cp312-musllinux_1_2_i686.whl |
|---|---|
| Size | 189.9 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-32 |
|
SHA-256 checksum How to use checksums |
6c896361849b384ae73f840976562dac9708f01c200ade3faf87fe81d525f67b
|
|
BLAKE2b-256 checksum How to use checksums |
c23659fd127bd55060f17167b4537dd136cc19da92f6a5de33be9a1f05dbc772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 106.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6cc2dd5d2cea939fe1ee538297527c4865444e38982acb29e90527e6e1de2b7c
|
|
BLAKE2b-256 checksum How to use checksums |
9dddc27b1a710cf6fb94fa2f67c76521da71ef29cb3f1020a75940c7c5e54f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency logRelease files / ruspectroscopy_tools-0.0.3-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | ruspectroscopy_tools-0.0.3-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 107.6 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-32 |
|
SHA-256 checksum How to use checksums |
5e8765253519968eefc9ed49efb12cc9c145e4e620624386d1522dc1d814207a
|
|
BLAKE2b-256 checksum How to use checksums |
73a53da4ee9a669363414e00d98df119e51ec3fc6204beb055b6f21ee58e4301
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 1, 2026.
Transparency log