Metadata-Version: 2.4
Name: interpylate
Version: 1.0.2
Summary: A package for N-linear regular grid interpolation
Author-email: Dorian Bichet <dbichet@insa-toulouse.fr>
License-Expression: CECILL-2.1
Project-URL: Homepage, https://github.com/Dorian210/interpylate
Project-URL: Repository, https://github.com/Dorian210/interpylate
Project-URL: Issues, https://github.com/Dorian210/interpylate/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=1.20
Requires-Dist: numba>=0.55
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Provides-Extra: docs
Requires-Dist: wkhtmltopdf; extra == "docs"
Requires-Dist: pdoc>=12.0; extra == "docs"
Dynamic: license-file

# interpylate

<p align="center">
  <img src="docs/logo.png" width="500" />
</p>

**interpylate** is a Python library for N-linear regular grid interpolation. It provides a flexible and efficient method to interpolate N-dimensional arrays using a N-linear approach, making it particularly useful for image interpolation and its higher-dimensional equivalents.

## Installation

```bash
pip install interpylate
```

## Dependencies

- `numpy`: Core dependency for array operations

## Architecture

The library is structured with a unified interface and specialized implementations:

- `NLinearRegularGridInterpolator`: A unified interface that automatically selects the appropriate dimension-specific implementation based on the input dimension
  - For dimensions > 3, it utilizes `NLinearRegularGridInterpolatorLarge`
- `LinearRegularGridInterpolator`: Optimized for 1D arrays
- `BiLinearRegularGridInterpolator`: Optimized for 2D arrays (images)
- `TriLinearRegularGridInterpolator`: Optimized for 3D arrays (volumes)
- `NLinearRegularGridInterpolatorLarge`: Less optimized general implementation for any dimensions

This design provides both optimization for common cases and flexibility for higher dimensions.

## Usage

```python
from interpylate import NLinearRegularGridInterpolator

# Create an instance of the interpolator
# This will automatically select the appropriate implementation based on dimension
interpolator = NLinearRegularGridInterpolator(dim=3)

# Evaluate the interpolation at specified coordinates
interpolated_values = interpolator.evaluate(NDarray, continuous_inds)

# Compute the gradient of the interpolated array
gradient = interpolator.grad(NDarray, continuous_inds, evaluate_too=False)

# Compute the hessian of the interpolated array
hessian = interpolator.hess(NDarray, continuous_inds, grad_too=False, evaluate_too=False)
```

## Main Features

- **Dimension-agnostic API**: Work with arrays of any dimension using a consistent interface
- **Performance-optimized implementations**: Specialized algorithms for 1D, 2D, and 3D cases
- **Gradient computation**: Calculate first-order derivatives of interpolated arrays
- **Hessian computation**: Compute second-order derivatives for advanced analysis
- **Regular grid support**: Designed specifically for regular grid structures

## Examples

The interpylate GitHub repository includes several example scripts demonstrating the library's capabilities:

- **1D Interpolation**: Basic interpolation for one-dimensional arrays
- **2D Interpolation**: Image interpolation techniques
- **3D Interpolation**: Volume data interpolation methods
- **Speed Contest**: Performance comparison between interpylate's TriLinearRegularGridInterpolator and scipy.interpolate.RegularGridInterpolator

## Documentation

The full API documentation is available in the docs/ directory of the project or via the [online documentation portal](https://dorian210.github.io/interpylate/).

## Contributing

At the moment, I am not actively reviewing contributions. However, if you encounter issues or have suggestions, feel free to open an issue.

## License

This project is licensed under the [CeCILL License](LICENSE.txt).
