Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pantaray committed Apr 13, 2022
2 parents 91d81bf + 610d5e3 commit 2f9094e
Show file tree
Hide file tree
Showing 99 changed files with 5,974 additions and 4,146 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/cov_test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run tests and determine coverage

on:
# Triggers the workflow on push or pull request events
push:
branches:
- master
- dev
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install SyNCoPy
run: |
pip install -e .[dev]
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and get coverage
run: |
cd syncopy/tests
pytest --color=yes --tb=short --verbose --cov=../../syncopy --cov-config=../../.coveragerc --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
name: syncopy-codecov
verbose: true
13 changes: 12 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ stages:
- upload
- deploy

variables:
TEST_DIR: "$CI_PROJECT_DIR/syncopy/tests"

intellinux:
stage: tox
allow_failure: true
Expand All @@ -19,6 +22,7 @@ intellinux:
script:
- rm -rf ~/.spy
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda clean --all -y
- conda env update -f syncopy.yml --prune
- conda activate syncopy
- tox -p 0
Expand All @@ -37,6 +41,7 @@ powerlinux:
script:
- rm -rf ~/.spy
- source /opt/conda/etc/profile.d/conda.sh
- conda clean --all -y
- conda env update -f syncopy.yml --prune
- conda activate syncopy
- tox -p 0
Expand All @@ -53,6 +58,7 @@ intelwin:
PYTEST_ADDOPTS: "--color=yes --tb=short --verbose"
GIT_FETCH_EXTRA_FLAGS: --tags
script:
- conda clean --all -y
- conda env update -f syncopy.yml --prune
- conda.bat activate syncopy
- tox
Expand All @@ -72,6 +78,7 @@ m1macos:
- ulimit -n 25000
- rm -rf ~/.spy
- source /opt/conda/etc/profile.d/conda.sh
- conda clean --all -y
- conda env update -f syncopy.yml --prune
- conda activate syncopy
- tox -p 0
Expand All @@ -92,7 +99,9 @@ slurmtest:
- conda env update -f syncopy.yml --prune
- conda activate syncopy
- export PYTHONPATH=$CI_PROJECT_DIR
- srun -p DEV --mem=8000m -c 4 pytest
- srun -p DEV --mem=8000m -c 4 pytest --full $TEST_DIR/test_specest.py
- srun -p DEV --mem=8000m -c 4 pytest --full $TEST_DIR/test_connectivity.py
- srun -p DEV --mem=8000m -c 4 pytest --full --ignore=$TEST_DIR/test_specest.py --ignore=$TEST_DIR/test_connectivity.py

pypitest:
stage: upload
Expand All @@ -106,6 +115,7 @@ pypitest:
script:
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda update --yes conda
- conda clean --all -y
- conda env update -f syncopy.yml --prune
- conda activate syncopy
- conda install --yes twine keyring rfc3986
Expand Down Expand Up @@ -136,6 +146,7 @@ pypideploy:
script:
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda update --yes conda
- conda clean --all -y
- conda env update -f syncopy.yml --prune
- conda activate syncopy
- conda install --yes twine keyring rfc3986
Expand Down
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

58 changes: 57 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,63 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.2] - 2022-01-18
## [v0.21] - 2022-04-13
Feature update and bugfixes.

### NEW
- Added preprocessing functionality
- Added experimental loading functionality for NWB 2.0 files
- Added experimental loading functionality for Matlab mat files
- Added support for "scalar" selections, i.e., things like `selectdata(trials=0)`
or `data.selectdata(channels='mychannel')`
- Added command line argument "--full" for more granular testing: the new default
for running the testing pipeline is to execute a trimmed-down testing suite that
does not probe all possible input permutations but focuses on the core functionality
without sacrificing coverage.
- New meta-function `taper_opt` parameter to control arbitrary taper (e.g. kaiser)
parameters

### CHANGED
- Renamed `_selection` class property to `selection`
- Reworked plotting framework and made it matplotlib 3.5 compatible
- The output of `show` is now automatically squeezed (i.e., singleton dimensions
are removed from the returned array).
- Enhanced online documentation, now also covering connectivity analysis
- Multi-tapering (`freqanalysis`, `connectivityanalysis`) now is switched on by
only specifying the `tapsmofrq` parameter, removed the need for the additional
and redundant setting of `taper='dpss'`
- Granger-Geweke algorithm now matches the reference implementation (Dhamala 2008)
with machine precision

