Verified Commit 02fe5ca0 authored by Daniel Williams's avatar Daniel Williams
Browse files

Fixed the test for Ott waveforms and distance scaling.

parent 8df58ca7
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -159,8 +159,16 @@ class Waveform(object):
                tail_hp = self.generate_tail(length = 1, h_max = hp.data.data[-1])
                tail_hx = self.generate_tail(length = 1, h_max = hx.data.data[-1])

                hp.data.data = np.append(hp.data.data(tail_hp))
                hx.data.data = np.append(hp.data.data(tail_hx))
                hp_data = np.append(hp.data.data,tail_hp.data)
                hx_data = np.append(hp.data.data,tail_hx.data)

                tail_hp = lal.CreateREAL8Vector(len(hp_data))
                tail_hp.data = hp_data
                tail_hx = lal.CreateREAL8Vector(len(hx_data))
                tail_hx.data = hx_data

                hp.data = tail_hp
                hx.data = tail_hx
        
        return hp, hx, hp0, hx0 

@@ -481,9 +489,12 @@ class Supernova(Waveform):

        times = np.linspace(0, length, length * sampling)
        tail_f = 1.0 / length / 2.0 # Calculate the frequency for a half cosine function over the length of the tail
        tail = 0.5 * (h_max + h_max * np.cos( 2 * np.pi * f_tail * times))
        tail = 0.5 * (h_max + h_max * np.cos( 2 * np.pi * tail_f * times))

        tailout = lal.CreateREAL8Vector(len(tail))
        tailout.data = tail
        
        return tail
        return tailout
        
        
    def interpolate(self, x_old, y_old, x_new):
+3 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ from minke import distribution
import numpy as np



ott_data_url = "http://www.stellarcollapse.org/gwdata/ottetal2012b/s27WHW02_LS220_j0_rx3_full_cc_fheat1.05_HlmD.dat.gz"

def download_nr(url):
@@ -68,7 +69,8 @@ class TestMinkeSources(unittest.TestCase):
        self.assertAlmostEqual(sn_10.params['amplitude'],float(0.1 * sn_100.params['amplitude']))
        sn_10_hp, _, _, _ = sn_10._generate()
        sn_100_hp, _, _, _ = sn_100._generate()
        assert np.all(sn_100_hp.data.data == 10*sn_10_hp.data.data)
        
        np.testing.assert_almost_equal(10*sn_100_hp.data.data, sn_10_hp.data.data)

    def test_OttXML(self):
        mdcset = mdctools.MDCSet(['L1', 'H1'])