Skip to main content

TD-MRSDM

PyPI Python License: MIT

Python implementation of the temperature-dependent multi-relaxation spectroscopic dielectric model (TD-MRSDM) of Mironov & Savin (2019). It returns the complex permittivity of soil from frequency, temperature, organic matter, bulk density and moisture.

TD-MRSDM architecture

For each water form p (bound b, transient t, unbound u or ice i), the ohmic conductivity, static permittivities (Clausius–Mossotti) and relaxation times (Eyring) are computed from temperature with the thawed (t ≥ 0 °C) or frozen (t ≤ −1 °C) constants. Debye relaxation gives each form's RI and NAC, which the refractive mixing model combines with SOM, bulk density and moisture into the soil permittivity. Equation and table numbers refer to the PySDS paper (Khazaei et al., submitted), whose Table A1 lists the v3 constants.

Install

pip install tdmrsdm                 # forward model, NumPy only
pip install "tdmrsdm[analysis]"     # + DDOAS loader, TrainableTDMRSDM, dependence, optimization
pip install "tdmrsdm[figures]"      # + validation figures
pip install "tdmrsdm[torch]"        # + TorchTDMRSDM (differentiable)
pip install "tdmrsdm[all]"          # everything

Python ≥ 3.8.

Usage

import numpy as np
from tdmrsdm import TDMRSDM

eps = TDMRSDM(freq_GHz=5.405, sst=20.0, som=np.array([3.0, 50.0]),
              sbd=np.array([1.3, 0.8]), ssm=np.array([0.35, 0.35]), optimize="v3").run()
# array([9.865+3.494j, 9.938+3.625j])  ->  eps.real = ε', eps.imag = ε''
Argument Unit Description
freq_GHz GHz frequency, scalar (calibrated 0.05–15 GHz)
sst °C soil temperature, scalar or array (−40 to +25 °C in the DDOAS)
som % soil organic matter
sbd g/cm³ dry bulk density
ssm cm³/cm³ volumetric moisture
optimize – constant set, see below (default None)
constants_override – dict with the structure of the JSON files in src/tdmrsdm/constants/

som, sbd and ssm broadcast as NumPy arrays (per-pixel maps work). The result is ε' + jε'' with ε'' > 0 for a lossy medium.

Differentiable version (gradients with respect to ssm, scene scalars or per-pixel maps):

import torch
from tdmrsdm import TorchTDMRSDM

model = TorchTDMRSDM(freq_GHz=1.26, sst=25.0, som=2.0, sbd=1.3, optimize="v3", precision="float64")
ssm = torch.tensor([0.05, 0.20, 0.40], dtype=torch.float64, requires_grad=True)
eps = model(ssm)                                   # complex tensor, same convention

Constant sets

optimize File Fitted on
None td_mrsdm_constants_v2019.json published constants (Mironov & Savin, 2019)
"v1", "v2" ..._optimized_v1/v2.json earlier re-tunings, kept for reproducibility
"v3" ..._optimized_v3.json denoised DDOAS, differential evolution on NRMSE; used by PySDS
"allsoils_v1" td_mrsdm_constants_allsoils_v1.json 7 organic (DDOAS) + 7 mineral laboratory soils (Karavayskiy, unpublished)

Leave-one-soil-out NRMSE (range-normalized, %, mean over soils; from the file metadata):

Constants Organic RI / NAC Mineral RI / NAC
None 2.9 / 4.0 10.9 / 9.4
"v3" 2.7 / 3.3 11.0 / 9.1
"allsoils_v1" 3.4 / 4.3 4.1 / 5.4

Notes:

  • Use "v3" or None for organic soils (≥ 30 % SOM) and "allsoils_v1" for mineral or mixed soils.
  • allsoils_v1: no mineral soil was measured below 0 °C; three mineral soils have PTF-estimated SOM (±6.9 points); laboratory salinity is unknown and is absorbed by the conductivities.
  • v3: the dry-soil attenuation term is slightly negative, so ε'' can reach −0.04 for SSM below about 0.05 cm³/cm³. Clip it at zero if you need a passive medium.

