Commit 9763a854 authored by Leon Merten Lohse's avatar Leon Merten Lohse
Browse files

add squaresum to misc module

parent 5a8275af
import numpy as np
from scipy.fft import fftfreq
from functools import reduce
def fftfreqn(n, dx=1):
......@@ -44,3 +45,7 @@ def crop(a, crop_width):
slices = [slice(w[0], -w[1] if w[1] > 0 else None) for w in crop_width]
return a[tuple(slices)]
def squaresum(a):
return reduce(np.add, map(np.square, a))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment