xarray-lmfit
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.
Metadata
Release files for xarray-lmfit 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xarray_lmfit-0.6.1.tar.gz | 43.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xarray_lmfit-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.5 kB
Release files / xarray_lmfit-0.6.1.tar.gz
| Download URL | xarray_lmfit-0.6.1.tar.gz |
|---|---|
| Size | 43.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8040561d927c239ba264145eecbd7bb9951379b3a430cd3d80530522b48495fe
|
|
BLAKE2b-256 checksum How to use checksums |
70b1c8722c878dd043ca871206aaf0330ada24a7735d90f9de2d0646d9a4fe37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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}
|
Release files / xarray_lmfit-0.6.1-py3-none-any.whl
| Download URL | xarray_lmfit-0.6.1-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe6606e059bc5bbecc098c3e14189beca000e654ab5c46d7018295aaf85f6397
|
|
BLAKE2b-256 checksum How to use checksums |
db1e50efc30378f5c7c3e5fab466d1906f4938fc8ec6897f4fff348494184793
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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}
|