diff --git a/README.md b/README.md index 58326dd66..081f892e3 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,11 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8176570.svg)](https://doi.org/10.5281/zenodo.8176570) ## About -junifer is a data handling and feature extraction library targeted towards neuroimaging data specifically functional MRI data. +`junifer` is a data handling and feature extraction library targeted towards neuroimaging data specifically functional MRI data. It is currently being developed and maintained at the [Applied Machine Learning](https://www.fz-juelich.de/en/inm/inm-7/research-groups/applied-machine-learning-aml) group at [Forschungszentrum Juelich](https://www.fz-juelich.de/en), Germany. Although the library is designed for people working at [Institute of Neuroscience and Medicine - Brain and Behaviour (INM-7)](https://www.fz-juelich.de/en/inm/inm-7), it is designed to be as modular as possible thus enabling others to extend it easily. @@ -55,12 +56,12 @@ conda install -c conda-forge junifer ## Citation -If you use junifer in a scientific publication, we would appreciate if you cite our work. Currently, we do not have a publication, so feel free to use the project [URL](https://juaml.github.io/junifer). +If you use `junifer` in a scientific publication, we would appreciate if you cite our work. Currently, we do not have a publication, so feel free to use the project's [Zenodo URL](https://doi.org/10.5281/zenodo.8176569). ## Funding We thank the [Helmholtz Imaging Platform](https://helmholtz-imaging.de/) and -[SMHB](https://www.fz-juelich.de/en/smhb) for supporting development of Junifer. +[SMHB](https://www.fz-juelich.de/en/smhb) for supporting development of `junifer`. (The funding sources had no role in the design, implementation and evaluation of the pipeline.) ## Contribution @@ -72,7 +73,7 @@ Contributions are welcome and greatly appreciated. Please read the [guidelines]( junifer is released under the AGPL v3 license: junifer, FZJuelich AML neuroimaging feature extraction library. -Copyright (C) 2022, authors of junifer. +Copyright (C) 2023, authors of junifer. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by diff --git a/docs/changes/newsfragments/247.doc b/docs/changes/newsfragments/247.doc new file mode 100644 index 000000000..bd85a54f9 --- /dev/null +++ b/docs/changes/newsfragments/247.doc @@ -0,0 +1 @@ +Add Zenodo badge in ``README`` and improve general documentation by `Synchon Mandal`_ diff --git a/docs/contribution.rst b/docs/contribution.rst index 7caf569ad..63bb14266 100644 --- a/docs/contribution.rst +++ b/docs/contribution.rst @@ -2,8 +2,8 @@ .. _contribution_guidelines: -Contributing to junifer -======================= +Contributing +============ Setting up the local development environment -------------------------------------------- diff --git a/docs/maintaining.rst b/docs/maintaining.rst index c9ba6f5e8..2f0122b05 100644 --- a/docs/maintaining.rst +++ b/docs/maintaining.rst @@ -30,58 +30,58 @@ before proceeding. #. Make sure you are in sync with the main branch. -.. code-block:: bash + .. code-block:: bash - git checkout main - git pull --rebase origin main + git checkout main + git pull --rebase origin main #. Run the following to check changelog is properly generated: -.. code-block:: bash + .. code-block:: bash - towncrier build --draft + towncrier build --draft #. Then, run: -.. code-block:: bash + .. code-block:: bash - towncrier + towncrier -to generate the proper changelog that should be reflected in -``docs/whats_new.rst``. + to generate the proper changelog that should be reflected in + ``docs/whats_new.rst``. #. Commit the changes, make a PR and merge via a merge commit. #. Make sure you are in sync with the main branch. -.. code-block:: bash + .. code-block:: bash - git checkout main - git pull --rebase origin main + git checkout main + git pull --rebase origin main #. Create tag (replace ``X.Y.Z`` with the proper version) on the merged PR's merge commit. -.. code-block:: bash + .. code-block:: bash - git tag -a vX.Y.Z -m "Release X.Y.Z" + git tag -a vX.Y.Z -m "Release X.Y.Z" #. Check that the build system is creating the proper version -.. code-block:: bash + .. code-block:: bash - SETUPTOOLS_SCM_DEBUG=1 python -m build --source --binary --out-dir dist/ . + SETUPTOOLS_SCM_DEBUG=1 python -m build --outdir dist/ . #. Push the tag -.. code-block:: bash + .. code-block:: bash - git push origin --follow-tags + git push origin --follow-tags #. Optional: bump the *MAJOR* or *MINOR* segment of next release (replace ``D.E.0`` with the proper version). -.. code-block:: bash + .. code-block:: bash - git tag -a vD.E.0.dev -m "Set next release to D.E.0" - git push origin --follow-tags + git tag -a vD.E.0.dev -m "Set next release to D.E.0" + git push origin --follow-tags diff --git a/junifer/data/masks.py b/junifer/data/masks.py index df63fdc12..7f22e907b 100644 --- a/junifer/data/masks.py +++ b/junifer/data/masks.py @@ -213,7 +213,7 @@ def get_mask( all_masks = [] for t_mask in true_masks: if isinstance(t_mask, dict): - mask_name = list(t_mask.keys())[0] + mask_name = next(iter(t_mask.keys())) mask_params = t_mask[mask_name] else: mask_name = t_mask diff --git a/junifer/data/tests/test_masks.py b/junifer/data/tests/test_masks.py index 9f28688cc..85c4e252a 100644 --- a/junifer/data/tests/test_masks.py +++ b/junifer/data/tests/test_masks.py @@ -411,7 +411,7 @@ def test_get_mask_multiple( computed = get_mask(masks=junifer_masks, target_data=input["BOLD"]) masks_names = [ - list(x.keys())[0] if isinstance(x, dict) else x for x in masks + next(iter(x.keys())) if isinstance(x, dict) else x for x in masks ] mask_funcs = [ diff --git a/junifer/markers/tests/test_collection.py b/junifer/markers/tests/test_collection.py index ebea847f9..e1dc07a76 100644 --- a/junifer/markers/tests/test_collection.py +++ b/junifer/markers/tests/test_collection.py @@ -197,7 +197,7 @@ def test_marker_collection_storage(tmp_path: Path) -> None: features = storage.list_features() assert len(features) == 3 - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) t_feature = storage.read_df(feature_md5=feature_md5) fname = "gmd_schaefer100x7_mean" t_data = out[fname]["VBM_GM"]["data"] # type: ignore diff --git a/junifer/storage/pandas_base.py b/junifer/storage/pandas_base.py index def90f3bb..d0c61ce96 100644 --- a/junifer/storage/pandas_base.py +++ b/junifer/storage/pandas_base.py @@ -114,7 +114,8 @@ class PandasBaseFeatureStorage(BaseFeatureStorage): if len(elem_idx) == 1: # Create normal index for vector index = pd.Index( - data=list(elem_idx.values())[0], name=list(elem_idx.keys())[0] + data=next(iter(elem_idx.values())), + name=next(iter(elem_idx.keys())), ) else: # Create multiindex for timeseries diff --git a/junifer/storage/tests/test_hdf5.py b/junifer/storage/tests/test_hdf5.py index dda476003..ade6dfc9c 100644 --- a/junifer/storage/tests/test_hdf5.py +++ b/junifer/storage/tests/test_hdf5.py @@ -175,7 +175,7 @@ def test_store_metadata_and_list_features(tmp_path: Path) -> None: # List the stored features features = storage.list_features() # Get the first MD5 - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) # Check the MD5 assert meta_md5 == feature_md5 diff --git a/junifer/storage/tests/test_sqlite.py b/junifer/storage/tests/test_sqlite.py index b347ff4a8..2084f94f5 100644 --- a/junifer/storage/tests/test_sqlite.py +++ b/junifer/storage/tests/test_sqlite.py @@ -335,7 +335,7 @@ def test_store_df_and_read_df(tmp_path: Path) -> None: with pytest.raises(ValueError, match="Only one"): storage.read_df(feature_name="wrong_name", feature_md5="wrong_md5") # Get MD5 hash of features - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "feature_md5" == feature_md5 # Check for key assert "BOLD_markername" == features[feature_md5]["name"] @@ -373,7 +373,7 @@ def test_store_metadata(tmp_path: Path) -> None: meta_md5=meta_md5, element=element_to_store, meta=meta_to_store ) features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert meta_md5 == feature_md5 @@ -474,7 +474,7 @@ def test_store_matrix(tmp_path: Path) -> None: stored_names = [f"{i}~{j}" for i in row_names for j in col_names] features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "BOLD_fc" == features[feature_md5]["name"] read_df = storage.read_df(feature_md5=feature_md5) @@ -498,7 +498,7 @@ def test_store_matrix(tmp_path: Path) -> None: for j in range(data.shape[1]) ] features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "BOLD_fc" == features[feature_md5]["name"] read_df = storage.read_df(feature_md5=feature_md5) assert list(read_df.columns) == stored_names @@ -563,7 +563,7 @@ def test_store_matrix(tmp_path: Path) -> None: ] features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "BOLD_fc" == features[feature_md5]["name"] read_df = storage.read_df(feature_md5=feature_md5) assert list(read_df.columns) == stored_names @@ -595,7 +595,7 @@ def test_store_matrix(tmp_path: Path) -> None: ] features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "BOLD_fc" == features[feature_md5]["name"] read_df = storage.read_df(feature_md5=feature_md5) assert list(read_df.columns) == stored_names @@ -632,7 +632,7 @@ def test_store_matrix(tmp_path: Path) -> None: ] features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "BOLD_fc" == features[feature_md5]["name"] read_df = storage.read_df(feature_md5=feature_md5) assert list(read_df.columns) == stored_names @@ -663,7 +663,7 @@ def test_store_matrix(tmp_path: Path) -> None: ] features = storage.list_features() - feature_md5 = list(features.keys())[0] + feature_md5 = next(iter(features.keys())) assert "BOLD_fc" == features[feature_md5]["name"] read_df = storage.read_df(feature_md5=feature_md5) assert list(read_df.columns) == stored_names