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

Various improvements again #146

Merged
merged 23 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
86386f5
[FIX] correct indentation in GitHub Actions workflow for docs
liuzhenqi77 Nov 20, 2024
c00dc73
[ENH] include test file in GitHub Actions workflow for PyVista plotti…
liuzhenqi77 Nov 20, 2024
202d787
[ENH] add import statement for pyvista in smoke test
liuzhenqi77 Nov 23, 2024
504bc18
[ENH] update test functions to use tmp_path instead of tmpdir for imp…
liuzhenqi77 Nov 23, 2024
d8db06c
[ENH] add functional tests for transforms
liuzhenqi77 Nov 23, 2024
7f6234c
[ENH] refactor functions to accept parc_ignore parameter
liuzhenqi77 Nov 23, 2024
0e2570c
[ENH] add surface parcellation functions in the interface module
liuzhenqi77 Nov 25, 2024
25943d3
[ENH] implement Moran's I and local Moran's I calculations with optio…
liuzhenqi77 Nov 25, 2024
da89312
[ENH] update Numba usage to use 'has_numba' flag for compatibility
liuzhenqi77 Nov 25, 2024
16c82b0
[ENH] update installation to include numba support and conditionally …
liuzhenqi77 Nov 25, 2024
b3331e6
[ENH] update CI workflow to remove Python 3.13 from testing matrix si…
liuzhenqi77 Nov 25, 2024
970cad2
[DOC] fix formatting in docstrings
liuzhenqi77 Nov 25, 2024
c533b0e
[ENH] add spatial stats functions
liuzhenqi77 Nov 25, 2024
49ef4ef
[FIX] fix style
liuzhenqi77 Nov 25, 2024
7ec1928
[ENH] update fetch_tian2020msa dataset fetching function
liuzhenqi77 Dec 3, 2024
4ccd0da
[ENH] refactor numba imports to check availability and streamline usa…
liuzhenqi77 Jan 15, 2025
5a297cf
[REF] refactor network correlation and variance functions to support …
liuzhenqi77 Jan 15, 2025
0a71262
[FIX] convert medial wall mask data to float to handle NaNs
liuzhenqi77 Jan 15, 2025
a4060c9
[FIX] update scipy documentation link to the correct reference
liuzhenqi77 Jan 15, 2025
1764a36
[ENH] implement weighted Pearson correlation coefficient
liuzhenqi77 Jan 15, 2025
1d4a4ff
[FIX] standardize string quotes and error messages in correlation fun…
liuzhenqi77 Jan 15, 2025
a88cfbe
[ENH] add assortativity calculations for undirected and directed netw…
liuzhenqi77 Jan 15, 2025
0e0a51b
[STYLE] format code for improved readability and consistency
liuzhenqi77 Jan 15, 2025
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
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
Loading