diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..eab882c --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,10 @@ +comment: false + +coverage: + status: + project: + default: + target: 80% + patch: + default: + target: 50% \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afbfe74..3bb35b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - name: create and activate env uses: conda-incubator/setup-miniconda@v3 with: @@ -64,7 +63,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - name: create and activate env uses: conda-incubator/setup-miniconda@v3 with: diff --git a/mutis/lib/signal.py b/mutis/lib/signal.py index 0094d23..bbeedb6 100644 --- a/mutis/lib/signal.py +++ b/mutis/lib/signal.py @@ -152,8 +152,8 @@ def lc_gen_psd_nft(times, values): compute the power spectral density and to reconstruct the randomised signal.""" - k = np.arange(-times.size // 2, times.size / 2) - n = k.size + k = np.arange(-times.size / 2, times.size / 2) + n = 2* (k.size//2) nft = nfft.nfft_adjoint( (times - (times.max() + times.min()) / 2) / np.ptp(times), values, n, use_fft=True diff --git a/mutis/signal.py b/mutis/signal.py index 5a3b0d3..36dc465 100644 --- a/mutis/signal.py +++ b/mutis/signal.py @@ -51,15 +51,6 @@ class Signal: def __init__(self, times, values, dvalues=None, fgen=None): - if times.dtype is not np.float64: - log.warning('times.dtype not float64, which may cause erros when using numba, casting automatically.') - - if values.dtype is not np.float64: - log.warning('values.dtype not float64, which It may cause erros when using numba, casting automatically.') - - if dvalues.dtype is not np.float64: - log.warning('dvalues.dtype not float64, which may cause erros when using numba, casting automatically.') - self.times = np.array(times, dtype=np.float64) self.values = np.array(values, dtype=np.float64) self.fgen = fgen diff --git a/mutis/tests/test_bayblocks.py b/mutis/tests/test_bayblocks.py index f96c4c1..f1d1c01 100644 --- a/mutis/tests/test_bayblocks.py +++ b/mutis/tests/test_bayblocks.py @@ -4,13 +4,25 @@ from mutis import Signal def test_bayblocks(): + # test the bayblock algorithm with a signal that corresponds to 3 gaussian pulses in a row + t = np.linspace(0, 6, 50) y = np.exp(-(t-1)**2/0.1) + np.exp(-(t-3)**2/0.1) + np.exp(-(t-5)**2/0.1) dy = 0.1 * np.abs(y) + signal = Signal(t, y, dy) bayblocks = BayesianBlocks(signal, p=1e-1) + bayblocks.get_flares() + + # test that the signal and the bayblocks can be plotted bayblocks.signal.plot() bayblocks.plot() - assert len(bayblocks.get_flare_list()) == 3 \ No newline at end of file + + assert len(bayblocks.get_flare_list()) == 3 + + ## test that the flares can be plotted too + + for flare in bayblocks.get_flare_list(): + flare.plot() \ No newline at end of file