Index of every page on this site: llms.txt
All skills
yonesuke avatar

/interpolation

@1e23d34
Run it yourself

Techniques for 1D and 2D data interpolation using SciPy (CPU) and JAX/Interpax (GPU/Differentiable).

  • 5 files
  • 9.1 KB
  • Updated 10 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/yonesuke/skills/interpolation

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

examples.md

≈388 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Interpolation Examples

1D and 2D interpolation using SciPy and JAX.

1. SciPy (Standard)

Includes Splines (Cubic, PCHIP) and 2D Grids.

Source: scripts/scipy_interp.py

# /// script
# requires-python = ">=3.12"
# dependencies = ["numpy", "scipy", "matplotlib"]
# ///

import numpy as np
from scipy.interpolate import CubicSpline, PchipInterpolator, interp1d, RegularGridInterpolator, griddata

def main():
    print("Running SciPy Interpolation Demo")
    
    # --- 1D Interpolation ---
    print("\n1D Interpolation:")
    x = np.array([0, 1, 2, 3, 4, 5])
    y = np.array([0, 0.8, 0.9, 0.1, -0.8, -1.0])
    x_new = np.linspace(0, 5, 5) # Coarse for printing

    # Cubic Spline
    cs = CubicSpline(x, y, bc_type='natural') 
    print(f"Cubic Spline: {cs(x_new)}")

    # PCHIP
    pch = PchipInterpolator(x, y)
    print(f"PCHIP: {pch(x_new)}")
# ...

2. JAX (Differentiable)

Using interpax for GPU-accelerated splines.

Source: scripts/jax_interp.py

# /// script
# requires-python = ">=3.12"
# dependencies = ["jax", "jaxlib", "interpax"]
# ///

import jax.numpy as jnp
import interpax
import jax

def main():
    print("Running JAX/Interpax Interpolation Demo")
    
    x = jnp.linspace(0, 5, 6)
    y = jnp.sin(x)
    xq = jnp.linspace(0, 5, 5)

    # 1. Cubic Spline
    # method: 'linear', 'cubic', 'cubic2' (monotonic/pchip), 'cardinal', 'akima'
    yq = interpax.interp1d(xq, x, y, method='cubic')
    print(f"Cubic Spline JAX: {yq}")
# ...

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 1e23d34. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 10 months ago

README badge

README badge for yonesuke/skills/interpolation