...
 
Commits (1)
...@@ -273,7 +273,7 @@ def get_waveform_peak(sim): ...@@ -273,7 +273,7 @@ def get_waveform_peak(sim):
# Prepare container for piecewise polynomial # Prepare container for piecewise polynomial
amp22 = sim['amp_l2_m2'] 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( interiorKnots22 = np.setdiff1d(
interiorKnots, amp22['X'][3:-3]) interiorKnots, amp22['X'][3:-3])
tck22 = reduce( tck22 = reduce(
...@@ -286,7 +286,7 @@ def get_waveform_peak(sim): ...@@ -286,7 +286,7 @@ def get_waveform_peak(sim):
ampKeys = [k for k in ampKeys if k != 'amp_l2_m2'] ampKeys = [k for k in ampKeys if k != 'amp_l2_m2']
for k in ampKeys: for k in ampKeys:
amplm = sim[k] 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( interiorKnotslm = np.setdiff1d(
interiorKnots, amplm['X'][3:-3]) interiorKnots, amplm['X'][3:-3])
tcklm = reduce( tcklm = reduce(
...@@ -296,9 +296,12 @@ def get_waveform_peak(sim): ...@@ -296,9 +296,12 @@ def get_waveform_peak(sim):
plm = PPoly.from_spline(tcklm) plm = PPoly.from_spline(tcklm)
pAll.c += plm.c 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() dpAll = pAll.derivative()
extremumPoints = dpAll.roots() 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) extremum = pAll(extremumPoints)
idx = np.argmax(extremum) idx = np.argmax(extremum)
maximumPoint = extremumPoints[idx] maximumPoint = extremumPoints[idx]
......
...@@ -70,7 +70,7 @@ templateOutput = """# Format 1 ...@@ -70,7 +70,7 @@ templateOutput = """# Format 1
# Format 1 (Interfield) # Format 1 (Interfield)
- [=] mass-ordering (mass1 >= mass2) - [=] 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) - [=] phase-sense ((2,2) phase is decreasing on average)
# Format 2 # Format 2
...@@ -1869,7 +1869,7 @@ class TestPeakNearZero(TestInterfield): ...@@ -1869,7 +1869,7 @@ class TestPeakNearZero(TestInterfield):
def test_invalid_peak_location(self): def test_invalid_peak_location(self):
self.setOutput( self.setOutput(
('- [INVALID INTERFIELD] peak-near-zero (waveform peak is at ' ('- [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) nr = h5.File(self.f.name)
keys = [k for k in nr.keys() if k.startswith('amp_l')] keys = [k for k in nr.keys() if k.startswith('amp_l')]
......