Some code that does template fitter of pulse waveforms.