Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up
- name: Test suite
run: |
wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.9.2-0-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source $HOME/miniconda/etc/profile.d/conda.sh

echo
echo ************************************
echo "************************************"
echo ----------Conda Installed-----------
echo ************************************
echo "************************************"
echo

source setup.sh

echo
echo ************************************
echo "************************************"
echo ---------------test-----------------
echo ************************************
echo
echo "************************************"
echo

PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci python -m pytest -v

2 changes: 2 additions & 0 deletions packs/temporal_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_dummy():
pass
Empty file added packs/tools/__init__.py
Empty file.
24 changes: 24 additions & 0 deletions packs/tools/fit_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import numpy as np
import scipy.stats as scs


def finger_signal(xs : np.array,
Comment thread
jwaiton marked this conversation as resolved.
bl : float ,
amp : float ,
gain : float ,
sigmabl : float ,
sigmaq : float ,
poismu : float ,
maxpercent : float = 0.999
) -> np.array:
poispeaks_pos = np.arange(0, scs.poisson.ppf(maxpercent, 1))
realpeaks_pos = gain * poispeaks_pos + bl
realpeaks_amp = amp * scs.poisson.pmf(poispeaks_pos, poismu)
result = np.zeros_like(xs)

result += realpeaks_amp[0] * scs.norm.pdf(xs, loc=realpeaks_pos[0], scale=sigmabl)

for i in range(1, len(poispeaks_pos)):
result += realpeaks_amp[i] * scs.norm.pdf(xs, loc=realpeaks_pos[i],
scale=np.sqrt(sigmabl**2 + sigmaq**2 * i))
return result
19 changes: 19 additions & 0 deletions packs/tools/fit_functions_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import numpy as np
import scipy.stats as scs

from . fit_functions import finger_signal

from hypothesis import given
from hypothesis.strategies import floats

@given(floats(min_value = -10, max_value = 10),
floats(min_value = -500, max_value = 500),
floats(min_value = 1, max_value = 2),
floats(min_value = 0, max_value = 200))
def test_finger_signal_gaus_when_poisson_zero(bl, gain, sbl, sq):
Comment thread
jwaiton marked this conversation as resolved.
xaux = np.linspace(-10, 10, 1000)
yres = finger_signal(xaux, bl, 1, gain, sbl, sq, 0)
ygau = scs.norm.pdf(xaux, loc=bl, scale=sbl)

assert np.array_equal(yres, ygau)