Commit 157988de authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones
Browse files

Sum amp squares and find maximum only in NR domain

parent 06ccc67e
Pipeline #25117 failed with stage
in 2 minutes and 23 seconds
......@@ -272,7 +272,7 @@ def get_waveform_peak(sim):
# Prepare container for piecewise polynomial
amp22 = sim['amp_l2_m2']
tck22 = splrep(amp22['X'][:], amp22['Y'][:], s=0, k=5)
tck22 = splrep(amp22['X'][:], amp22['Y'][:]**2, s=0, k=5)
interiorKnots22 = np.setdiff1d(
interiorKnots, amp22['X'][3:-3])
tck22 = reduce(
......@@ -285,7 +285,7 @@ def get_waveform_peak(sim):
ampKeys = [k for k in ampKeys if k != 'amp_l2_m2']
for k in ampKeys:
amplm = sim[k]
tcklm = splrep(amplm['X'][:], amplm['Y'][:], s=0, k=5)
tcklm = splrep(amplm['X'][:], amplm['Y'][:]**2, s=0, k=5)
interiorKnotslm = np.setdiff1d(
interiorKnots, amplm['X'][3:-3])
tcklm = reduce(
......@@ -295,9 +295,12 @@ def get_waveform_peak(sim):
plm = PPoly.from_spline(tcklm)
pAll.c += plm.c
# Find the global maximum point of the piecewise polynomial
# Find the global maximum point of the piecewise polynomial in domain
dpAll = pAll.derivative()
extremumPoints = dpAll.roots()
t0, t1 = sim['amp_l2_m2/X'][:][np.r_[0, -1]]
mask = (extremumPoints >= t0) * (extremumPoints <= t1)
extremumPoints = extremumPoints[mask]
extremum = pAll(extremumPoints)
idx = np.argmax(extremum)
maximumPoint = extremumPoints[idx]
......
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