-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #690 from abhi-glitchhg/pyzenodo
Update TVB-1999-deo branch
- Loading branch information
Showing
19 changed files
with
139 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
install_requires=CONTRIB_DEPENDENCIES, | ||
description='A package with TVB contributed additions to the simulator, useful for scripting.', | ||
long_description=DESCRIPTION, | ||
long_description_content_type="text/x-rst", | ||
license="GPL-3.0-or-later", | ||
author=TEAM, | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,12 +40,18 @@ | |
install_requires=["tvb-library"], | ||
description='This namespace is only redirecting to tvb-library', | ||
long_description=DESCRIPTION, | ||
long_description_content_type="text/x-rst", | ||
license="GPL-3.0-or-later", | ||
author=TVB_TEAM, | ||
author_email='[email protected]', | ||
url='https://www.thevirtualbrain.org', | ||
download_url='https://github.com/the-virtual-brain/tvb-root', | ||
keywords='tvb brain simulator neuroscience human animal neuronal dynamics models delay' | ||
keywords='tvb brain simulator neuroscience human animal neuronal dynamics models delay', | ||
classifiers=["Development Status :: 6 - Mature", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", | ||
"Programming Language :: Python :: 3" | ||
] | ||
) | ||
|
||
# Cleanup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 0 additions & 117 deletions
117
tvb_documentation/demos/display_surface_local_connectivity.ipynb
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file removed
BIN
-111 KB
tvb_documentation/demos/figures/display_surface_local_connectivity.png
Binary file not shown.
Binary file modified
BIN
+81.8 KB
(380%)
tvb_documentation/demos/figures/exploring_a_surface_mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,12 +64,19 @@ | |
'test': ["pytest", "pytest-benchmark", "pytest-mock", "BeautifulSoup4"]}, | ||
description='A package for performing whole brain simulations', | ||
long_description=DESCRIPTION, | ||
long_description_content_type="text/x-rst", | ||
license="GPL-3.0-or-later", | ||
author=TVB_TEAM, | ||
author_email='[email protected]', | ||
url='https://www.thevirtualbrain.org', | ||
download_url='https://github.com/the-virtual-brain/tvb-root', | ||
keywords='tvb brain simulator neuroscience human animal neuronal dynamics models delay') | ||
keywords='tvb brain simulator neuroscience human animal neuronal dynamics models delay', | ||
classifiers=["Development Status :: 6 - Mature", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", | ||
"Programming Language :: Python :: 3" | ||
] | ||
) | ||
|
||
# Clean after install | ||
shutil.rmtree('tvb_framework.egg-info', True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,18 +50,19 @@ | |
version=VERSION, | ||
packages=setuptools.find_packages( | ||
exclude=['tvb.interfaces.web', 'tvb.interfaces.web.*', 'tvb.interfaces.command', | ||
'tvb.interfaces.command.*', 'tvb.tests', 'tvb.tests.*', 'tvb.interfaces.rest' | ||
'tvb.interfaces.command.*', 'tvb.tests', 'tvb.tests.*', 'tvb.interfaces.rest', | ||
'tvb.interfaces.rest.*', 'tvb.adapters', 'tvb.adapters.*', 'tvb.core', | ||
'tvb.core.*']), | ||
include_package_data=True, | ||
install_requires=TVB_INSTALL_REQUIREMENTS, | ||
extras_require={'test': ["pytest", "pytest-benchmark"]}, | ||
description='A helper package containing BIDS directory monitor module', | ||
long_description=DESCRIPTION, | ||
long_description_content_type="text/x-rst", | ||
license="GPL-3.0-or-later", | ||
author=TVB_TEAM, | ||
author_email='[email protected]', | ||
url='http://www.thevirtualbrain.org', | ||
url='https://www.thevirtualbrain.org', | ||
download_url='https://github.com/the-virtual-brain/tvb-root', | ||
keywords='tvb rest client brain simulator neuroscience human animal neuronal dynamics models delay') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ | |
'test': ["pytest", "pytest-benchmark"]}, | ||
description='A helper package for preparing and sending requests towards the TVB REST API', | ||
long_description=DESCRIPTION, | ||
long_description_content_type="text/x-rst", | ||
license="GPL-3.0-or-later", | ||
author=TVB_TEAM, | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,12 +42,11 @@ | |
LIBRARY_REQUIRED_PACKAGES = ["autopep8", "Deprecated", "docutils", "ipywidgets", "lxml", "mako>=1.1.4", "matplotlib", | ||
"networkx", "numba", "numexpr", "numpy", "pooch", "pylems", "scipy", "six"] | ||
|
||
LIBRARY_REQUIRED_EXTRA = ["h5py", "pytest", "pytest-benchmark", "pytest-xdist", "tvb-gdist", "tvb-data"] | ||
LIBRARY_REQUIRED_EXTRA = ["h5py", "pytest", "pytest-benchmark", "pytest-xdist", "tvb-gdist", "tvb-data"] | ||
|
||
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as fd: | ||
DESCRIPTION = fd.read() | ||
|
||
|
||
setuptools.setup(name='tvb-library', | ||
version=LIBRARY_VERSION, | ||
packages=setuptools.find_packages(), | ||
|
@@ -56,12 +55,19 @@ | |
extras_require={"test": LIBRARY_REQUIRED_EXTRA}, | ||
description='A package for performing whole brain simulations', | ||
long_description=DESCRIPTION, | ||
long_description_content_type="text/x-rst", | ||
license="GPL-3.0-or-later", | ||
author=LIBRARY_TEAM, | ||
author_email='[email protected]', | ||
url='https://www.thevirtualbrain.org', | ||
download_url='https://github.com/the-virtual-brain/tvb-root', | ||
keywords='tvb brain simulator neuroscience human animal neuronal dynamics models delay') | ||
keywords='tvb brain simulator neuroscience human animal neuronal dynamics models delay', | ||
classifiers=["Development Status :: 6 - Mature", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", | ||
"Programming Language :: Python :: 3" | ||
] | ||
) | ||
|
||
# Cleanup after EGG install. These are created by running setup.py in the source tree | ||
shutil.rmtree('tvb_library.egg-info', True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,6 @@ | |
.. moduleauthor:: Abhijit Deo <[email protected]> | ||
""" | ||
|
||
import os | ||
import requests | ||
import json | ||
|
||
|
@@ -77,7 +76,7 @@ def __init__(self, version : str= "2.7", extract_dir : str = None): | |
|
||
self.rec = Record(self._read_cached_response()[self.version]) | ||
|
||
def _fetch_data(self, file_name): | ||
def fetch_data(self, file_name:str)->str: | ||
""" | ||
Function to fetch the file having `file_name` as name of the file. The function checks if the dataset is downloaded or not. If not, function downloads the dataset and then extracts/unzip the file. | ||
|
@@ -89,7 +88,10 @@ def _fetch_data(self, file_name): | |
returns: str | ||
path of the extracted/Unzipped file. | ||
""" | ||
|
||
if Path(file_name).is_absolute(): | ||
self.log.warning("Given `file_name` is an absolute path. No operations are done. The `file_name` is returned as it is") | ||
return file_name | ||
|
||
extract_dir = self.extract_dir | ||
|
||
try: | ||
|
@@ -128,35 +130,20 @@ def _fetch_data(self, file_name): | |
file_name should be one of the following paths: {self.files_in_zip_dict[file_name]}""") | ||
raise NameError(f"file name should be one of the {self.files_in_zip_dict[file_name]}, but got {file_name}") | ||
|
||
def describe(self): | ||
def describe(self)-> str: | ||
""" | ||
Returns the project description mentioned on the zenodo website. | ||
""" | ||
return self.rec.describe() | ||
|
||
def get_recordid(self): | ||
def get_recordid(self) -> str: | ||
""" | ||
returns record id of the dataset | ||
""" | ||
return self.recid | ||
|
||
def fetch_all_data(self): | ||
|
||
if self.files_in_zip_dict == None: | ||
self._download(path = self.cached_dir, fname=f"tvb_data_{self.version}.zip") | ||
self.files_in_zip_dict = self._read_zipfile_structure(self.rec.file_loc['tvb_data.zip']) | ||
|
||
|
||
for file_paths in self.files_in_zip_dict.values(): | ||
for file_path in file_paths: | ||
self.fetch_data(file_path) | ||
|
||
if self.extract_dir.is_absolute(): | ||
return str(self.extract_dir) | ||
return str(Path.cwd()/self.extract_dir) | ||
|
||
|
||
def delete_data(self): | ||
def delete_data(self)->None: | ||
""" | ||
Deletes the `tvb_data` folder in the `self.extract_dir` directory. | ||
""" | ||
|
@@ -218,3 +205,20 @@ def _read_cached_response(self): | |
|
||
responses = dict(responses) | ||
return responses | ||
|
||
def _read_zipfile_structure(self, file_path): | ||
""" | ||
Reads the zipfile structure and returns the dictionary containing file_names as keys and list of relative paths having same file name. | ||
""" | ||
with ZipFile(file_path) as zf: | ||
file_names_in_zip = zf.namelist() | ||
zf.close() | ||
|
||
file_names_dict = {} | ||
for i in file_names_in_zip: | ||
if str(Path(i).name) not in file_names_dict.keys(): | ||
file_names_dict[str(Path(i).name)] = [i] | ||
else: | ||
file_names_dict[str(Path(i).name)].append(i) | ||
return file_names_dict | ||
|
Oops, something went wrong.