diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 00000000..038c20cd --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,35 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.5, 3.6, 3.7] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Install meegkit + run: | + pip install -e . + - name: Lint with flake8 + run: | + make pep + - name: Test with pytest + run: | + pytest --cov=meegkit --cov-report=xml tests/ + - name: Upload coverage to Codecov + # token: ${{secrets.CODECOV_TOKEN}} + run: bash <(curl -s https://codecov.io/bash) diff --git a/.travis.yml b/.travis.yml index b712e266..7dfb33ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,27 +11,9 @@ python: - "3.7" install: - sudo apt-get update - # We do this conditionally because it saves us some downloading if the - # version is the same. - - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then - wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; - else - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - fi - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - hash -r - - conda config --set always_yes yes --set changeps1 no - - conda update -q conda - - - export DISPLAY=:99.0 - - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset - # Useful for debugging any issues with conda - - conda info -a - - conda env create -f environment.yml - - source activate meegkit - - python setup.py develop + - pip install -r requirements.txt + - pip install -e . script: make pep -script: pytest --cov=meegkit tests/ -after_success: - - bash <(curl -s https://codecov.io/bash) +script: pytest tests/ --cov=meegkit --cov-report=xml +# after_success: +# - bash <(curl -s https://codecov.io/bash) diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 3c48147d..00000000 --- a/environment.yml +++ /dev/null @@ -1,21 +0,0 @@ -# run: conda env create --file environment.yml -name: meegkit -dependencies: -- python>=3.5 -- pip -- numpy -- scipy -- matplotlib -- scikit-learn -- sphinx -- joblib -- numpydoc -- flake8 -- pip: - - pytest - - pytest-cov - - codecov - - codespell - - pydocstyle - - sphinx-gallery - - tqdm diff --git a/meegkit/utils/sig.py b/meegkit/utils/sig.py index 20cec6a8..4182ee33 100644 --- a/meegkit/utils/sig.py +++ b/meegkit/utils/sig.py @@ -1,3 +1,4 @@ +# coding: utf-8 """Signal processing tools.""" from __future__ import absolute_import, division, print_function @@ -53,10 +54,13 @@ def modulation_index(phase, amp, n_bins=18): time series can be constructed by cutting the amplitude time series at a random time point and reversing the order of both parts [2]_. The observed coupling value is standardized to the distribution of the shuffled coupling - values according to the following formula: MI_z = (MI_observed − - µ_MI_shuffled) / σ_MI_shuffled, where μ denotes the mean and σ the standard - deviation. Only when the observed phase-locking value is larger than 95 % - of shuffled values, it is defined as significant. See [2]_ for details. + values according to the following formula: + + MI_z = (MI_observed − µ_MI_shuffled) / σ_MI_shuffled + + where μ denotes the mean and σ the standard deviation. Only when the + observed phase-locking value is larger than 95 % of shuffled values, it is + defined as significant. See [2]_ for details. References ---------- diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..9ffbbc83 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +numpy +scipy +matplotlib +scikit-learn +sphinx +joblib +numpydoc +flake8 +pytest +pytest-cov +codecov +codespell +pydocstyle +tqdm