Skip to content

Commit

Permalink
Merge pull request #171 from esi-neuroscience/coherence
Browse files Browse the repository at this point in the history
Coherence, big one
  • Loading branch information
pantaray authored Dec 17, 2021
2 parents 1f5972f + e4409b5 commit 9af9d5a
Show file tree
Hide file tree
Showing 46 changed files with 5,046 additions and 1,529 deletions.
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[run]
branch = True
source = syncopy

[report]
exclude_lines =
if self.debug:
if debug:
raise NotImplementedError
if __name__ == .__main__.:
ignore_errors = True
omit =
syncopy/tests/*
*conda2pip.py
*setup.py
test_*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ requirements-test.txt

# Editor-related stuff
.vscode

# Mac OS related stuff
.DS_Store
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ python:

cache: pip

# safelist
branches:
only:
- master
Expand All @@ -16,6 +15,9 @@ install:
- pip install -r requirements.txt
- pip install -r requirements-test.txt
- python setup.py -q install
# command to run tests

script:
- pytest -v
- pytest -v --cov=./

after_success:
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage:
status:
project:
default:
# Allow coverage to drop `threshold` percent in PRs to master/dev
target: auto
threshold: 5%
base: auto
branches:
- master
- dev
if_ci_failed: error #success, failure, error, ignore
informational: false
only_pulls: true
62 changes: 62 additions & 0 deletions dev_frontend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import numpy as np
import scipy.signal as sci

from syncopy.datatype import CrossSpectralData, padding, SpectralData, AnalogData
from syncopy.connectivity.ST_compRoutines import cross_spectra_cF, ST_CrossSpectra
from syncopy.connectivity.ST_compRoutines import cross_covariance_cF
from syncopy.connectivity import connectivity
from syncopy.specest import freqanalysis
import matplotlib.pyplot as ppl

from syncopy.shared.parsers import data_parser, scalar_parser, array_parser
from syncopy.shared.tools import get_defaults
from syncopy.datatype import SpectralData, padding

from syncopy.tests.misc import generate_artificial_data
tdat = generate_artificial_data(inmemory=True, seed=1230, nTrials=50, nChannels=5)

foilim = [1, 30]
# this still gives type(tsel) = slice :)
sdict1 = {"trials": [0], 'channels' : ['channel1'], 'toi': np.arange(-1, 1, 0.001)}

coherence = connectivity(data=tdat,
foilim=None,
output='pow',
taper='dpss',
tapsmofrq=5,
foo = 3, # non-sensical
keeptrials=False)

granger = connectivity(data=tdat,
method='granger',
foilim=[0, 50],
output='pow',
taper='dpss',
tapsmofrq=5,
keeptrials=False)

# D = SpectralData(dimord=['freq','test1','test2','taper'])
# D2 = AnalogData(dimord=['freq','test1'])

# a lot of problems here..
# correlation = connectivity(data=tdat, method='corr', keeptrials=False, taper='df')


# the hard wired dimord of the cF

res = freqanalysis(data=tdat,
method='mtmfft',
samplerate=tdat.samplerate,
# order_max=20,
# foilim=foilim,
# foi=np.arange(502),
output='pow',
# polyremoval=1,
t_ftimwin=0.5,
keeptrials=True,
taper='dpss',
nTaper = 19,
tapsmofrq=5,
keeptapers=True,
parallel=False, # try this!!!!!!
select={"trials" : [0,1]})
9 changes: 5 additions & 4 deletions doc/source/user/data_handling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ Reading and writing data with Syncopy
syncopy.load
syncopy.save

Functions for Editing Syncopy Data Objects
-------------------------------------------
Defining trials, data selection and padding.
Functions for Inspecting/Editing Syncopy Data Objects
-----------------------------------------------------
Defining trials, data selection and padding.

.. autosummary::

syncopy.definetrial
syncopy.show
syncopy.selectdata
syncopy.padding

Advanced Topics
---------------
More information about Syncopy's data class structure and file format.
More information about Syncopy's data class structure and file format.

.. toctree::

Expand Down
4 changes: 2 additions & 2 deletions syncopy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- python >= 3.8, < 3.9
- pip
- numpy >= 1.10, < 2.0
- scipy >= 1.5, < 1.6
- scipy >= 1.5
- h5py >= 2.9, < 3
- matplotlib >= 3.3, < 3.5
- tqdm >= 4.31
Expand All @@ -18,7 +18,7 @@ dependencies:
- memory_profiler
- numpydoc
- sphinx_bootstrap_theme
- pytest
- pytest-cov
- pylint
- ipdb
- tox
Expand Down
Loading

0 comments on commit 9af9d5a

Please sign in to comment.