peaks_from_model now uses ndindex instead of enumerate