Ejemplo n.º 1
0
 def test_fwd_complex_fs(self):
     for fwd_dtype in [complex64, complex128]:
         delta_f = self.delta
         # Don't do separate even/odd tests for complex
         inarr = fs(self.in_c2c_fwd,
                    dtype=fwd_dtype,
                    delta_f=delta_f,
                    epoch=self.epoch)
         delta_t = 1.0 / (delta_f * len(inarr))
         outexp = ts(self.out_c2c_fwd,
                     dtype=fwd_dtype,
                     delta_t=delta_t,
                     epoch=self.epoch)
         outexp *= delta_f
         _test_fft(self, inarr, outexp, self.tdict[fwd_dtype])
         # Random
         rand_inarr = fs(zeros(self.rand_len_c, dtype=fwd_dtype),
                         delta_f=delta_f,
                         epoch=self.epoch)
         delta_t = 1.0 / (delta_t * len(rand_inarr))
         rand_outarr = ts(zeros(self.rand_len_c, dtype=fwd_dtype),
                          delta_t=delta_t,
                          epoch=self.epoch)
         _test_random(self, rand_inarr, rand_outarr, self.tdict[fwd_dtype])
         # LAL doesn't have forward FFT funcs starting from a FS, so skip _test_lal
         # Clean these up since they could be big:
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_fft(self, inarr, outexp, output_args)
Ejemplo n.º 2
0
 def test_rev_real_fs(self):
     for rev_dtype in [float32,float64]:
         delta_f = self.delta
         # Even input
         inarr = fs(self.in_c2r_e,dtype=_other_kind[rev_dtype],delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(delta_f*len(self.out_c2r_e))
         outexp = ts(self.out_c2r_e,dtype=rev_dtype,delta_t=delta_t,epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self,inarr,outexp,self.tdict[rev_dtype])
         # Odd input
         inarr = fs(self.in_c2r_o,dtype=_other_kind[rev_dtype],delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(delta_f*len(self.out_c2r_o))
         outexp = ts(self.out_c2r_o,dtype=rev_dtype,delta_t=delta_t,epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self,inarr,outexp,self.tdict[rev_dtype])
         # Random---we don't do that in 'reverse' tests, since both
         # directions are already tested in forward, and if we just passed
         # in arrays in the other order we'd only get exceptions
         #
         # However, we do still generate the arrays for T/F series, so that we may
         # do the LAL comparison test.  As usual, we then delete those arrays.
         rand_inarr = fs(zeros(self.rand_len_c,dtype=_other_kind[rev_dtype]),epoch=self.epoch,
                         delta_f=self.delta)
         rand_outarr = ts(zeros(self.rand_len_r,dtype=rev_dtype),epoch=self.epoch,
                          delta_t=self.delta)
         _test_lal_tf_ifft(self,rand_inarr,rand_outarr,self.tdict[rev_dtype])
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self,inarr,outexp,output_args)
Ejemplo n.º 3
0
 def test_fwd_complex_ts(self):
     for fwd_dtype in [complex64,complex128]:
         delta_t = self.delta
         # Don't do separate even/odd tests for complex
         inarr = ts(self.in_c2c_fwd,dtype=fwd_dtype,delta_t=delta_t,epoch=self.epoch)
         delta_f = 1.0/(delta_t * len(inarr))
         outexp = fs(self.out_c2c_fwd,dtype=fwd_dtype,delta_f=delta_f,epoch=self.epoch)
         outexp *= delta_t
         _test_fft(self,inarr,outexp,self.tdict[fwd_dtype])
         # Random
         rand_inarr = ts(zeros(self.rand_len_c,dtype=fwd_dtype),delta_t=delta_t,epoch=self.epoch)
         delta_f = 1.0/(delta_t*len(rand_inarr))
         rand_outarr = fs(zeros(self.rand_len_c,dtype=fwd_dtype),delta_f=delta_f,epoch=self.epoch)
         _test_random(self,rand_inarr,rand_outarr,self.tdict[fwd_dtype])
         # Reuse random arrays for the LAL tests:
         # COMMENTED OUT: The LAL Complex TimeFreqFFT and FreqTimeFFT functions perform
         # a repacking of data because they seem to assume that the array represents both
         # positive and negative frequencies.  We don't do this, so we don't compare.
         #_test_lal_tf_fft(self,rand_inarr,rand_outarr,self.tdict[fwd_dtype])
         # Clean these up since they could be big:
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_f": self.delta, "epoch": self.epoch}
         _test_raise_excep_fft(self,inarr,outexp,output_args)
Ejemplo n.º 4
0
 def test_rev_real_ts(self):
     for rev_dtype in [float32,float64]:
         delta_t = self.delta
         # Even input
         inarr = ts(self.in_c2r_e,dtype=_other_kind[rev_dtype],delta_t=delta_t,epoch=self.epoch)
         delta_f = 1.0/(delta_t*len(self.out_c2r_e))
         outexp = fs(self.out_c2r_e,dtype=rev_dtype,delta_f=delta_f,epoch=self.epoch)
         outexp *= delta_t
         _test_ifft(self,inarr,outexp,self.tdict[rev_dtype])
         # Odd input
         inarr = ts(self.in_c2r_o,dtype=_other_kind[rev_dtype],delta_t=delta_t,epoch=self.epoch)
         delta_f = 1.0/(delta_t*len(self.out_c2r_o))
         outexp = fs(self.out_c2r_o,dtype=rev_dtype,delta_f=delta_f,epoch=self.epoch)
         outexp *= delta_t
         _test_ifft(self,inarr,outexp,self.tdict[rev_dtype])
         # Random---we don't do that in 'reverse' tests, since both
         # directions are already tested in forward, and if we just passed
         # in arrays in the other order we'd only get exceptions
         #
         # LAL doesn't have reverse FFT funcs starting from a TimeSeries, so
         # we skip those tests as well.
         #
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_f": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self,inarr,outexp,output_args)
Ejemplo n.º 5
0
 def test_fwd_real_fs(self):
     for fwd_dtype in [float32,float64]:
         delta_f = self.delta
         # Even input
         inarr = fs(self.in_r2c_e,dtype=fwd_dtype,delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(inarr.delta_f * len(inarr))
         outexp = ts(self.out_r2c_e,dtype=_other_kind[fwd_dtype],delta_t=delta_t,epoch=self.epoch)
         outexp *= delta_f
         _test_fft(self,inarr,outexp,self.tdict[fwd_dtype])
         # Odd input
         inarr = fs(self.in_r2c_o,dtype=fwd_dtype,delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(inarr.delta_f * len(inarr))
         outexp = ts(self.out_r2c_o,dtype=_other_kind[fwd_dtype],delta_t=delta_t,epoch=self.epoch)
         outexp *= delta_f
         _test_fft(self,inarr,outexp,self.tdict[fwd_dtype])
         # Random
         rand_inarr = fs(zeros(self.rand_len_r,dtype=fwd_dtype),epoch=self.epoch,delta_f=delta_f)
         delta_t = 1.0/(rand_inarr.delta_f * len(rand_inarr))
         rand_outarr = ts(zeros(self.rand_len_c,dtype=_other_kind[fwd_dtype]),epoch=self.epoch,
                          delta_t=delta_t)
         _test_random(self,rand_inarr,rand_outarr,self.tdict[fwd_dtype])
         # LAL doesn't have forward FFT funcs starting from a FS, so skip _test_lal
         # Clean these up since they could be big:
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_fft(self,inarr,outexp,output_args)
Ejemplo n.º 6
0
 def test_rev_real_fs(self):
     for rev_dtype in [float32, float64]:
         delta_f = self.delta
         # Even input
         inarr = fs(self.in_c2r_e,
                    dtype=_other_kind[rev_dtype],
                    delta_f=delta_f,
                    epoch=self.epoch)
         delta_t = 1.0 / (delta_f * len(self.out_c2r_e))
         outexp = ts(self.out_c2r_e,
                     dtype=rev_dtype,
                     delta_t=delta_t,
                     epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self, inarr, outexp, self.tdict[rev_dtype])
         # Odd input
         inarr = fs(self.in_c2r_o,
                    dtype=_other_kind[rev_dtype],
                    delta_f=delta_f,
                    epoch=self.epoch)
         delta_t = 1.0 / (delta_f * len(self.out_c2r_o))
         outexp = ts(self.out_c2r_o,
                     dtype=rev_dtype,
                     delta_t=delta_t,
                     epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self, inarr, outexp, self.tdict[rev_dtype])
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self, inarr, outexp, output_args)
Ejemplo n.º 7
0
 def test_rev_real_fs(self):
     for rev_dtype in [float32, float64]:
         delta_f = self.delta
         # Even input
         inarr = fs(self.in_c2r_e,
                    dtype=_other_kind[rev_dtype],
                    delta_f=delta_f,
                    epoch=self.epoch)
         delta_t = 1.0 / (delta_f * len(self.out_c2r_e))
         outexp = ts(self.out_c2r_e,
                     dtype=rev_dtype,
                     delta_t=delta_t,
                     epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self, inarr, outexp, self.tdict[rev_dtype])
         # Odd input
         inarr = fs(self.in_c2r_o,
                    dtype=_other_kind[rev_dtype],
                    delta_f=delta_f,
                    epoch=self.epoch)
         delta_t = 1.0 / (delta_f * len(self.out_c2r_o))
         outexp = ts(self.out_c2r_o,
                     dtype=rev_dtype,
                     delta_t=delta_t,
                     epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self, inarr, outexp, self.tdict[rev_dtype])
         # Random---we don't do that in 'reverse' tests, since both
         # directions are already tested in forward, and if we just passed
         # in arrays in the other order we'd only get exceptions
         #
         # However, we do still generate the arrays for T/F series, so that we may
         # do the LAL comparison test.  As usual, we then delete those arrays.
         rand_inarr = fs(zeros(self.rand_len_c,
                               dtype=_other_kind[rev_dtype]),
                         epoch=self.epoch,
                         delta_f=self.delta)
         rand_outarr = ts(zeros(self.rand_len_r, dtype=rev_dtype),
                          epoch=self.epoch,
                          delta_t=self.delta)
         _test_lal_tf_ifft(self, rand_inarr, rand_outarr,
                           self.tdict[rev_dtype])
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self, inarr, outexp, output_args)
Ejemplo n.º 8
0
 def test_fwd_real_ts(self):
     for fwd_dtype in [float32, float64]:
         delta_t = self.delta
         # Even input
         inarr = ts(self.in_r2c_e,
                    dtype=fwd_dtype,
                    delta_t=delta_t,
                    epoch=self.epoch)
         delta_f = 1.0 / (inarr.delta_t * len(inarr))
         outexp = fs(self.out_r2c_e,
                     dtype=_other_kind[fwd_dtype],
                     delta_f=delta_f,
                     epoch=self.epoch)
         outexp *= delta_t
         _test_fft(self, inarr, outexp, self.tdict[fwd_dtype])
         # Odd input
         inarr = ts(self.in_r2c_o,
                    dtype=fwd_dtype,
                    delta_t=delta_t,
                    epoch=self.epoch)
         delta_f = 1.0 / (inarr.delta_t * len(inarr))
         outexp = fs(self.out_r2c_o,
                     dtype=_other_kind[fwd_dtype],
                     delta_f=delta_f,
                     epoch=self.epoch)
         outexp *= delta_t
         _test_fft(self, inarr, outexp, self.tdict[fwd_dtype])
         # Random
         rand_inarr = ts(zeros(self.rand_len_r, dtype=fwd_dtype),
                         epoch=self.epoch,
                         delta_t=delta_t)
         delta_f = 1.0 / (rand_inarr.delta_t * len(rand_inarr))
         rand_outarr = fs(zeros(self.rand_len_c,
                                dtype=_other_kind[fwd_dtype]),
                          epoch=self.epoch,
                          delta_f=delta_f)
         _test_random(self, rand_inarr, rand_outarr, self.tdict[fwd_dtype])
         # Reuse random arrays for the LAL tests:
         _test_lal_tf_fft(self, rand_inarr, rand_outarr,
                          self.tdict[fwd_dtype])
         # Clean these up since they could be big:
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_f": self.delta, "epoch": self.epoch}
         _test_raise_excep_fft(self, inarr, outexp, output_args)
Ejemplo n.º 9
0
def _test_lal_tf_ifft(test_case, inarr, outarr, tol):
    tc = test_case
    # Fill input array with random, clear output, and get lal handles for each.
    if dtype(inarr).kind == 'c':
        inarr._data[:] = randn(len(inarr)) + 1j * randn(len(inarr))
        # We must worry about DC/Nyquist imag parts if this is HC2R transform:
        if dtype(outarr).kind == 'f':
            inarr._data[0] = real(inarr._data[0])
            if (len(outarr) % 2) == 0:
                inarr._data[len(inarr) - 1] = real(inarr[len(inarr) - 1])
    else:
        inarr._data[:] = randn(len(outarr))
    outarr.clear()
    inlal = inarr.lal()
    outlal = outarr.lal()
    # Calculate the pycbc fft:
    with tc.context:
        pycbc.fft.ifft(inarr, outarr, tc.backends)
    revplan = _rev_plan_dict[dtype(outarr).type](len(outarr), 0)
    # Call the lal function directly (see above for dict).  Note that
    # lal functions want *output* given first.
    _rev_lalfft_dict[dtype(outarr).type](outlal, inlal, revplan)
    # Make a pycbc type from outlal.  Some hackiness because we don't know the
    # type of outlal.
    if hasattr(outlal, 'deltaT'):
        cmparr = ts(outlal.data.data,
                    epoch=outlal.epoch,
                    delta_t=outlal.deltaT)
    else:
        cmparr = fs(outlal.data.data,
                    epoch=outlal.epoch,
                    delta_f=outlal.deltaF)
    emsg = "Direct call to LAL TimeFreqFFT() did not agree with fft() to within precision {0}".format(
        tol)
    tc.assertTrue(outarr.almost_equal_norm(cmparr, tol=tol), msg=emsg)
Ejemplo n.º 10
0
def _test_lal_tf_fft(test_case, inarr, outarr, tol):
    tc = test_case
    # Make sure input and output have been moved back to CPU if needed
    inarr *= 1.0
    outarr *= 1.0
    # Fill input array with random, clear output, and get lal handles for each.
    if dtype(inarr).kind == 'c':
        inarr._data[:] = randn(len(inarr)) + 1j * randn(len(inarr))
    else:
        inarr._data[:] = randn(len(inarr))
    outarr.clear()
    inlal = inarr.lal()
    outlal = outarr.lal()
    # Calculate the pycbc fft:
    with tc.context:
        pycbc.fft.fft(inarr, outarr, tc.backends)
    fwdplan = _fwd_plan_dict[dtype(inarr).type](len(inarr), 0)
    # Call the lal function directly (see above for dict).  Note that
    # lal functions want *output* given first.
    _fwd_lalfft_dict[dtype(inarr).type](outlal, inlal, fwdplan)
    # Make a pycbc type from outlal.  Some hackiness because we don't know the
    # type of outlal.
    if hasattr(outlal, 'deltaT'):
        cmparr = ts(outlal.data.data,
                    epoch=outlal.epoch,
                    delta_t=outlal.deltaT)
    else:
        cmparr = fs(outlal.data.data,
                    epoch=outlal.epoch,
                    delta_f=outlal.deltaF)
    emsg = "Direct call to LAL TimeFreqFFT() did not agree with fft() to within precision {0}".format(
        tol)
    tc.assertTrue(outarr.almost_equal_norm(cmparr, tol=tol), msg=emsg)
Ejemplo n.º 11
0
def _test_lal_tf_fft(test_case,inarr,outarr,tol):
    tc = test_case
    # Make sure input and output have been moved back to CPU if needed
    inarr *= 1.0
    outarr *=1.0
    # Fill input array with random, clear output, and get lal handles for each.
    if dtype(inarr).kind == 'c':
        inarr._data[:] = randn(len(inarr)) +1j*randn(len(inarr))
    else:
        inarr._data[:] = randn(len(inarr))
    outarr.clear()
    inlal = inarr.lal()
    outlal = outarr.lal()
    # Calculate the pycbc fft:
    with tc.context:
        pycbc.fft.fft(inarr,outarr,tc.backends)
    fwdplan = _fwd_plan_dict[dtype(inarr).type](len(inarr),0)
    # Call the lal function directly (see above for dict).  Note that
    # lal functions want *output* given first.
    _fwd_lalfft_dict[dtype(inarr).type](outlal,inlal,fwdplan)
    # Make a pycbc type from outlal.  Some hackiness because we don't know the
    # type of outlal.
    if hasattr(outlal,'deltaT'):
        cmparr = ts(outlal.data.data,epoch=outlal.epoch,delta_t=outlal.deltaT)
    else:
        cmparr = fs(outlal.data.data,epoch=outlal.epoch,delta_f=outlal.deltaF)
    emsg = "Direct call to LAL TimeFreqFFT() did not agree with fft() to within precision {0}".format(tol)
    tc.assertTrue(outarr.almost_equal_norm(cmparr,tol=tol),msg=emsg)
Ejemplo n.º 12
0
def _test_lal_tf_ifft(test_case,inarr,outarr,tol):
    tc = test_case
    # Fill input array with random, clear output, and get lal handles for each.
    if dtype(inarr).kind == 'c':
        inarr._data[:] = randn(len(inarr)) +1j*randn(len(inarr))
        # We must worry about DC/Nyquist imag parts if this is HC2R transform:
        if dtype(outarr).kind == 'f':
            inarr._data[0] = real(inarr._data[0])
            if (len(outarr)%2)==0:
                inarr._data[len(inarr)-1] = real(inarr[len(inarr)-1])
    else:
        inarr._data[:] = randn(len(outarr))
    outarr.clear()
    inlal = inarr.lal()
    outlal = outarr.lal()
    # Calculate the pycbc fft:
    with tc.context:
        pycbc.fft.ifft(inarr,outarr,tc.backends)
    revplan = _rev_plan_dict[dtype(outarr).type](len(outarr),0)
    # Call the lal function directly (see above for dict).  Note that
    # lal functions want *output* given first.
    _rev_lalfft_dict[dtype(outarr).type](outlal,inlal,revplan)
    # Make a pycbc type from outlal.  Some hackiness because we don't know the
    # type of outlal.
    if hasattr(outlal,'deltaT'):
        cmparr = ts(outlal.data.data,epoch=outlal.epoch,delta_t=outlal.deltaT)
    else:
        cmparr = fs(outlal.data.data,epoch=outlal.epoch,delta_f=outlal.deltaF)
    emsg = "Direct call to LAL TimeFreqFFT() did not agree with fft() to within precision {0}".format(tol)
    tc.assertTrue(outarr.almost_equal_norm(cmparr,tol=tol),msg=emsg)
Ejemplo n.º 13
0
 def test_rev_complex_fs(self):
     for rev_dtype in [complex64,complex128]:
         delta_f = self.delta
         # Don't do separate even/odd tests for complex
         inarr = fs(self.in_c2c_rev,dtype=rev_dtype,delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(delta_f*len(self.out_c2c_rev))
         outexp = ts(self.out_c2c_rev,dtype=rev_dtype,delta_t=delta_t,epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self,inarr,outexp,self.tdict[rev_dtype])
         # Random---we don't do that in 'reverse' tests, since both
         # directions are already tested in forward, and if we just passed
         # in arrays in the other order we'd only get exceptions
         #
         # However, we do still generate the arrays for T/F series, so that we may
         # do the LAL comparison test.  As usual, we then delete those arrays.
         #
         # COMMENTED OUT: The LAL Complex TimeFreqFFT and FreqTimeFFT functions perform
         # a repacking of data because they seem to assume that the array represents both
         # positive and negative frequencies.  We don't do this, so we don't compare.
         #rand_inarr = fs(zeros(self.rand_len_c,dtype=rev_dtype),epoch=self.epoch,
         #                delta_f=self.delta)
         #rand_outarr = ts(zeros(self.rand_len_c,dtype=rev_dtype),epoch=self.epoch,
         #                 delta_t=self.delta)
         #_test_lal_tf_ifft(self,rand_inarr,rand_outarr,self.tdict[rev_dtype])
         #del rand_inarr
         #del rand_outarr
         #
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self,inarr,outexp,output_args)
Ejemplo n.º 14
0
 def test_rev_complex_ts(self):
     for rev_dtype in [complex64, complex128]:
         delta_t = self.delta
         # Don't do separate even/odd tests for complex
         inarr = ts(self.in_c2c_rev,
                    dtype=rev_dtype,
                    delta_t=delta_t,
                    epoch=self.epoch)
         delta_f = 1.0 / (delta_t * len(self.out_c2c_rev))
         outexp = fs(self.out_c2c_rev,
                     dtype=rev_dtype,
                     delta_f=delta_f,
                     epoch=self.epoch)
         outexp *= delta_t
         _test_ifft(self, inarr, outexp, self.tdict[rev_dtype])
         # Random---we don't do that in 'reverse' tests, since both
         # directions are already tested in forward, and if we just passed
         # in arrays in the other order we'd only get exceptions
         #
         # LAL doesn't have reverse FFT funcs starting from a TimeSeries, so
         # we skip those tests as well.
         #
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_f": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self, inarr, outexp, output_args)
Ejemplo n.º 15
0
 def test_fwd_complex_fs(self):
     for fwd_dtype in [complex64,complex128]:
         delta_f = self.delta
         # Don't do separate even/odd tests for complex
         inarr = fs(self.in_c2c_fwd,dtype=fwd_dtype,delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(delta_f * len(inarr))
         outexp = ts(self.out_c2c_fwd,dtype=fwd_dtype,delta_t=delta_t,epoch=self.epoch)
         outexp *= delta_f
         _test_fft(self,inarr,outexp,self.tdict[fwd_dtype])
         # Random
         rand_inarr = fs(zeros(self.rand_len_c,dtype=fwd_dtype),delta_f=delta_f,epoch=self.epoch)
         delta_t = 1.0/(delta_t*len(rand_inarr))
         rand_outarr = ts(zeros(self.rand_len_c,dtype=fwd_dtype),delta_t=delta_t,epoch=self.epoch)
         _test_random(self,rand_inarr,rand_outarr,self.tdict[fwd_dtype])
         # LAL doesn't have forward FFT funcs starting from a FS, so skip _test_lal
         # Clean these up since they could be big:
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_fft(self,inarr,outexp,output_args)
Ejemplo n.º 16
0
 def test_fwd_complex_ts(self):
     for fwd_dtype in [complex64, complex128]:
         delta_t = self.delta
         # Don't do separate even/odd tests for complex
         inarr = ts(self.in_c2c_fwd,
                    dtype=fwd_dtype,
                    delta_t=delta_t,
                    epoch=self.epoch)
         delta_f = 1.0 / (delta_t * len(inarr))
         outexp = fs(self.out_c2c_fwd,
                     dtype=fwd_dtype,
                     delta_f=delta_f,
                     epoch=self.epoch)
         outexp *= delta_t
         _test_fft(self, inarr, outexp, self.tdict[fwd_dtype])
         # Random
         rand_inarr = ts(zeros(self.rand_len_c, dtype=fwd_dtype),
                         delta_t=delta_t,
                         epoch=self.epoch)
         delta_f = 1.0 / (delta_t * len(rand_inarr))
         rand_outarr = fs(zeros(self.rand_len_c, dtype=fwd_dtype),
                          delta_f=delta_f,
                          epoch=self.epoch)
         _test_random(self, rand_inarr, rand_outarr, self.tdict[fwd_dtype])
         # Reuse random arrays for the LAL tests:
         # COMMENTED OUT: The LAL Complex TimeFreqFFT and FreqTimeFFT functions perform
         # a repacking of data because they seem to assume that the array represents both
         # positive and negative frequencies.  We don't do this, so we don't compare.
         #_test_lal_tf_fft(self,rand_inarr,rand_outarr,self.tdict[fwd_dtype])
         # Clean these up since they could be big:
         del rand_inarr
         del rand_outarr
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_f": self.delta, "epoch": self.epoch}
         _test_raise_excep_fft(self, inarr, outexp, output_args)
Ejemplo n.º 17
0
 def test_rev_complex_fs(self):
     for rev_dtype in [complex64, complex128]:
         delta_f = self.delta
         # Don't do separate even/odd tests for complex
         inarr = fs(self.in_c2c_rev,
                    dtype=rev_dtype,
                    delta_f=delta_f,
                    epoch=self.epoch)
         delta_t = 1.0 / (delta_f * len(self.out_c2c_rev))
         outexp = ts(self.out_c2c_rev,
                     dtype=rev_dtype,
                     delta_t=delta_t,
                     epoch=self.epoch)
         outexp *= delta_f
         _test_ifft(self, inarr, outexp, self.tdict[rev_dtype])
         # Random---we don't do that in 'reverse' tests, since both
         # directions are already tested in forward, and if we just passed
         # in arrays in the other order we'd only get exceptions
         #
         # However, we do still generate the arrays for T/F series, so that we may
         # do the LAL comparison test.  As usual, we then delete those arrays.
         #
         # COMMENTED OUT: The LAL Complex TimeFreqFFT and FreqTimeFFT functions perform
         # a repacking of data because they seem to assume that the array represents both
         # positive and negative frequencies.  We don't do this, so we don't compare.
         #rand_inarr = fs(zeros(self.rand_len_c,dtype=rev_dtype),epoch=self.epoch,
         #                delta_f=self.delta)
         #rand_outarr = ts(zeros(self.rand_len_c,dtype=rev_dtype),epoch=self.epoch,
         #                 delta_t=self.delta)
         #_test_lal_tf_ifft(self,rand_inarr,rand_outarr,self.tdict[rev_dtype])
         #del rand_inarr
         #del rand_outarr
         #
         # Check that exceptions are raised.  Need input and
         # output arrays; just reuse inarr and outexp (values won't
         # matter, we're just checking exceptions).
         output_args = {"delta_t": self.delta, "epoch": self.epoch}
         _test_raise_excep_ifft(self, inarr, outexp, output_args)