def test_classical_significances_trial_correction(self):
     ps = Powerspectrum(lc=self.lc, norm="leahy")
     # change the powers so that just one exceeds the threshold
     ps.power = np.zeros_like(ps.power) + 2.0
     index = 1
     ps.power[index] = 10.0
     threshold = 0.01
     pval = ps.classical_significances(threshold=threshold,
                                       trial_correction=True)
     assert np.size(pval) == 0
示例#2
0
 def test_classical_significances_trial_correction(self):
     ps = Powerspectrum(lc=self.lc, norm="leahy")
     # change the powers so that just one exceeds the threshold
     ps.power = np.zeros_like(ps.power) + 2.0
     index = 1
     ps.power[index] = 10.0
     threshold = 0.01
     pval = ps.classical_significances(threshold=threshold,
                                       trial_correction=True)
     assert np.size(pval) == 0
示例#3
0
    def test_pvals_is_numpy_array(self):
        ps = Powerspectrum(lc=self.lc, norm="leahy")
        # change the powers so that just one exceeds the threshold
        ps.power = np.zeros_like(ps.power) + 2.0

        index = 1
        ps.power[index] = 10.0

        threshold = 1.0

        pval = ps.classical_significances(threshold=threshold,
                                          trial_correction=True)

        assert isinstance(pval, np.ndarray)
        assert pval.shape[0] == 2
示例#4
0
    def test_classical_significances_threshold(self):
        ps = Powerspectrum(lc = self.lc, norm="leahy")

        ## change the powers so that just one exceeds the threshold
        ps.ps = np.zeros(ps.ps.shape[0])+2.0

        index = 1
        ps.ps[index] = 10.0

        threshold = 0.01

        pval = ps.classical_significances(threshold=threshold,
                                          trial_correction=False)
        assert pval[0,0] < threshold
        assert pval[1,0] == index
    def test_pvals_is_numpy_array(self):
        ps = Powerspectrum(lc=self.lc, norm="leahy")
        # change the powers so that just one exceeds the threshold
        ps.power = np.zeros_like(ps.power) + 2.0

        index = 1
        ps.power[index] = 10.0

        threshold = 1.0

        pval = ps.classical_significances(threshold=threshold,
                                          trial_correction=True)

        assert isinstance(pval, np.ndarray)
        assert pval.shape[0] == 2
    def test_classical_significances_threshold(self):
        ps = Powerspectrum(lc=self.lc, norm="leahy")

        # change the powers so that just one exceeds the threshold
        ps.ps = np.zeros(ps.ps.shape[0])+2.0

        index = 1
        ps.ps[index] = 10.0

        threshold = 0.01

        pval = ps.classical_significances(threshold=threshold,
                                          trial_correction=False)
        assert pval[0, 0] < threshold
        assert pval[1, 0] == index
示例#7
0
 def test_classical_significances_fails_in_rms(self):
     ps = Powerspectrum(lc=self.lc, norm="frac")
     with pytest.raises(ValueError):
         ps.classical_significances()
示例#8
0
 def test_classical_significances_runs(self):
     ps = Powerspectrum(lc=self.lc, norm="Leahy")
     ps.classical_significances()
示例#9
0
 def test_classical_significances_fails_in_rms(self):
     ps = Powerspectrum(lc = self.lc, norm="rms")
     ps.classical_significances()
示例#10
0
 def test_classical_significances_fails_in_rms(self):
     ps = Powerspectrum(lc=self.lc, norm="frac")
     with pytest.raises(ValueError):
         ps.classical_significances()
示例#11
0
 def test_classical_significances_runs(self):
     ps = Powerspectrum(lc=self.lc, norm="Leahy")
     ps.classical_significances()
 def test_classical_significances_fails_in_rms(self):
     ps = Powerspectrum(lc=self.lc, norm="rms")
     ps.classical_significances()