junifer 0.0.7.dev332__py3-none-any.whl → 0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- junifer/_version.py +9 -19
- junifer/api/__init__.pyi +17 -2
- junifer/api/functions.py +222 -39
- junifer/api/queue_context/__init__.pyi +11 -3
- junifer/api/queue_context/gnu_parallel_local_adapter.py +81 -120
- junifer/api/queue_context/htcondor_adapter.py +118 -181
- junifer/api/queue_context/queue_context_adapter.py +51 -7
- junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +10 -35
- junifer/api/queue_context/tests/test_htcondor_adapter.py +13 -50
- junifer/api/res/fsl/run_fsl_docker.sh +4 -0
- junifer/api/tests/test_functions.py +863 -36
- junifer/cli/__init__.py +1 -7
- junifer/cli/cli.py +41 -22
- junifer/cli/parser.py +23 -147
- junifer/cli/tests/data/gmd_mean.yaml +6 -6
- junifer/cli/tests/data/gmd_mean_htcondor.yaml +6 -5
- junifer/cli/tests/data/partly_cloudy_agg_mean_tian.yml +1 -0
- junifer/cli/tests/test_cli.py +120 -4
- junifer/cli/tests/test_cli_utils.py +23 -6
- junifer/cli/utils.py +14 -9
- junifer/configs/__init__.py +5 -0
- junifer/configs/__init__.pyi +0 -0
- junifer/configs/juseless/datagrabbers/__init__.pyi +4 -2
- junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +18 -24
- junifer/configs/juseless/datagrabbers/camcan_vbm.py +20 -27
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +44 -52
- junifer/configs/juseless/datagrabbers/tests/test_ixi_vbm.py +0 -7
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -19
- junifer/configs/juseless/datagrabbers/ucla.py +111 -104
- junifer/configs/juseless/datagrabbers/ukb_vbm.py +19 -25
- junifer/configs/py.typed +0 -0
- junifer/conftest.py +63 -24
- junifer/data/_dispatch.py +9 -19
- junifer/data/coordinates/_ants_coordinates_warper.py +4 -1
- junifer/data/coordinates/_coordinates.py +51 -6
- junifer/data/coordinates/_fsl_coordinates_warper.py +4 -1
- junifer/data/coordinates/tests/test_coordinates.py +15 -3
- junifer/data/coordinates/tests/test_coordinates_names.py +37 -0
- junifer/data/maps/_ants_maps_warper.py +18 -12
- junifer/data/maps/_fsl_maps_warper.py +7 -3
- junifer/data/maps/_maps.py +12 -8
- junifer/data/maps/tests/test_maps.py +13 -21
- junifer/data/masks/_ants_mask_warper.py +18 -12
- junifer/data/masks/_fsl_mask_warper.py +7 -3
- junifer/data/masks/_masks.py +15 -12
- junifer/data/masks/tests/test_masks.py +20 -17
- junifer/data/parcellations/_ants_parcellation_warper.py +18 -12
- junifer/data/parcellations/_fsl_parcellation_warper.py +7 -5
- junifer/data/parcellations/_parcellations.py +125 -91
- junifer/data/parcellations/tests/test_parcellations.py +122 -1
- junifer/data/template_spaces.py +117 -50
- junifer/data/tests/test_template_spaces.py +10 -7
- junifer/data/utils.py +10 -8
- junifer/datagrabber/__init__.pyi +38 -5
- junifer/datagrabber/aomic/__init__.pyi +8 -1
- junifer/datagrabber/aomic/_types.py +22 -0
- junifer/datagrabber/aomic/id1000.py +193 -183
- junifer/datagrabber/aomic/piop1.py +215 -259
- junifer/datagrabber/aomic/piop2.py +211 -244
- junifer/datagrabber/aomic/tests/test_id1000.py +70 -53
- junifer/datagrabber/aomic/tests/test_piop1.py +98 -102
- junifer/datagrabber/aomic/tests/test_piop2.py +88 -85
- junifer/datagrabber/base.py +253 -79
- junifer/datagrabber/datalad_base.py +127 -76
- junifer/datagrabber/dmcc13_benchmark.py +204 -289
- junifer/datagrabber/hcp1200/__init__.pyi +7 -2
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +61 -40
- junifer/datagrabber/hcp1200/hcp1200.py +151 -164
- junifer/datagrabber/hcp1200/tests/test_hcp1200.py +116 -128
- junifer/datagrabber/multiple.py +183 -63
- junifer/datagrabber/pattern.py +358 -227
- junifer/datagrabber/pattern_datalad.py +84 -124
- junifer/datagrabber/pattern_validation_mixin.py +22 -50
- junifer/datagrabber/tests/test_base.py +17 -4
- junifer/datagrabber/tests/test_datalad_base.py +20 -27
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +110 -122
- junifer/datagrabber/tests/test_multiple.py +293 -31
- junifer/datagrabber/tests/test_pattern.py +577 -18
- junifer/datagrabber/tests/test_pattern_datalad.py +177 -107
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +9 -51
- junifer/datareader/default.py +8 -5
- junifer/datareader/tests/test_default_reader.py +1 -1
- junifer/external/BrainPrint/.codecov.yml +2 -0
- junifer/external/BrainPrint/.codespellignore +2 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/bug-report.md +45 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/documentation.md +12 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/feature-request.md +24 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/questions-help-support.md +28 -0
- junifer/external/BrainPrint/.github/dependabot.yml +6 -0
- junifer/external/BrainPrint/.github/workflows/build.yml +53 -0
- junifer/external/BrainPrint/.github/workflows/code-style.yml +44 -0
- junifer/external/BrainPrint/.github/workflows/doc.yml +65 -0
- junifer/external/BrainPrint/.github/workflows/publish.yml +31 -0
- junifer/external/BrainPrint/.github/workflows/pytest.yml +54 -0
- junifer/external/BrainPrint/.gitignore +123 -0
- junifer/external/BrainPrint/LICENSE +21 -0
- junifer/external/BrainPrint/README.md +108 -0
- junifer/external/BrainPrint/brainprint/cli/__init__.py +11 -0
- junifer/external/BrainPrint/brainprint/cli/help_text.py +169 -0
- junifer/external/BrainPrint/brainprint/cli/parser.py +150 -0
- junifer/external/BrainPrint/brainprint/cli/utils.py +14 -0
- junifer/external/BrainPrint/brainprint/commands/__init__.py +0 -0
- junifer/external/BrainPrint/brainprint/commands/sys_info.py +18 -0
- junifer/external/BrainPrint/brainprint/utils/tests/__init__.py +0 -0
- junifer/external/BrainPrint/brainprint/utils/tests/test_config.py +33 -0
- junifer/external/BrainPrint/doc/Makefile +20 -0
- junifer/external/BrainPrint/doc/_static/.gitkeep +0 -0
- junifer/external/BrainPrint/doc/_templates/autosummary/class.rst +10 -0
- junifer/external/BrainPrint/doc/_templates/autosummary/function.rst +8 -0
- junifer/external/BrainPrint/doc/_templates/autosummary/module.rst +6 -0
- junifer/external/BrainPrint/doc/api/index.rst +11 -0
- junifer/external/BrainPrint/doc/conf.py +272 -0
- junifer/external/BrainPrint/doc/index.rst +140 -0
- junifer/external/BrainPrint/doc/links.inc +36 -0
- junifer/external/BrainPrint/doc/make.bat +35 -0
- junifer/external/BrainPrint/doc/references.bib +23 -0
- junifer/external/BrainPrint/pyproject.toml +170 -0
- junifer/external/BrainPrint/setup.py +3 -0
- junifer/external/__init__.py +5 -0
- junifer/external/__init__.pyi +0 -0
- junifer/external/nilearn/junifer_connectivity_measure.py +95 -39
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +226 -67
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +39 -27
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +231 -21
- junifer/external/py.typed +0 -0
- junifer/markers/__init__.pyi +6 -3
- junifer/markers/base.py +126 -76
- junifer/markers/brainprint.py +30 -39
- junifer/markers/complexity/__init__.py +20 -3
- junifer/markers/complexity/complexity_base.py +40 -41
- junifer/markers/complexity/hurst_exponent.py +22 -35
- junifer/markers/complexity/multiscale_entropy_auc.py +53 -41
- junifer/markers/complexity/perm_entropy.py +22 -36
- junifer/markers/complexity/range_entropy.py +22 -35
- junifer/markers/complexity/range_entropy_auc.py +27 -36
- junifer/markers/complexity/sample_entropy.py +22 -36
- junifer/markers/complexity/tests/test_complexity_registry.py +48 -0
- junifer/markers/complexity/tests/test_hurst_exponent.py +47 -36
- junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +50 -36
- junifer/markers/complexity/tests/test_perm_entropy.py +48 -36
- junifer/markers/complexity/tests/test_range_entropy.py +47 -36
- junifer/markers/complexity/tests/test_range_entropy_auc.py +47 -36
- junifer/markers/complexity/tests/test_sample_entropy.py +48 -36
- junifer/markers/complexity/tests/test_weighted_perm_entropy.py +50 -36
- junifer/markers/complexity/weighted_perm_entropy.py +22 -36
- junifer/markers/ets_rss.py +35 -31
- junifer/markers/falff/__init__.pyi +7 -1
- junifer/markers/falff/_afni_falff.py +22 -9
- junifer/markers/falff/_junifer_falff.py +47 -31
- junifer/markers/falff/falff_base.py +80 -60
- junifer/markers/falff/falff_maps.py +17 -41
- junifer/markers/falff/falff_parcels.py +26 -51
- junifer/markers/falff/falff_spheres.py +34 -61
- junifer/markers/falff/tests/test_falff_maps.py +20 -23
- junifer/markers/falff/tests/test_falff_mask.py +99 -0
- junifer/markers/falff/tests/test_falff_parcels.py +14 -10
- junifer/markers/falff/tests/test_falff_spheres.py +14 -10
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +32 -34
- junifer/markers/functional_connectivity/edge_functional_connectivity_maps.py +12 -25
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +19 -34
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +24 -44
- junifer/markers/functional_connectivity/functional_connectivity_base.py +50 -40
- junifer/markers/functional_connectivity/functional_connectivity_maps.py +12 -25
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +19 -34
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +24 -45
- junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +21 -22
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_maps.py +8 -7
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +8 -4
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +8 -4
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_maps.py +8 -7
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +9 -5
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +8 -12
- junifer/markers/maps_aggregation.py +77 -55
- junifer/markers/parcel_aggregation.py +91 -70
- junifer/markers/reho/__init__.pyi +7 -1
- junifer/markers/reho/_afni_reho.py +23 -14
- junifer/markers/reho/_junifer_reho.py +112 -123
- junifer/markers/reho/reho_base.py +115 -37
- junifer/markers/reho/reho_maps.py +18 -32
- junifer/markers/reho/reho_parcels.py +26 -41
- junifer/markers/reho/reho_spheres.py +33 -54
- junifer/markers/reho/tests/test_junifer_reho.py +178 -0
- junifer/markers/reho/tests/test_reho_maps.py +27 -25
- junifer/markers/reho/tests/test_reho_parcels.py +28 -22
- junifer/markers/reho/tests/test_reho_spheres.py +16 -12
- junifer/markers/sphere_aggregation.py +88 -72
- junifer/markers/temporal_snr/temporal_snr_base.py +32 -30
- junifer/markers/temporal_snr/temporal_snr_maps.py +9 -18
- junifer/markers/temporal_snr/temporal_snr_parcels.py +19 -27
- junifer/markers/temporal_snr/temporal_snr_spheres.py +27 -41
- junifer/markers/temporal_snr/tests/test_temporal_snr_base.py +2 -2
- junifer/markers/temporal_snr/tests/test_temporal_snr_maps.py +17 -22
- junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +11 -3
- junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +9 -9
- junifer/markers/tests/test_brainprint.py +10 -9
- junifer/markers/tests/test_ets_rss.py +7 -3
- junifer/markers/tests/test_lost_regions.py +279 -0
- junifer/markers/tests/test_maps_aggregation.py +67 -114
- junifer/markers/tests/test_marker_utils.py +40 -1
- junifer/markers/tests/test_markers_base.py +275 -6
- junifer/markers/tests/test_parcel_aggregation.py +91 -53
- junifer/markers/tests/test_sphere_aggregation.py +53 -47
- junifer/markers/utils.py +267 -5
- junifer/onthefly/__init__.py +2 -3
- junifer/onthefly/__init__.pyi +4 -0
- junifer/onthefly/_brainprint.py +3 -5
- junifer/onthefly/py.typed +0 -0
- junifer/onthefly/read_transform.py +11 -9
- junifer/onthefly/tests/test_read_transform.py +7 -7
- junifer/pipeline/__init__.pyi +4 -2
- junifer/pipeline/marker_collection.py +14 -10
- junifer/pipeline/pipeline_component_registry.py +25 -6
- junifer/pipeline/pipeline_step_mixin.py +5 -12
- junifer/pipeline/tests/test_data_object_dumper.py +10 -10
- junifer/pipeline/tests/test_marker_collection.py +145 -168
- junifer/pipeline/tests/test_pipeline_component_registry.py +52 -8
- junifer/pipeline/tests/test_pipeline_step_mixin.py +12 -26
- junifer/pipeline/tests/test_update_meta_mixin.py +4 -5
- junifer/pipeline/tests/test_workdir_manager.py +39 -0
- junifer/pipeline/update_meta_mixin.py +13 -10
- junifer/pipeline/utils.py +22 -17
- junifer/pipeline/workdir_manager.py +41 -32
- junifer/preprocess/__init__.pyi +9 -4
- junifer/preprocess/_temporal_filter.py +34 -33
- junifer/preprocess/_temporal_slicer.py +17 -30
- junifer/preprocess/base.py +99 -55
- junifer/preprocess/confounds/__init__.pyi +10 -2
- junifer/preprocess/confounds/fmriprep_confound_remover.py +87 -109
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +64 -45
- junifer/preprocess/smoothing/__init__.pyi +2 -2
- junifer/preprocess/smoothing/_afni_smoothing.py +8 -7
- junifer/preprocess/smoothing/_fsl_smoothing.py +6 -4
- junifer/preprocess/smoothing/_nilearn_smoothing.py +7 -5
- junifer/preprocess/smoothing/smoothing.py +59 -40
- junifer/preprocess/smoothing/tests/test_smoothing.py +28 -8
- junifer/preprocess/tests/test_preprocess_base.py +17 -9
- junifer/preprocess/tests/test_temporal_filter.py +37 -16
- junifer/preprocess/tests/test_temporal_slicer.py +12 -12
- junifer/preprocess/warping/__init__.pyi +2 -2
- junifer/preprocess/warping/_ants_warper.py +56 -40
- junifer/preprocess/warping/_fsl_warper.py +49 -36
- junifer/preprocess/warping/_utils.py +106 -0
- junifer/preprocess/warping/space_warper.py +99 -98
- junifer/preprocess/warping/tests/test_space_warper.py +46 -41
- junifer/preprocess/warping/tests/test_warping_utils.py +163 -0
- junifer/stats.py +46 -34
- junifer/storage/__init__.pyi +8 -4
- junifer/storage/base.py +129 -64
- junifer/storage/hdf5.py +307 -199
- junifer/storage/pandas_base.py +46 -24
- junifer/storage/sqlite.py +99 -62
- junifer/storage/tests/data/collected_h5io_fork.hdf5 +0 -0
- junifer/storage/tests/test_hdf5.py +147 -12
- junifer/storage/tests/test_repeated_storage.py +293 -0
- junifer/storage/tests/test_sqlite.py +9 -20
- junifer/storage/tests/test_storage_base.py +18 -21
- junifer/storage/tests/test_utils.py +83 -22
- junifer/storage/utils.py +58 -38
- junifer/testing/__init__.pyi +2 -2
- junifer/testing/datagrabbers.py +480 -44
- junifer/testing/registry.py +12 -0
- junifer/testing/tests/test_adhdtesting_datagrabber.py +24 -0
- junifer/testing/tests/test_oasisvmbtesting_datagrabber.py +5 -0
- junifer/testing/tests/test_partlycloudytesting_datagrabber.py +52 -0
- junifer/testing/tests/test_spmauditory_datagrabber.py +16 -0
- junifer/testing/tests/test_testing_registry.py +31 -0
- junifer/testing/tests/test_testing_utils.py +35 -0
- junifer/testing/tests/test_uclacnpvbmtesting_datagrabber.py +81 -0
- junifer/testing/utils.py +33 -1
- junifer/tests/test_stats.py +1 -5
- junifer/typing/__init__.pyi +2 -0
- junifer/typing/_typing.py +34 -19
- junifer/typing/py.typed +0 -0
- junifer/utils/__init__.pyi +10 -1
- junifer/utils/_config.py +1 -2
- junifer/utils/helpers.py +68 -2
- junifer/utils/logging.py +31 -7
- junifer/utils/tests/test_helpers.py +36 -1
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/METADATA +43 -35
- junifer-0.0.8.dist-info/RECORD +402 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/WHEEL +1 -1
- junifer/cli/tests/test_parser.py +0 -280
- junifer/external/h5io/h5io/__init__.py +0 -15
- junifer/external/h5io/h5io/_h5io.py +0 -767
- junifer/external/h5io/h5io/_version.py +0 -1
- junifer/external/h5io/h5io/chunked_array.py +0 -94
- junifer/external/h5io/h5io/chunked_list.py +0 -65
- junifer/markers/complexity/__init__.pyi +0 -17
- junifer-0.0.7.dev332.dist-info/RECORD +0 -353
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/AUTHORS.rst +0 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/LICENSE.md +0 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pathlib
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from . import help_text
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def parse_options():
|
|
9
|
+
"""
|
|
10
|
+
Initiates the option parser and return the parsed object.
|
|
11
|
+
"""
|
|
12
|
+
parser = argparse.ArgumentParser(
|
|
13
|
+
description=help_text.CLI_DESCRIPTION, add_help=False
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Required arguments
|
|
17
|
+
required = parser.add_argument_group(title="Required arguments")
|
|
18
|
+
required.add_argument(
|
|
19
|
+
"--sdir",
|
|
20
|
+
dest="subjects_dir",
|
|
21
|
+
help=help_text.SUBJECTS_DIR,
|
|
22
|
+
default=None,
|
|
23
|
+
metavar="<directory>",
|
|
24
|
+
required=True,
|
|
25
|
+
type=pathlib.Path,
|
|
26
|
+
)
|
|
27
|
+
required.add_argument(
|
|
28
|
+
"--sid",
|
|
29
|
+
dest="subject_id",
|
|
30
|
+
help=help_text.SUBJECT_ID,
|
|
31
|
+
default=None,
|
|
32
|
+
metavar="<string>",
|
|
33
|
+
required=True,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Optional arguments
|
|
37
|
+
optional = parser.add_argument_group(title="Processing directives")
|
|
38
|
+
optional.add_argument(
|
|
39
|
+
"--num",
|
|
40
|
+
dest="num",
|
|
41
|
+
help=help_text.NUM,
|
|
42
|
+
default=50,
|
|
43
|
+
metavar="<num>",
|
|
44
|
+
type=int,
|
|
45
|
+
required=False,
|
|
46
|
+
)
|
|
47
|
+
optional.add_argument(
|
|
48
|
+
"--evec",
|
|
49
|
+
dest="keep_eigenvectors",
|
|
50
|
+
help=help_text.EVEC,
|
|
51
|
+
default=False,
|
|
52
|
+
action="store_true",
|
|
53
|
+
required=False,
|
|
54
|
+
)
|
|
55
|
+
optional.add_argument(
|
|
56
|
+
"--skipcortex",
|
|
57
|
+
dest="skip_cortex",
|
|
58
|
+
help=help_text.SKIP_CORTEX,
|
|
59
|
+
default=False,
|
|
60
|
+
action="store_true",
|
|
61
|
+
required=False,
|
|
62
|
+
)
|
|
63
|
+
optional.add_argument(
|
|
64
|
+
"--norm",
|
|
65
|
+
dest="norm",
|
|
66
|
+
help=help_text.NORM,
|
|
67
|
+
default="none",
|
|
68
|
+
metavar="<surface|volume|geometry|none>",
|
|
69
|
+
choices=["surface", "volume", "geometry", "none"],
|
|
70
|
+
required=False,
|
|
71
|
+
)
|
|
72
|
+
optional.add_argument(
|
|
73
|
+
"--reweight",
|
|
74
|
+
dest="reweight",
|
|
75
|
+
help=help_text.REWEIGHT,
|
|
76
|
+
default=False,
|
|
77
|
+
action="store_true",
|
|
78
|
+
required=False,
|
|
79
|
+
)
|
|
80
|
+
optional.add_argument(
|
|
81
|
+
"--asymmetry",
|
|
82
|
+
dest="asymmetry",
|
|
83
|
+
help=help_text.ASYM,
|
|
84
|
+
default=False,
|
|
85
|
+
action="store_true",
|
|
86
|
+
required=False,
|
|
87
|
+
)
|
|
88
|
+
optional.add_argument(
|
|
89
|
+
"--asym-distance",
|
|
90
|
+
dest="asymmetry_distance",
|
|
91
|
+
help=help_text.ASYM_DISTANCE,
|
|
92
|
+
default="euc",
|
|
93
|
+
metavar="<euc>",
|
|
94
|
+
choices=["euc"],
|
|
95
|
+
required=False,
|
|
96
|
+
)
|
|
97
|
+
optional.add_argument(
|
|
98
|
+
"--cholmod",
|
|
99
|
+
dest="use_cholmod",
|
|
100
|
+
help=help_text.CHOLMOD,
|
|
101
|
+
default=False,
|
|
102
|
+
action="store_true",
|
|
103
|
+
required=False,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Output options
|
|
107
|
+
output = parser.add_argument_group(title="Output parameters")
|
|
108
|
+
output.add_argument(
|
|
109
|
+
"--outdir",
|
|
110
|
+
dest="destination",
|
|
111
|
+
help=help_text.OUTPUT_DIRECTORY,
|
|
112
|
+
default=None,
|
|
113
|
+
metavar="<directory>",
|
|
114
|
+
required=False,
|
|
115
|
+
type=pathlib.Path,
|
|
116
|
+
)
|
|
117
|
+
output.add_argument(
|
|
118
|
+
"--keep-temp",
|
|
119
|
+
dest="keep_temp",
|
|
120
|
+
help=help_text.KEEP_TEMP,
|
|
121
|
+
default=False,
|
|
122
|
+
action="store_true",
|
|
123
|
+
required=False,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Help
|
|
127
|
+
help = parser.add_argument_group(title="Getting help")
|
|
128
|
+
help.add_argument("--help", help=help_text.HELP, action="help")
|
|
129
|
+
help.add_argument(
|
|
130
|
+
"--more-help",
|
|
131
|
+
dest="more_help",
|
|
132
|
+
help=help_text.MORE_HELP,
|
|
133
|
+
default=False,
|
|
134
|
+
action="store_true",
|
|
135
|
+
required=False,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
no_input = len(sys.argv) == 1
|
|
139
|
+
more_help = "--more-help" in sys.argv
|
|
140
|
+
if no_input:
|
|
141
|
+
args = parser.parse_args(["--help"])
|
|
142
|
+
return
|
|
143
|
+
elif more_help:
|
|
144
|
+
print(help_text.HELPTEXT)
|
|
145
|
+
return
|
|
146
|
+
else:
|
|
147
|
+
args = vars(parser.parse_args())
|
|
148
|
+
del args["more_help"]
|
|
149
|
+
|
|
150
|
+
return args
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utility functions for the :mod:`brainprint.cli` module.
|
|
3
|
+
"""
|
|
4
|
+
from . import help_text
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_help(print_help: bool = True):
|
|
8
|
+
"""
|
|
9
|
+
Returns a detailed help message.
|
|
10
|
+
"""
|
|
11
|
+
if print_help:
|
|
12
|
+
print(help_text.HELPTEXT)
|
|
13
|
+
else:
|
|
14
|
+
return help_text.HELPTEXT
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
from .. import sys_info
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def run():
|
|
7
|
+
"""Run sys_info() command."""
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
prog=f"{__package__.split('.')[0]}-sys_info", description="sys_info"
|
|
10
|
+
)
|
|
11
|
+
parser.add_argument(
|
|
12
|
+
"--developer",
|
|
13
|
+
help="display information for optional dependencies",
|
|
14
|
+
action="store_true",
|
|
15
|
+
)
|
|
16
|
+
args = parser.parse_args()
|
|
17
|
+
|
|
18
|
+
sys_info(developer=args.developer)
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from io import StringIO
|
|
2
|
+
|
|
3
|
+
from .._config import sys_info
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_sys_info():
|
|
7
|
+
"""Test info-showing utility."""
|
|
8
|
+
out = StringIO()
|
|
9
|
+
sys_info(fid=out)
|
|
10
|
+
value = out.getvalue()
|
|
11
|
+
out.close()
|
|
12
|
+
assert "Platform:" in value
|
|
13
|
+
assert "Executable:" in value
|
|
14
|
+
assert "CPU:" in value
|
|
15
|
+
assert "Physical cores:" in value
|
|
16
|
+
assert "Logical cores" in value
|
|
17
|
+
assert "RAM:" in value
|
|
18
|
+
assert "SWAP:" in value
|
|
19
|
+
|
|
20
|
+
assert "numpy" in value
|
|
21
|
+
assert "psutil" in value
|
|
22
|
+
|
|
23
|
+
assert "style" not in value
|
|
24
|
+
assert "test" not in value
|
|
25
|
+
|
|
26
|
+
out = StringIO()
|
|
27
|
+
sys_info(fid=out, developer=True)
|
|
28
|
+
value = out.getvalue()
|
|
29
|
+
out.close()
|
|
30
|
+
|
|
31
|
+
assert "build" in value
|
|
32
|
+
assert "style" in value
|
|
33
|
+
assert "test" in value
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
File without changes
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import inspect
|
|
11
|
+
from datetime import date
|
|
12
|
+
from importlib import import_module
|
|
13
|
+
from typing import Dict, Optional
|
|
14
|
+
|
|
15
|
+
# from sphinx_gallery.sorting import FileNameSortKey
|
|
16
|
+
|
|
17
|
+
import brainprint
|
|
18
|
+
|
|
19
|
+
project = "BrainPrint"
|
|
20
|
+
author = "Martin Reuter"
|
|
21
|
+
copyright = f"{date.today().year}, {author}"
|
|
22
|
+
release = brainprint.__version__
|
|
23
|
+
package = brainprint.__name__
|
|
24
|
+
gh_url = "https://github.com/Deep-MI/BrainPrint"
|
|
25
|
+
|
|
26
|
+
# -- General configuration ---------------------------------------------------
|
|
27
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
28
|
+
|
|
29
|
+
# If your documentation needs a minimal Sphinx version, state it here.
|
|
30
|
+
needs_sphinx = "5.0"
|
|
31
|
+
|
|
32
|
+
# The document name of the “root” document, that is, the document that contains
|
|
33
|
+
# the root toctree directive.
|
|
34
|
+
root_doc = "index"
|
|
35
|
+
|
|
36
|
+
# Add any Sphinx extension module names here, as strings. They can be
|
|
37
|
+
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
|
|
38
|
+
# ones.
|
|
39
|
+
extensions = [
|
|
40
|
+
"sphinx.ext.autodoc",
|
|
41
|
+
"sphinx.ext.autosectionlabel",
|
|
42
|
+
"sphinx.ext.autosummary",
|
|
43
|
+
"sphinx.ext.intersphinx",
|
|
44
|
+
"sphinx.ext.linkcode",
|
|
45
|
+
"numpydoc",
|
|
46
|
+
"sphinxcontrib.bibtex",
|
|
47
|
+
"sphinx_copybutton",
|
|
48
|
+
"sphinx_design",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
templates_path = ["_templates"]
|
|
52
|
+
exclude_patterns = [
|
|
53
|
+
"_build",
|
|
54
|
+
"Thumbs.db",
|
|
55
|
+
".DS_Store",
|
|
56
|
+
"**.ipynb_checkpoints",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
# Sphinx will warn about all references where the target cannot be found.
|
|
60
|
+
nitpicky = False
|
|
61
|
+
nitpick_ignore = []
|
|
62
|
+
|
|
63
|
+
# A list of ignored prefixes for module index sorting.
|
|
64
|
+
modindex_common_prefix = [f"{package}."]
|
|
65
|
+
|
|
66
|
+
# The name of a reST role (builtin or Sphinx extension) to use as the default
|
|
67
|
+
# role, that is, for text marked up `like this`. This can be set to 'py:obj' to
|
|
68
|
+
# make `filter` a cross-reference to the Python function “filter”.
|
|
69
|
+
default_role = "py:obj"
|
|
70
|
+
|
|
71
|
+
# -- Options for HTML output -------------------------------------------------
|
|
72
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
73
|
+
html_theme = "furo"
|
|
74
|
+
html_static_path = ["_static"]
|
|
75
|
+
html_title = project
|
|
76
|
+
html_show_sphinx = False
|
|
77
|
+
|
|
78
|
+
# Documentation to change footer icons:
|
|
79
|
+
# https://pradyunsg.me/furo/customisation/footer/#changing-footer-icons
|
|
80
|
+
html_theme_options = {
|
|
81
|
+
"footer_icons": [
|
|
82
|
+
{
|
|
83
|
+
"name": "GitHub",
|
|
84
|
+
"url": gh_url,
|
|
85
|
+
"html": """
|
|
86
|
+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
|
|
87
|
+
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
|
|
88
|
+
</svg>
|
|
89
|
+
""",
|
|
90
|
+
"class": "",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# -- autosummary -------------------------------------------------------------
|
|
96
|
+
autosummary_generate = True
|
|
97
|
+
|
|
98
|
+
# -- autodoc -----------------------------------------------------------------
|
|
99
|
+
autodoc_typehints = "none"
|
|
100
|
+
autodoc_member_order = "groupwise"
|
|
101
|
+
autodoc_warningiserror = True
|
|
102
|
+
autoclass_content = "class"
|
|
103
|
+
|
|
104
|
+
# -- intersphinx -------------------------------------------------------------
|
|
105
|
+
intersphinx_mapping = {
|
|
106
|
+
"matplotlib": ("https://matplotlib.org/stable", None),
|
|
107
|
+
"mne": ("https://mne.tools/stable/", None),
|
|
108
|
+
"numpy": ("https://numpy.org/doc/stable", None),
|
|
109
|
+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
|
|
110
|
+
"python": ("https://docs.python.org/3", None),
|
|
111
|
+
"scipy": ("https://docs.scipy.org/doc/scipy", None),
|
|
112
|
+
"sklearn": ("https://scikit-learn.org/stable/", None),
|
|
113
|
+
}
|
|
114
|
+
intersphinx_timeout = 5
|
|
115
|
+
|
|
116
|
+
# -- sphinx-issues -----------------------------------------------------------
|
|
117
|
+
issues_github_path = gh_url.split("https://github.com/")[-1]
|
|
118
|
+
|
|
119
|
+
# -- autosectionlabels -------------------------------------------------------
|
|
120
|
+
autosectionlabel_prefix_document = True
|
|
121
|
+
|
|
122
|
+
# -- numpydoc ----------------------------------------------------------------
|
|
123
|
+
#numpydoc_class_members_toctree = False
|
|
124
|
+
#numpydoc_attributes_as_param_list = False
|
|
125
|
+
|
|
126
|
+
# x-ref
|
|
127
|
+
numpydoc_xref_param_type = True
|
|
128
|
+
numpydoc_xref_aliases = {
|
|
129
|
+
# Matplotlib
|
|
130
|
+
"Axes": "matplotlib.axes.Axes",
|
|
131
|
+
"Figure": "matplotlib.figure.Figure",
|
|
132
|
+
# Python
|
|
133
|
+
"bool": ":class:`python:bool`",
|
|
134
|
+
"Path": "pathlib.Path",
|
|
135
|
+
"TextIO": "io.TextIOBase",
|
|
136
|
+
# Scipy
|
|
137
|
+
"csc_matrix": "scipy.sparse.csc_matrix",
|
|
138
|
+
}
|
|
139
|
+
#numpydoc_xref_ignore = {}
|
|
140
|
+
|
|
141
|
+
# validation
|
|
142
|
+
# https://numpydoc.readthedocs.io/en/latest/validation.html#validation-checks
|
|
143
|
+
error_ignores = {
|
|
144
|
+
"GL01", # docstring should start in the line immediately after the quotes
|
|
145
|
+
"EX01", # section 'Examples' not found
|
|
146
|
+
"ES01", # no extended summary found
|
|
147
|
+
"SA01", # section 'See Also' not found
|
|
148
|
+
"RT02", # The first line of the Returns section should contain only the type, unless multiple values are being returned # noqa
|
|
149
|
+
}
|
|
150
|
+
numpydoc_validate = True
|
|
151
|
+
numpydoc_validation_checks = {"all"} | set(error_ignores)
|
|
152
|
+
numpydoc_validation_exclude = { # regex to ignore during docstring check
|
|
153
|
+
r"\.__getitem__",
|
|
154
|
+
r"\.__contains__",
|
|
155
|
+
r"\.__hash__",
|
|
156
|
+
r"\.__mul__",
|
|
157
|
+
r"\.__sub__",
|
|
158
|
+
r"\.__add__",
|
|
159
|
+
r"\.__iter__",
|
|
160
|
+
r"\.__div__",
|
|
161
|
+
r"\.__neg__",
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# -- sphinxcontrib-bibtex ----------------------------------------------------
|
|
165
|
+
bibtex_bibfiles = ["./references.bib"]
|
|
166
|
+
|
|
167
|
+
# -- sphinx.ext.linkcode -----------------------------------------------------
|
|
168
|
+
# https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html
|
|
169
|
+
|
|
170
|
+
# Alternative method for linking to code by Osama, not sure which one is better
|
|
171
|
+
from urllib.parse import quote
|
|
172
|
+
def linkcode_resolve(domain, info):
|
|
173
|
+
if domain != "py":
|
|
174
|
+
return None
|
|
175
|
+
if not info["module"]:
|
|
176
|
+
return None
|
|
177
|
+
filename = quote(info["module"].replace(".", "/"))
|
|
178
|
+
if not filename.startswith("tests"):
|
|
179
|
+
filename = "/" + filename
|
|
180
|
+
if "fullname" in info:
|
|
181
|
+
anchor = info["fullname"]
|
|
182
|
+
anchor = "#:~:text=" + quote(anchor.split(".")[-1])
|
|
183
|
+
else:
|
|
184
|
+
anchor = ""
|
|
185
|
+
result = f"{gh_url}/blob/main/{filename}.py{anchor}"
|
|
186
|
+
return result
|
|
187
|
+
|
|
188
|
+
# def linkcode_resolve(domain: str, info: Dict[str, str]) -> Optional[str]:
|
|
189
|
+
# """Determine the URL corresponding to a Python object.
|
|
190
|
+
|
|
191
|
+
# Parameters
|
|
192
|
+
# ----------
|
|
193
|
+
# domain : str
|
|
194
|
+
# One of 'py', 'c', 'cpp', 'javascript'.
|
|
195
|
+
# info : dict
|
|
196
|
+
# With keys "module" and "fullname".
|
|
197
|
+
|
|
198
|
+
# Returns
|
|
199
|
+
# -------
|
|
200
|
+
# url : str | None
|
|
201
|
+
# The code URL. If None, no link is added.
|
|
202
|
+
# """
|
|
203
|
+
# if domain != "py":
|
|
204
|
+
# return None # only document python objects
|
|
205
|
+
|
|
206
|
+
# # retrieve pyobject and file
|
|
207
|
+
# try:
|
|
208
|
+
# module = import_module(info["module"])
|
|
209
|
+
# pyobject = module
|
|
210
|
+
# for elt in info["fullname"].split("."):
|
|
211
|
+
# pyobject = getattr(pyobject, elt)
|
|
212
|
+
# fname = inspect.getsourcefile(pyobject).replace("\\", "/")
|
|
213
|
+
# except Exception:
|
|
214
|
+
# # Either the object could not be loaded or the file was not found.
|
|
215
|
+
# # For instance, properties will raise.
|
|
216
|
+
# return None
|
|
217
|
+
|
|
218
|
+
# # retrieve start/stop lines
|
|
219
|
+
# source, start_line = inspect.getsourcelines(pyobject)
|
|
220
|
+
# lines = "L%d-L%d" % (start_line, start_line + len(source) - 1)
|
|
221
|
+
|
|
222
|
+
# # create URL
|
|
223
|
+
# if "dev" in release:
|
|
224
|
+
# branch = "main"
|
|
225
|
+
# else:
|
|
226
|
+
# return None # alternatively, link to a maint/version branch
|
|
227
|
+
# fname = fname.rsplit(f"/{package}/")[1]
|
|
228
|
+
# url = f"{gh_url}/blob/{branch}/{package}/{fname}#{lines}"
|
|
229
|
+
# return url
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# # -- sphinx-gallery ----------------------------------------------------------
|
|
233
|
+
# sphinx_gallery_conf = {
|
|
234
|
+
# "backreferences_dir": "generated/backreferences",
|
|
235
|
+
# "doc_module": (f"{package}",),
|
|
236
|
+
# "examples_dirs": ["generated/examples"],
|
|
237
|
+
# "exclude_implicit_doc": {}, # set
|
|
238
|
+
# "filename_pattern": r"\d{2}_",
|
|
239
|
+
# "gallery_dirs": ["generated/examples"],
|
|
240
|
+
# "line_numbers": False,
|
|
241
|
+
# "plot_gallery": True,
|
|
242
|
+
# "reference_url": {f"{package}": None},
|
|
243
|
+
# "remove_config_comments": True,
|
|
244
|
+
# "show_memory": True,
|
|
245
|
+
# "within_subsection_order": FileNameSortKey,
|
|
246
|
+
# }
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# -- make sure pandoc gets installed -----------------------------------------
|
|
250
|
+
from inspect import getsourcefile
|
|
251
|
+
import os
|
|
252
|
+
|
|
253
|
+
# Get path to directory containing this file, conf.py.
|
|
254
|
+
DOCS_DIRECTORY = os.path.dirname(os.path.abspath(getsourcefile(lambda: 0)))
|
|
255
|
+
|
|
256
|
+
def ensure_pandoc_installed(_):
|
|
257
|
+
import pypandoc
|
|
258
|
+
|
|
259
|
+
# Download pandoc if necessary. If pandoc is already installed and on
|
|
260
|
+
# the PATH, the installed version will be used. Otherwise, we will
|
|
261
|
+
# download a copy of pandoc into docs/bin/ and add that to our PATH.
|
|
262
|
+
pandoc_dir = os.path.join(DOCS_DIRECTORY, "bin")
|
|
263
|
+
# Add dir containing pandoc binary to the PATH environment variable
|
|
264
|
+
if pandoc_dir not in os.environ["PATH"].split(os.pathsep):
|
|
265
|
+
os.environ["PATH"] += os.pathsep + pandoc_dir
|
|
266
|
+
pypandoc.ensure_pandoc_installed(
|
|
267
|
+
targetfolder=pandoc_dir,
|
|
268
|
+
delete_installer=True,
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
def setup(app):
|
|
272
|
+
app.connect("builder-inited", ensure_pandoc_installed)
|