DDOAS validation tools

Needs [analysis]. The DDOAS files are in data/ddoas/ of this repository, not in the PyPI package: run from a clone or pass data_dir=.

from tdmrsdm import DDOASDataset, TrainableTDMRSDM

df = DDOASDataset(data_dir="data/ddoas", verbose=False).load_site("BV")
subset = df[(df["freq_GHz"] <= 5.0) & (df["st"].between(-5, 5))]     # st: temperature (°C)
ri, nac, metrics = TrainableTDMRSDM(verbose=False).predict(subset)[:3]
print(metrics["ri_r2"], metrics["nac_nrmse_pct"])

Notebooks for each DDOAS soil are in examples/.

Layout

src/tdmrsdm/
  core.py          TDMRSDM, NumPy forward model
  torch_core.py    TorchTDMRSDM, PyTorch port                 [torch]
  constants/       2019, v1, v2, v3, allsoils_v1 JSON files
  dataset/         DDOASDataset                                [analysis]
  trainable.py     TrainableTDMRSDM                            [analysis]
  dependence/      dependence analysis                         [analysis]
  optimization/    constant re-tuning                          [analysis]
  figure/          validation figures                          [figures]
data/ddoas/        DDOAS .xls files (repository only)
examples/          notebooks
tests/             pytest suite

Tests

pip install -e ".[dev]"
python -m pytest tests/

tests/test_allsoils_parity.py checks TDMRSDM and TorchTDMRSDM against the tdmrsdm-allsoils reference model for the None, v3 and allsoils_v1 constants.

References

  • Mironov, V. L., & Savin, I. V. (2019). Spectroscopic multirelaxation dielectric model of thawed and frozen Arctic soils considering the dependence on temperature and organic matter content. Izvestiya, Atmospheric and Oceanic Physics, 55(9), 986–995. https://doi.org/10.1134/S0001433819090305
  • Savin, I., Mironov, V., Muzalevskiy, K., Fomin, S., Karavayskiy, A., Ruzicka, Z., & Lukin, Y. (2020). Dielectric database of organic Arctic soils (DDOAS). Earth System Science Data, 12, 3481–3487. https://doi.org/10.5194/essd-12-3481-2020

License

MIT, see LICENSE. Contact: Morteza Khazaei, morteza.khazaei@usherbrooke.ca.

Metadata

Release files for tdmrsdm 2026.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tdmrsdm 2026.10.1
File Size Uploaded Provenance Actions
tdmrsdm-2026.10.1.tar.gz 95.4 kB With provenance Details for tdmrsdm-2026.10.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tdmrsdm 2026.10.1
File Interpreter ABI Platform Actions
tdmrsdm-2026.10.1-py3-none-any.whl Python 3 none any Details for tdmrsdm-2026.10.1-py3-none-any.whl

Total release size: 196.8 kB

Release files / tdmrsdm-2026.10.1.tar.gz

Download URL tdmrsdm-2026.10.1.tar.gz
Size 95.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ac8d233a575d8dd052e2629bd0d5ebc24dfe100935b3ca13cc7755b529f5d040
BLAKE2b-256 checksum
How to use checksums
f4c62d127b65aca204e9bf834d6065f9b0e2337f7c78b72411736d8cf8ab76cb
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 Oct 27, 2026.

Transparency log

Release files / tdmrsdm-2026.10.1-py3-none-any.whl

Download URL tdmrsdm-2026.10.1-py3-none-any.whl
Size 101.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03950362de5ed074a18c25d7cb0b187e758a0fb521f3d3a83b5c1bbdc1a39ac0
BLAKE2b-256 checksum
How to use checksums
84ae09fb222bae2a31519abc1e906913ff99ce4864a7f7f6ebbdd2d9a05ea06c
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 Oct 27, 2026.

Transparency log

Security for tdmrsdm 2026.10.1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tdmrsdm-2026.10.1.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 Oct 27, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page