Skip to main content

xarray-lmfit

Supported Python Versions PyPi Conda Version Workflow Status Documentation Status pre-commit.ci status codecov Ruff

xarray-lmfit is a Python package that bridges the power of xarray for handling multi-dimensional labeled arrays with the flexible fitting capabilities of lmfit.

With xarray-lmfit, lmfit models can be fit to xarray Datasets and DataArrays, automatically propagating across multiple dimensions. The fit results are stored as xarray Datasets, retaining the original coordinates and dimensions of the input data.

Disclaimer: Please note that this package is independent and not affiliated with the xarray or lmfit projects. If you encounter any issues, please report them on the xarray-lmfit issue tracker.

Installation

Install via pip:

pip install xarray-lmfit

Install via conda:

conda install -c conda-forge xarray-lmfit

Usage

Below is a basic example to demonstrate how to use xarray-lmfit:

import xarray as xr
import numpy as np
from lmfit.models import GaussianModel

import xarray_lmfit as xlm

# Create an example dataset
x = np.linspace(0, 10, 100)
y = 3.0 * np.exp(-((x - 5) ** 2) / (2 * 1.0**2)) + np.random.normal(0, 0.1, x.size)
data = xr.DataArray(y, dims="x", coords={"x": x})

# Define the model to be used
model = GaussianModel()

# Perform the fit
result = data.xlm.modelfit("x", model=model)

Documentation

For more detailed documentation and examples, please visit the documentation.

License

This project is licensed under the GPL-3.0 License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xarray_lmfit-0.5.5.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xarray_lmfit-0.5.5-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file xarray_lmfit-0.5.5.tar.gz.

File metadata

  • Download URL: xarray_lmfit-0.5.5.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xarray_lmfit-0.5.5.tar.gz
Algorithm Hash digest
SHA256 0091c4c8d6b1fe9478f01eeba1153379603a50ca30930d5aa1b8f7d5b0aaffcf
MD5 8eab4fdb022b7e34ba320f864b8fc7f2
BLAKE2b-256 638bb67dff0aadb2842d632e9cdb7eda0295089e9b5aa584f3415999183f1946

See more details on using hashes here.

File details

Details for the file xarray_lmfit-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: xarray_lmfit-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xarray_lmfit-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 412448bf658f57ce3cec6734fb10698e0d01f515f08502c6f19c50eb228bed20
MD5 6f189fc682fe899fe431163d64894e56
BLAKE2b-256 af7ad612399ca9c551d2f9691b77083cc35f90eb522c97e186a7f6137c435b78

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.0

2 files

0.5.6

2 files

This release

0.5.5 This release

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

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