Skip to content

Commit

Permalink
Merge pull request #146 from liuzhenqi77/improvements
Browse files Browse the repository at this point in the history
Various improvements again
  • Loading branch information
VinceBaz authored Jan 27, 2025
2 parents 107e2fe + 0e0a51b commit 7a0fd19
Show file tree
Hide file tree
Showing 31 changed files with 2,188 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: netneurotools-docs
on:
workflow_dispatch:
push:
branches:
branches:
- main

permissions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Install netneurotools
run: |
python -m pip install --upgrade pip
python -m pip install '.[test]'
python -m pip install '.[test,numba]'
- name: Print netneurotools version
run: python -c "import netneurotools; print(netneurotools.__version__)"
- name: Run tests
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests-plotting-pyvista.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
- main
paths:
- 'netneurotools/plotting/pyvista_plotters.py'
- 'netneurotools/plotting/tests/test_pyvista.py'
pull_request:
branches:
- main
paths:
- 'netneurotools/plotting/pyvista_plotters.py'
- 'netneurotools/plotting/tests/test_pyvista.py'

jobs:
run_pyvista_tests:
Expand Down
53 changes: 44 additions & 9 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ To download templates
:template: function.rst
:toctree: generated/


fetch_fsaverage
fetch_fsaverage_curated
fetch_hcp_standards
Expand All @@ -45,7 +44,7 @@ To download atlases
fetch_schaefer2018
fetch_mmpall
fetch_pauli2018
fetch_ye2020
fetch_tian2020msa
fetch_voneconomo

To download project-related data
Expand Down Expand Up @@ -188,7 +187,8 @@ Brain network metrics
diffusion_efficiency
resource_efficiency_bin
flow_graph
assortativity
assortativity_und
assortativity_dir
matching_ind_und
rich_feeder_peripheral

Expand All @@ -207,14 +207,11 @@ Statistical network metrics
:toctree: generated/

network_pearsonr
network_pearsonr_numba
network_pearsonr_pairwise
effective_resistance
network_polarisation
network_variance
network_variance_numba
network_covariance
network_covariance_numba


.. _ref_modularity:
Expand Down Expand Up @@ -295,31 +292,69 @@ Regressions

.. currentmodule:: netneurotools.spatial

Calculating spatial statistics
To calculate spatial statistics

.. autosummary::
:template: function.rst
:toctree: generated/

morans_i
local_morans_i
gearys_c
local_gearys_c
lees_i
local_lees_i


.. _ref_interface:

:mod:`netneurotools.interface` - Interface for external tools
-------------------------------------------------------------
:mod:`netneurotools.interface` - Interface with external data and tools
-----------------------------------------------------------------------

.. automodule:: netneurotools.interface
:no-members:
:no-inherited-members:

.. currentmodule:: netneurotools.interface

To parcellate surface data

.. autosummary::
:template: function.rst
:toctree: generated/

vertices_to_parcels
parcels_to_vertices

To work with CIFTI files

.. autosummary::
:template: function.rst
:toctree: generated/

describe_cifti
extract_cifti_volume
extract_cifti_surface
extract_cifti_labels
extract_cifti_surface_labels
deconstruct_cifti

To work with FreeSurfer files

.. autosummary::
:template: function.rst
:toctree: generated/

extract_annot_labels

To work with GIFTI files

.. autosummary::
:template: function.rst
:toctree: generated/

extract_gifti_labels


.. _ref_experimental:

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
'python': ('https://docs.python.org/3', None),
'matplotlib': ('https://matplotlib.org/stable', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
'scipy': ('https://docs.scipy.org/doc/scipy', None),
'sklearn': ('https://scikit-learn.org/stable', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
'pyvista': ('https://docs.pyvista.org/', None),
Expand Down
9 changes: 8 additions & 1 deletion netneurotools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
from . import _version
__version__ = _version.get_versions()['version']

try:
from numba import njit
has_numba = True
except ImportError:
has_numba = False

__all__ = [
'__version__'
'__version__',
has_numba
]
4 changes: 2 additions & 2 deletions netneurotools/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# cortical
fetch_cammoun2012, fetch_schaefer2018, fetch_mmpall,
# subcortical
fetch_pauli2018, fetch_ye2020,
fetch_pauli2018, fetch_tian2020msa,
# annotation
fetch_voneconomo
)
Expand Down Expand Up @@ -46,7 +46,7 @@
'fetch_conte69', 'fetch_yerkes19',
# fetch_atlas
'fetch_cammoun2012', 'fetch_schaefer2018', 'fetch_mmpall',
'fetch_pauli2018', 'fetch_ye2020',
'fetch_pauli2018', 'fetch_tian2020msa',
'fetch_voneconomo',
# fetch_project
'fetch_vazquez_rodriguez2019', 'fetch_mirchi2018',
Expand Down
4 changes: 2 additions & 2 deletions netneurotools/datasets/fetch_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ def fetch_pauli2018(force=False, data_dir=None, verbose=1):
return Bunch(**data)


def fetch_ye2020():
"""Fetch Ye et al., 2020 subcortical parcellation."""
def fetch_tian2020msa():
"""Fetch Tian et al., 2020 subcortical parcellation."""
pass


Expand Down
4 changes: 2 additions & 2 deletions netneurotools/datasets/tests/test_datasets_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_get_dataset_info(dset, expected):
utils._get_dataset_info('notvalid')


def test_get_data_dir(tmpdir):
def test_get_data_dir(tmp_path):
"""Test getting data directory."""
data_dir = utils._get_data_dir(tmpdir)
data_dir = utils._get_data_dir(tmp_path)
assert os.path.isdir(data_dir)
Loading

0 comments on commit 7a0fd19

Please sign in to comment.