### REMOVED
- Do not parse scalars using `numbers.Number`, use `numpy.number` instead to
catch Boolean values
- Do not raise a `SPYTypeError` if an arithmetic operation is performed using
objects of different numerical types (real/complex; closes #199)

### DEPRECATED
- Removed loading code for ESI binary format that is no longer supported
- Repaired top-level imports: renamed `connectivity` to `connectivityanalysis`
and the "connectivity" module is now called "nwanalysis"
- Included `conda clean` in CD pipeline to avoid disk fillup by unused conda
packages/cache
- Inverted `selectdata` messaging policy: only actual on-disk copy operations
trigger a `SPYInfo` message (closes #197)
- Matched selector keywords and class attribute names, i.e., selecting channels
is now done by using a `select` dictionary with key `'channel'` (not `'channels'`
as before). See the documentation of `selectdata` for details.
- Retired Travis CI tests since free test runs are exhausted. Migrated to GitHub
actions (and re-included codecov)

### FIXED
- The `trialdefinition` arrays constructed by the `Selector` class were incorrect
for `SpectralData` objects without time-axis, resulting in "empty" trials. This
has been fixed (closes #207)
- Repaired `array_parser` to adequately complain about mixed-type arrays (closes #211)
- The `show` routine now consistently returns a list of trials if and only if
multiple trials are selected

## [v0.20] - 2022-01-18
Major Release

### NEW
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ exclude .gitignore
exclude .gitlab-ci.yml
exclude MANIFEST.in
exclude .readthedocs.yml
exclude .travis.yml
recursive-exclude .github *
recursive-exclude doc *
18 changes: 16 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,25 @@ Systems Neuroscience Computing in Python
|Conda Version| |PyPi Version| |License|

.. |Conda Version| image:: https://img.shields.io/conda/vn/conda-forge/esi-syncopy.svg
:target: https://anaconda.org/conda-forge/esi-syncopy
.. |PyPI version| image:: https://badge.fury.io/py/esi-syncopy.svg
:target: https://anaconda.org/conda-forge/esi-syncopy
.. |PyPI version| image:: https://badge.fury.io/py/esi-syncopy.svg
:target: https://badge.fury.io/py/esi-syncopy
.. |License| image:: https://img.shields.io/github/license/esi-neuroscience/syncopy

master branch status: |Master Tests| |Master Coverage|

.. |Master Tests| image:: https://github.com/esi-neuroscience/syncopy/actions/workflows/cov_test_workflow.yml/badge.svg?branch=master
:target: https://github.com/esi-neuroscience/syncopy/actions/workflows/cov_test_workflow.yml
.. |Master Coverage| image:: https://codecov.io/gh/esi-neuroscience/syncopy/branch/master/graph/badge.svg?token=JEI3QQGNBQ
:target: https://codecov.io/gh/esi-neuroscience/syncopy

dev branch status: |Dev Tests| |Dev Coverage|

.. |Dev Tests| image:: https://github.com/esi-neuroscience/syncopy/actions/workflows/cov_test_workflow.yml/badge.svg?branch=dev
:target: https://github.com/esi-neuroscience/syncopy/actions/workflows/cov_test_workflow.yml
.. |Dev Coverage| image:: https://codecov.io/gh/esi-neuroscience/syncopy/branch/dev/graph/badge.svg?token=JEI3QQGNBQ
:target: https://codecov.io/gh/esi-neuroscience/syncopy

Syncopy aims to be a user-friendly toolkit for *large-scale*
electrophysiology data-analysis in Python. We strive to achieve the following goals:

Expand Down
10 changes: 10 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# (Online-) Documentation

## Build Requirements

Install (debian based packages):
- `sphinx-common`
- `python3-sphinx-bootstrap-theme`

then run `make html` from this folder
23 changes: 13 additions & 10 deletions doc/source/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ We strive to achieve the following goals:

Getting Started
---------------
Our :doc:`Quickstart Guide <quickstart>` covers installation and basic usage.
More in-depth information relevant to Syncopy users can be found in our
:doc:`User Guide <user/users>`. Want to contribute or just curious how the sausage
is made? Take a look at our :doc:`Developer Guide <developer/developers>`. Once again
in order of brevity:
- Prerequisites: :doc:`Install Syncopy </setup>`
- Jumping right in: :doc:`Quickstart Guide <quickstart/quickstart>`

* :doc:`Quickstart Guide <quickstart>`
* :doc:`User Guide <user/users>`
* :doc:`Developer Guide <developer/developers>`
Want to contribute or just curious how the sausage
is made? Take a look at our :doc:`Developer Guide <developer/developers>`.


In depth Guides and Tutorials
-----------------------------
* :doc:`General User Guide <user/users>`

Navigation
----------
Expand All @@ -50,6 +51,8 @@ For general inquiries please contact syncopy (at) esi-frankfurt.de.
.. toctree::
:hidden:

quickstart
user/users.rst
quickstart/quickstart.rst
setup
user/users.rst
user/user_api.rst
developer/developers.rst
8 changes: 7 additions & 1 deletion doc/source/_static/esi-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ a.reference.external{

p.rubric {
font-size: 16px;
}
}

p {
font-size: 1.1em
}


8 changes: 5 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

project = 'Syncopy'
copyright = '2020, Joscha Schmiedt and Stefan Fuertinger'
author = 'Joscha Schmiedt and Stefan Fuertinger'
author = 'Joscha Schmiedt, Stefan Fuertinger and Gregor Mönke'

# The short X.Y version
version = syncopy.__version__
Expand Down Expand Up @@ -129,7 +129,9 @@ def setup(app):
# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 2,
'bootswatch_theme': "lumen",
# Currently, the supported themes are:
# - Bootstrap 3: https://bootswatch.com/3
'bootswatch_theme': "simplex",
'navbar_links': [
("GitHub", "https://www.github.com/esi-neuroscience/syncopy", True),
],
Expand Down Expand Up @@ -195,7 +197,7 @@ def setup(app):
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Syncopy.tex', 'Syncopy Documentation',
'Gregor Moenke, Joscha Schmiedt and Stefan Fuertinger', 'manual'),
'Gregor Mönke, Joscha Schmiedt and Stefan Fuertinger', 'manual'),
]


Expand Down
Binary file added doc/source/quickstart/ar2_coh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/quickstart/ar2_corr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/quickstart/ar2_granger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions doc/source/quickstart/ar2_nw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import numpy as np
import syncopy as spy
from syncopy.tests import synth_data

nTrials = 50
nSamples = 1500
trls = []
# 2x2 Adjacency matrix to define coupling
AdjMat = np.zeros((2, 2))
# coupling 0 -> 1
AdjMat[0, 1] = 0.2

for _ in range(nTrials):

trl = synth_data.AR2_network(AdjMat, nSamples=nSamples)
trls.append(trl)

data = spy.AnalogData(trls, samplerate=500)
spec = spy.freqanalysis(data, tapsmofrq=3, keeptrials=False)
Binary file added doc/source/quickstart/ar2_signals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/quickstart/ar2_specs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions doc/source/quickstart/damped_harm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import numpy as np
import syncopy as spy


nTrials = 50
nSamples = 1000
nChannels = 2
samplerate = 500 # in Hz

# the sampling times vector needed for construction
tvec = np.arange(nSamples) * 1 / samplerate
# the 30Hz harmonic
harm = np.cos(2 * np.pi * 30 * tvec)
# dampening down to 10% of the original amplitude
dampening = np.linspace(1, 0.1, nSamples)
signal = dampening * harm

# collect trials
trials = []
for _ in range(nTrials):

# start with the noise
trial = np.random.randn(nSamples, nChannels)
# now add the damped harmonic on the 1st channel
trial[:, 0] += signal
trials.append(trial)

# instantiate Syncopy data object
data = spy.AnalogData(trials, samplerate=samplerate)
Binary file added doc/source/quickstart/damped_signals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/quickstart/mtmfft_spec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2f9094e

Please sign in to comment.