Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.5.2_prerelease #67

Merged
merged 52 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0065806
0.5.2 init
wiheto Apr 22, 2020
76b1cdf
fixing shortest temporal path issues (issue #60)
wiheto Apr 22, 2020
c5c6f83
fixing nan issue about stp changes
wiheto Apr 23, 2020
0736b28
better checking of sidecar
wiheto Apr 24, 2020
bca6186
code quality pylint update
wiheto Apr 24, 2020
b1dd2eb
updating version
wiheto Apr 24, 2020
352b370
version/changelog/import order
wiheto Apr 24, 2020
d1d6820
adding missing comma
wiheto Apr 24, 2020
160e105
adding missing comma
wiheto Apr 24, 2020
880684e
cosemetic change
wiheto Apr 24, 2020
4a0d0e2
adding json import
wiheto Apr 24, 2020
8d15afc
changing imports to fix error
wiheto Apr 24, 2020
f592c5d
fixing problems with TemporalNetwork dataframes when starttime!=0
wiheto Apr 24, 2020
ec4d896
fixing doctest error on volatility
wiheto Apr 24, 2020
8d9b795
pylint fixes on documentatoin
wiheto Apr 24, 2020
200fe8e
more readable code
wiheto Apr 24, 2020
b961381
removing space
wiheto Apr 24, 2020
d7932b5
comments about possible failure
wiheto Apr 24, 2020
2dc5178
starttime df fixes
wiheto Apr 24, 2020
a262ae1
fixing int problem in df_to_array
wiheto Apr 24, 2020
97e43d2
fixing error from making code more readable
wiheto Apr 24, 2020
a61a364
fixing bug in shortest temporal path (path includes)
wiheto Apr 24, 2020
1b18718
shortest temporal path fix (dev-b)
wiheto Apr 24, 2020
e5db073
shortest temporal path fix.
wiheto Apr 24, 2020
7f4021c
minor changelog change resyncing coveralls
wiheto Apr 24, 2020
25efc50
travis yml update to resync coveralls
wiheto Apr 24, 2020
b258fce
JSONable check on inputparams not sidecar
wiheto Apr 25, 2020
9faa08d
json fix
wiheto Apr 25, 2020
8e3d106
json fix
wiheto Apr 25, 2020
30847e3
cleaning up file
wiheto Apr 30, 2020
536e889
changes
wiheto Apr 30, 2020
cf2fd59
more tests
wiheto Apr 30, 2020
3c9f9b9
adding tests for 3.7 and 3.8
wiheto Apr 30, 2020
0ec0283
adding tests for 3.7 and 3.8
wiheto Apr 30, 2020
1a98542
test check
wiheto Apr 30, 2020
dbb8f4d
sorting get_run_option output
wiheto Apr 30, 2020
c3f975f
test check
wiheto Apr 30, 2020
b9870b2
import fixes
wiheto May 12, 2020
35abca8
adding pybids back to import temporarily
wiheto May 12, 2020
eb575cc
import teneto if not imported
wiheto May 12, 2020
cabe460
importing importlibs
wiheto May 12, 2020
4bcd72a
changing imported module check to globals
wiheto May 12, 2020
1492df6
making checknetwork part of class
wiheto May 12, 2020
e873ec8
including set diagonal
wiheto May 12, 2020
f30efb5
conMat to conmat
wiheto May 12, 2020
d060da5
importing rdp
wiheto May 12, 2020
1fe804d
removing rel import of traj
wiheto May 12, 2020
9f06388
fixing tests from package moves
wiheto May 12, 2020
b106726
adding binarize
wiheto May 12, 2020
2143db6
utils fix
wiheto May 12, 2020
c0c2f56
missing comma
wiheto May 12, 2020
90fab6a
create traj range import
wiheto May 12, 2020
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
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ language: python
dist: xenial
python:
- "3.6"
- "3.6-dev" # 3.6 development branch
- "3.8-dev" # 3.6 development branch
- "3.7"
- "3.8"
# command to install dependencies
install:
- pip install -r requirements.txt
- python setup.py install
- pip install python-coveralls
- pip install coveralls
- pip install pytest
- pip install pytest-cov
- sudo apt-get -y install python3-pyqt5
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Changelog

## V0.5.1
## Version 0.5.2 (In development)

### 0.5.2 Improvements

Improved sidecar checking.

Added is_jsonable to utils.

### 0.5.2 Fixes

Fixes the issues when shortest paths were trying to be derived on non existent time points (raised in #60)

Fixing problem with df_to_array when time indices do not start at 0.

Fixing problem with dataframe netshape when starttime !=0 (#61)

coveralls resynced with travis (pip install python-coveralls replaced with pip install coveralls)

### 0.5.2 Changes

Removing wrong cased variables (e.g. netIN and TN from utils)

## Version 0.5.1

Expand Down
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from setuptools import setup, find_packages

version = "teneto/_version.py"
verstrline = open(version, "rt").read()
version = verstrline.split('"')[1]
VERSION = "teneto/_version.py"
VERSION = open(VERSION, "rt").read()
VERSION = VERSION.split('"')[1]

setup(name='teneto',
version=version,
version=VERSION,
python_requires='>3.5',
setup_requires=['pytest-runner'],
tests_require=['pytest'],
Expand All @@ -30,10 +30,8 @@
package_data={'': ['./teneto/data']},
include_package_data=True,
entry_points={
'console_scripts': ['teneto = teneto.__main__:main'
]
'console_scripts': ['teneto = teneto.__main__:main']
},
long_description='Temporal network tools. \
A package for deriving, analysing and plotting temporal network representations. \
Additional tools for temporal network analysis with neuroimaging contexts.'
)
Additional tools for temporal network analysis with neuroimaging contexts.')
4 changes: 2 additions & 2 deletions teneto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
__author__ = "WHT (wiheto @ github)"
#
from ._version import __version__
from .classes import TenetoBIDS, TemporalNetwork, TenetoWorkflow
from . import networkmeasures
from . import utils
from . import plot
from . import generatenetwork
from . import timeseries
Expand All @@ -17,7 +17,7 @@
from . import communitymeasures
from . import communitydetection
from . import neuroimagingtools
from .classes import TenetoBIDS, TemporalNetwork, TenetoWorkflow
from . import utils
#del misc.teneto
#del communitydetection.static.modularity_based_clustering
__all__ = ['__version__', 'utils', 'networkmeasures', 'plot', 'generatenetwork',
Expand Down
2 changes: 1 addition & 1 deletion teneto/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.1"
__version__ = "0.5.2-dev-c"
37 changes: 22 additions & 15 deletions teneto/classes/bids.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"""TenetoBIDS is a class which can be used to use Teneto functions with data organized with BIDS (neuroimaging data)."""
"""TenetoBIDS is a class to use Teneto functions with data organized with BIDS (neuroimaging data)."""
import os
import bids
import numpy as np
import inspect
import json
from ..neuroimagingtools import load_tabular_file, get_sidecar
import bids
import importlib
import numpy as np
import pandas as pd
from .. import __path__ as tenetopath
from .. import __version__ as tenetoversion
from ..neuroimagingtools import load_tabular_file, get_sidecar
from .network import TemporalNetwork
from teneto import __path__ as tenetopath
from teneto import __version__ as tenetoversion
import teneto


# @check_neuro_packages(bids)
class TenetoBIDS:
"""
Class for analysing data in BIDS.
Expand Down Expand Up @@ -141,7 +141,9 @@ def run(self, run_func, input_params, output_desc=None, output_pipeline_name=Non
"""
if exist_ok is not None:
self.exist_ok = exist_ok

# Import teneto if it has not been already
if 'teneto' not in globals():
teneto = importlib.import_module('teneto')
func = teneto
for f in self.tenetobids_structure[run_func]['module'].split('.'):
func = getattr(func, f)
Expand Down Expand Up @@ -244,16 +246,21 @@ def run(self, run_func, input_params, output_desc=None, output_pipeline_name=Non
input_params['confounds'] = 'Passed as argument'
if 'sidecar' in input_params:
input_params['sidecar'] = 'Loaded automatically via TenetoBIDS'
sidecar['TenetoFunction']['Parameters'] = input_params
# Loop through input params content and make any nparray input to list for sidecar
sidecar['TenetoFunction']['Parameters'] = {}
for key, value in input_params.items():
if not teneto.utils.is_jsonable(value):
if isinstance(input_params[key], np.ndarray):
sidecar['TenetoFunction']['Parameters'][key] = input_params[key].tolist()
else:
print('Warning: Dropping input (' + key + ') from sidecar (not JSONable).')
else:
sidecar['TenetoFunction']['Parameters'][key] = input_params[key]
elif functype == 'on_sidecar':
sidecar = func(**input_params)
update_pipeline = False
save_path = f.dirname + '/'
save_name = f.filename
# Loop through sidecar content and make any nparray input to list
for n in sidecar.keys():
if isinstance(sidecar[n], np.ndarray):
sidecar[n] = sidecar[n].tolist()
# Save sidecar
with open(save_path + save_name.replace('.tsv', '.json'), 'w') as f:
json.dump(sidecar, f)
Expand Down Expand Up @@ -318,7 +325,7 @@ def get_run_options(self, for_selected=True):
for su in suffix:
if su in s:
funcs_filter.append(t)
funcs = list(set(funcs_filter))
funcs = sorted(list(set(funcs_filter)))
return ', '.join(funcs)

def update_bids_filter(self, filter_addons):
Expand Down
Loading