Commit 94689225 authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones

Merge branch 'master' into candidate-add-phase-sense-check

parents f2b37d32 0ed8a149
Pipeline #25153 passed with stage
in 2 minutes and 8 seconds
......@@ -273,7 +273,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(
......@@ -286,7 +286,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(
......@@ -296,9 +296,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]
......
......@@ -70,7 +70,7 @@ templateOutput = """# Format 1
# Format 1 (Interfield)
- [=] mass-ordering (mass1 >= mass2)
- [=] peak-near-zero (waveform peak is at 0.88M which is less than 10.00M from zero)
- [=] peak-near-zero (waveform peak is at 0.05M which is less than 10.00M from zero)
- [=] phase-sense ((2,2) phase is decreasing on average)
# Format 2
......@@ -1869,7 +1869,7 @@ class TestPeakNearZero(TestInterfield):
def test_invalid_peak_location(self):
self.setOutput(
('- [INVALID INTERFIELD] peak-near-zero (waveform peak is at '
'-99.12M which is greater than 10.00M from zero)'))
'-99.95M which is greater than 10.00M from zero)'))
nr = h5.File(self.f.name)
keys = [k for k in nr.keys() if k.startswith('amp_l')]
......
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