Skip to content

Instantly share code, notes, and snippets.

View MGNute's full-sized avatar

Michael Nute MGNute

  • Anvil Diagnostics
  • Southborough, MA
View GitHub Profile
@MGNute
MGNute / thin-plate-spline-numpy.py
Created August 13, 2020 17:03
Fast NumPy Implementation of a Basic Thin-Plate Spline Model
import datetime, os, re
import numpy as np
import scipy as sp
VERBOSE=False
# Kernel_TPS = lambda x,y: np.nan_to_num(np.linalg.norm(y-x)**2*np.log(np.linalg.norm(y-x)),nan=0.)
Kernel_TPS = lambda x,y: 0. if np.linalg.norm(y-x)==0. else np.nan_to_num(np.linalg.norm(y-x)**2*np.log(np.linalg.norm(y-x)),nan=0.)
DATETIME_FMT_PRINTABLE = '%Y-%m-%d %H:%M:%S'