pyNIBS 0.2024.8__py3-none-any.whl → 0.2026.1__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.
Files changed (101) hide show
  1. pynibs/__init__.py +26 -14
  2. pynibs/coil/__init__.py +6 -0
  3. pynibs/{coil.py → coil/coil.py} +213 -543
  4. pynibs/coil/export.py +508 -0
  5. pynibs/congruence/__init__.py +4 -1
  6. pynibs/congruence/congruence.py +37 -45
  7. pynibs/congruence/ext_metrics.py +40 -11
  8. pynibs/congruence/stimulation_threshold.py +1 -2
  9. pynibs/expio/Mep.py +120 -370
  10. pynibs/expio/__init__.py +10 -0
  11. pynibs/expio/brainsight.py +34 -37
  12. pynibs/expio/cobot.py +25 -25
  13. pynibs/expio/exp.py +10 -7
  14. pynibs/expio/fit_funs.py +3 -0
  15. pynibs/expio/invesalius.py +70 -0
  16. pynibs/expio/localite.py +190 -91
  17. pynibs/expio/neurone.py +139 -0
  18. pynibs/expio/signal_ced.py +345 -2
  19. pynibs/expio/visor.py +16 -15
  20. pynibs/freesurfer.py +34 -33
  21. pynibs/hdf5_io/hdf5_io.py +149 -132
  22. pynibs/hdf5_io/xdmf.py +35 -31
  23. pynibs/mesh/__init__.py +1 -1
  24. pynibs/mesh/mesh_struct.py +77 -92
  25. pynibs/mesh/transformations.py +121 -21
  26. pynibs/mesh/utils.py +191 -99
  27. pynibs/models/_TMS.py +2 -1
  28. pynibs/muap.py +1 -2
  29. pynibs/neuron/__init__.py +10 -0
  30. pynibs/neuron/models/mep.py +566 -0
  31. pynibs/neuron/neuron_regression.py +98 -8
  32. pynibs/optimization/__init__.py +12 -2
  33. pynibs/optimization/{optimization.py → coil_opt.py} +157 -133
  34. pynibs/optimization/multichannel.py +1174 -24
  35. pynibs/optimization/workhorses.py +7 -8
  36. pynibs/regression/__init__.py +4 -2
  37. pynibs/regression/dual_node_detection.py +229 -219
  38. pynibs/regression/regression.py +92 -61
  39. pynibs/roi/__init__.py +4 -1
  40. pynibs/roi/roi_structs.py +19 -21
  41. pynibs/roi/{roi.py → roi_utils.py} +56 -33
  42. pynibs/subject.py +24 -14
  43. pynibs/util/__init__.py +20 -4
  44. pynibs/util/dosing.py +4 -5
  45. pynibs/util/quality_measures.py +39 -38
  46. pynibs/util/rotations.py +116 -9
  47. pynibs/util/{simnibs.py → simnibs_io.py} +29 -19
  48. pynibs/util/{util.py → utils.py} +20 -22
  49. pynibs/visualization/para.py +4 -4
  50. pynibs/visualization/render_3D.py +4 -4
  51. pynibs-0.2026.1.dist-info/METADATA +105 -0
  52. pynibs-0.2026.1.dist-info/RECORD +69 -0
  53. {pyNIBS-0.2024.8.dist-info → pynibs-0.2026.1.dist-info}/WHEEL +1 -1
  54. pyNIBS-0.2024.8.dist-info/METADATA +0 -723
  55. pyNIBS-0.2024.8.dist-info/RECORD +0 -107
  56. pynibs/data/configuration_exp0.yaml +0 -59
  57. pynibs/data/configuration_linear_MEP.yaml +0 -61
  58. pynibs/data/configuration_linear_RT.yaml +0 -61
  59. pynibs/data/configuration_sigmoid4.yaml +0 -68
  60. pynibs/data/network mapping configuration/configuration guide.md +0 -238
  61. pynibs/data/network mapping configuration/configuration_TEMPLATE.yaml +0 -42
  62. pynibs/data/network mapping configuration/configuration_for_testing.yaml +0 -43
  63. pynibs/data/network mapping configuration/configuration_modelTMS.yaml +0 -43
  64. pynibs/data/network mapping configuration/configuration_reg_isi_05.yaml +0 -43
  65. pynibs/data/network mapping configuration/output_documentation.md +0 -185
  66. pynibs/data/network mapping configuration/recommendations_for_accuracy_threshold.md +0 -77
  67. pynibs/data/neuron/models/L23_PC_cADpyr_biphasic_v1.csv +0 -1281
  68. pynibs/data/neuron/models/L23_PC_cADpyr_monophasic_v1.csv +0 -1281
  69. pynibs/data/neuron/models/L4_LBC_biphasic_v1.csv +0 -1281
  70. pynibs/data/neuron/models/L4_LBC_monophasic_v1.csv +0 -1281
  71. pynibs/data/neuron/models/L4_NBC_biphasic_v1.csv +0 -1281
  72. pynibs/data/neuron/models/L4_NBC_monophasic_v1.csv +0 -1281
  73. pynibs/data/neuron/models/L4_SBC_biphasic_v1.csv +0 -1281
  74. pynibs/data/neuron/models/L4_SBC_monophasic_v1.csv +0 -1281
  75. pynibs/data/neuron/models/L5_TTPC2_cADpyr_biphasic_v1.csv +0 -1281
  76. pynibs/data/neuron/models/L5_TTPC2_cADpyr_monophasic_v1.csv +0 -1281
  77. pynibs/tests/data/InstrumentMarker20200225163611937.xml +0 -19
  78. pynibs/tests/data/TriggerMarkers_Coil0_20200225163443682.xml +0 -14
  79. pynibs/tests/data/TriggerMarkers_Coil1_20200225170337572.xml +0 -6373
  80. pynibs/tests/data/Xdmf.dtd +0 -89
  81. pynibs/tests/data/brainsight_niiImage_nifticoord.txt +0 -145
  82. pynibs/tests/data/brainsight_niiImage_nifticoord_largefile.txt +0 -1434
  83. pynibs/tests/data/brainsight_niiImage_niifticoord_mixedtargets.txt +0 -47
  84. pynibs/tests/data/create_subject_testsub.py +0 -332
  85. pynibs/tests/data/data.hdf5 +0 -0
  86. pynibs/tests/data/geo.hdf5 +0 -0
  87. pynibs/tests/test_coil.py +0 -474
  88. pynibs/tests/test_elements2nodes.py +0 -100
  89. pynibs/tests/test_hdf5_io/test_xdmf.py +0 -61
  90. pynibs/tests/test_mesh_transformations.py +0 -123
  91. pynibs/tests/test_mesh_utils.py +0 -143
  92. pynibs/tests/test_nnav_imports.py +0 -101
  93. pynibs/tests/test_quality_measures.py +0 -117
  94. pynibs/tests/test_regressdata.py +0 -289
  95. pynibs/tests/test_roi.py +0 -17
  96. pynibs/tests/test_rotations.py +0 -86
  97. pynibs/tests/test_subject.py +0 -71
  98. pynibs/tests/test_util.py +0 -24
  99. /pynibs/{regression/score_types.py → neuron/models/m1_montbrio.py} +0 -0
  100. {pyNIBS-0.2024.8.dist-info → pynibs-0.2026.1.dist-info/licenses}/LICENSE +0 -0
  101. {pyNIBS-0.2024.8.dist-info → pynibs-0.2026.1.dist-info}/top_level.txt +0 -0
@@ -1,43 +0,0 @@
1
- # This configuration file contains settings and parameters for the testing of the network detection algorithm
2
- # by generating response data and then test the algorithm on it.
3
-
4
- # ARTIFICIAL DATA GENERATION
5
- hotspot_elm0: 8797 # hotspot element 0
6
- hotspot_elm1: 5334 # hotspot element 1
7
- sample_size: 300 # number of data manifestations (i.e. trials / coil configurations / ...)
8
- rn_seed: 44 # random seed used in multiple places
9
- distribution_type: 'normal' # 'normal', 'logistic' are implemented
10
- network_type: 'SH_0' # \in ['NO', 'AND', '1_INH_0', 'SH_0', '0_INH_1', 'SH_1', 'XOR', 'OR']
11
- effect_full: 0.9 # at what e-field magnitude the desired effect is expected to manifest fully
12
- effect_saturation: 1.2 # effect \in [0, effect_upper_bound) (at what e-mag the desired effect should saturate)
13
- jitter_ratio: 0.05 # percentage of data that gets assigned random response values within observed range
14
- jitter_scale: 0.2 # gets multiplied with the mean value to calculate distribution deviation:
15
- ## scale = loc * jitter_scale (smaller -> less noise)
16
-
17
- # BINARIZATION
18
- # binarization threshold is calculated as follows: method(response) * bin_factor
19
- bin_method: 'mean'
20
- bin_factor: 1.0
21
-
22
- # SCORING
23
- scoring_method: 'clf' # dual network expected: 'clf' or 'regression', single hotspot expected: 'regress_data' or 'mi'
24
- scoring_emag_thr: 0 # elements with max(e_mag) > scoring_emag_thr are scored
25
- scoring_interval: 22 # subsampling resolution: `1/scoring_interval' of all elements are scored
26
-
27
- # DETECTION
28
- acc_thr: 0.70 # accuracy threshold for hotspot elements (lower bound)
29
- corr_thr: 0.75 # correlation(hot0, hot1) threshold for hotspot pairs (upper bound)
30
- note: 'PLOTTING' # arbitrary string # NO COMMAS
31
-
32
-
33
- ####################################################
34
- # The following is not saved in the evaluation sheet:
35
- ####################################################
36
-
37
- save_files: True # whether to save hotspot scores and scoremaps as hdf5
38
- fn_results: 'eval_final_tests' # file name of the .csv to save the results and evaluation in
39
-
40
- # PLOTTING of the generated data (not in evaluation sheet)
41
- plot_std: True # plot e-mag hotspot0 x emag hotspot1 x response
42
- plot_bin: True # plot e-mag hotspot0 x emag hotspot1 x binarized response
43
- plot_curves: True # plot e-mag hotspot0 x response and e-mag hotspot1 x response
@@ -1,43 +0,0 @@
1
- # This configuration file contains settings and parameters for the application of the network detection algorithm
2
- # on reaction time data.
3
-
4
- # BINARIZATION
5
- # binarization threshold is calculated as follows: method(response) * bin_factor
6
- bin_method: 'mean' # mean, median or slope
7
- bin_factor: 1.3
8
-
9
- # SCORING
10
- scoring_method: 'clf' # dual network expected: 'clf' or 'regression', single hotspot expected: 'regress_data' or 'mi'
11
- scoring_emag_thr: 0 # elements with `max(e_mag) > scoring_emag_thr` are scored
12
- scoring_interval: 22 # subsampling resolution: `1/scoring_interval' of all elements are scored
13
-
14
- # DETECTION
15
- acc_thr: 0.8 # accuracy threshold for hotspot elements (lower bound)
16
- corr_thr: 0.75 # correlation(hot0, hot1) threshold for hotspot pairs (upper bound)
17
-
18
- # ADDITIONAL INFO
19
- note: 'MI_score mapping reasons' # arbitrary string # NO COMMAS
20
- fn_flag: 'testrun_11' # mentioned in the file name
21
- subject_id: '35357.53' # '09440.22' # '13061.30' 35334.2b
22
- response_spec: 'rt' # specification (if any) to retrieve the response
23
- efield_spec: 'E_mag' # E_mag, E_tan, E_norm
24
-
25
-
26
- ####################################################
27
- # The following is not saved in the evaluation sheet:
28
- ####################################################
29
-
30
- save_files: True # whether to save experimental data & hotspot score data as hdf5
31
- write_effect_map: True # whether to create effect map which can be used during validation
32
- fn_results: 'eval_model_TMS' # file name of the .csv to save the results in
33
-
34
- # EFFECT
35
- # parameters used to create effect map - depends on e-field data and does not influence mapping result
36
- effect_full: 42 # at what e-field magnitude the desired effect is expected to manifest fully
37
- effect_saturation: 55 # at what e-mag the desired effect should saturate
38
-
39
- # PLOTTING of the found data (not in evaluation sheet)
40
- plot_std: True # plot e-mag hotspot0 x emag hotspot1 x response
41
- plot_bin: True # plot e-mag hotspot0 x emag hotspot1 x binarized response
42
- plot_curves: True # plot e-mag hotspot0 x response and e-mag hotspot1 x response
43
-
@@ -1,43 +0,0 @@
1
- # This configuration file contains settings and parameters for the application of the network detection algorithm
2
- # on MEP data. More details below.
3
-
4
- # BINARIZATION
5
- # binarization threshold is calculated as follows: method(response) * bin_factor
6
- bin_method: 'mean' # mean, median or slope
7
- bin_factor: 1.0
8
-
9
- # SCORING
10
- scoring_method: 'clf' # dual network expected: 'clf' or 'regression', single hotspot expected: 'regress_data' or 'mi'
11
- scoring_emag_thr: 0 # elements with `max(e_mag) > scoring_emag_thr` are scored
12
- scoring_interval: 22 # subsampling resolution: `1/scoring_interval' of all elements are scored
13
-
14
- # DETECTION
15
- acc_thr: 0.70 # accuracy threshold for hotspot elements (lower bound)
16
- corr_thr: 0.5 # correlation(hot0, hot1) threshold for hotspot pairs (upper bound)
17
-
18
- # ADDITIONAL INFO
19
- note: 'MI_score mapping reasons' # arbitrary string # NO COMMAS
20
- fn_flag: 'testrun_11' # mentioned in the file name
21
- subject_id: '35357.53' #'09440.22' # '13061.30' 35334.2b
22
- response_spec: 'FDI' # FDI / ADM / APB
23
- efield_spec: 'E_mag' # E_mag, E_tan, E_norm
24
-
25
-
26
- ####################################################
27
- # The following is not saved in the evaluation sheet:
28
- ####################################################
29
-
30
- save_files: True # whether to save experimental data & hotspot score data as hdf5
31
- write_effect_map: True # whether to create effect map which can be used during validation
32
- fn_results: 'evaluation_template' # file name of the .csv to save the results in
33
-
34
- # EFFECT
35
- # parameters used to create effect map - depends on e-field data and does not influence mapping result
36
- effect_full: 42 # at what e-field magnitude the desired effect is expected to manifest fully
37
- effect_saturation: 70 # at what e-mag the desired effect should saturate
38
-
39
- # PLOTTING of the found data (not in evaluation sheet)
40
- plot_std: True # plot e-mag hotspot0 x emag hotspot1 x response
41
- plot_bin: True # plot e-mag hotspot0 x emag hotspot1 x binarized response
42
- plot_curves: True # plot e-mag hotspot0 x response and e-mag hotspot1 x response
43
-
@@ -1,185 +0,0 @@
1
- # Output Documentation
2
-
3
- This document provides an overview of the structure of the output CSV file generated by the network detection algorithm.
4
- The result file is created by the functions `write_nda_test_results_csv()` and `write_nda_application_results_csv()`.
5
- The output file contains the settings, detailed results of the analysis, and metadata. Below is a description of each column in the output file.
6
- In the end, a short description of a possible result validation process is included.
7
-
8
- ## Application Results
9
-
10
- ### Structure
11
- The output is organized as one row per analysis. Each row is structured as follows:
12
- - Experimental and configuration parameters: 15 entries (Content of the configuration file minus the last 8 entries, which are not relevant for analysis)
13
- - Result values: 19 entries
14
- - Additional Info and Metadata: 6 entries
15
-
16
- ### Analysis
17
- The most important columns to make sense of the result are `network_type`, `found_idcs_0` and `found_idcs_1`, since this can tell us which ROI elements are involved and in what kind of interplay they have an effect.
18
-
19
- ### Columns
20
- <u> Configuration: </u>
21
-
22
- - ``run``: Identifies the specific run or iteration of the analysis (hardcoded right now, default: 1)
23
- - ``bin_method``: See configuration guide.
24
- - ``bin_factor``: See configuration guide.
25
- - ``scoring_method``: See configuration guide.
26
- - ``scoring_thr``: See configuration guide.
27
- - ``scoring_interval``: See configuration guide.
28
- - ``acc_thr``: See configuration guide.
29
- - ``corr_thr``: See configuration guide.
30
- - ``note``: See configuration guide.
31
- - ``fn_flag``: See configuration guide.
32
- - ``subject_id``: See configuration guide.
33
- - ``response_specification``: See configuration guide.
34
- - ``efield_specification``: See configuration guide.
35
-
36
- <u> Result: </u>
37
-
38
- Let h0 and h1 denote the two found (potential) hotspots.
39
- - ``found_idcs_0``: ROI index of h0.
40
- - ``found_idcs_1``: ROI index of h1.
41
- - ``found_scores_0``: Hotspot score of h0. The higher, the better. Meaning and range depends on the scoring method:
42
- - 'mi': mutual information score, (value > 0)
43
- - 'clf': number of promising element combinations involving this element. (value < n_elms)
44
- - 'regress_data': R2-value of the sigmoidal fit. (value in [0,1])
45
- - 'regression': R2-value of the multivariable Gaussian fit. (value in [0,1])
46
- - ``found_scores_1``: Hotspot score of h1. (analogous to h0)
47
- - ``found_acc_0``: Accuracy of h0. (value in [0,1])
48
- Only differs from the hotspot score when using the CLF-method, in which case this denotes the decision tree classifier accuracy. (= how well the h0 e-field describes the TMS effect)
49
- - ``found_acc_1``: Accuracy of h1. (analogous to h1)
50
- - ``found_hotspots_corr``: Correlation of found hotspots.
51
- (Measured as the Pearson correlation coefficient of their e-fields.) (value in [0,1])
52
- - ``found_hotspots_distance``: Distance between found hotspots. (Geodesic distance in mm)
53
- - ``found_network_type``: Type of network found, network IDs:
54
- - (1) `NO`: No network ("pseudonetwork").
55
- - (2) `AND`: Dual node network: Effect if elm0 AND elm1 are stimulated.
56
- - (3) `1_INH_0`: Dual node network: elm1 inhibits elm0, elm0 has an effect.
57
- - (4) `SH_0`: Single hotspot: Only elm0 has an effect.
58
- - (5) `0_INH_1`: Dual node network: elm0 inhibits elm1, elm1 has an effect.
59
- - (6) `SH_1`: Single hotspot: Only elm1 has an effect.
60
- - (7) `XOR`: Dual node network: elm0 inhibits elm1, elm1 inhibits elm0. Both have an effect.
61
- - (8) `OR`: Dual node network: Effect if either elm0 or elm1 is stimulated.
62
- - ``network_type_certainty``: Certainty of the network type identified. (value in [0,1])
63
- Measured as the maximal entry of the network identification vector divided by its second maximal entry. (How close was the call?)
64
- - ``network_type_vector_[0:8]``: Value of the network type vector for each network type. (in the code: `shape_vector`)
65
- The highest value belongs to the identified network.
66
- - ``sample_size``: The size of the sample analyzed. (n_zaps)
67
-
68
- <u> Additional: </u>
69
-
70
- - ``response_max``: Maximum response observed.
71
- - ``response_mean``: Mean response.
72
- - ``response_dev``: Standard deviation of the response.
73
- - ``runtime_gen``: Runtime for the data generation step.
74
- - ``runtime_scores``: Runtime for the scoring step.
75
- - ``runtime_eval``: Runtime for the evaluation step.
76
-
77
-
78
- ## Testing Results
79
-
80
- ### Structure
81
- The output is organized as one row per analysis. Each row is structured as follows:
82
- - Experimental and configuration parameters: 20 entries (Content of the configuration file minus the last 5 entries, which are not relevant for analysis)
83
- - Result values: 20 entries
84
- - Additional Info and Metadata: 6 entries
85
-
86
- ### Analysis
87
-
88
- The most important columns to analyze performance are `network_eval` and `found_eval`. When both of them have the value 1 (True), the detection was completely successful.
89
-
90
- ### Columns
91
- <u> Configuration: </u>
92
-
93
- - ``run``: Identifies the specific run or iteration of the analysis (hardcoded right now, default: 1)
94
- - `hotspot_idcs_0` : See configuration guide.
95
- - `hotspot_idcs_1` : See configuration guide.
96
- - `sample_size` : See configuration guide.
97
- - `rn_seed` : See configuration guide.
98
- - `dist_type` : See configuration guide.
99
- - `network_type` : See configuration guide.
100
- - `real_network_type` : See configuration guide.
101
- - `effect_full` : See configuration guide.
102
- - `effect_upper_bound` : See configuration guide.
103
- - `jitter_ratio` : See configuration guide.
104
- - `jitter_scale`: See configuration guide.
105
- - ``bin_method``: See configuration guide.
106
- - ``bin_factor``: See configuration guide.
107
- - ``scoring_method``: See configuration guide.
108
- - ``scoring_thr``: See configuration guide.
109
- - ``scoring_interval``: See configuration guide.
110
- - ``acc_thr``: See configuration guide.
111
- - ``corr_thr``: See configuration guide.
112
- - ``note``: See configuration guide.
113
-
114
- <u> Result: </u>
115
-
116
- Let h0 and h1 denote the two found (potential) hotspots.
117
- - ``found_idcs_0``: ROI index of h0.
118
- - ``found_idcs_1``: ROI index of h1.
119
- - ``found_scores_0``: Hotspot score of h0. The higher, the better. Meaning and range depends on the scoring method:
120
- - 'mi': mutual information score, (value > 0)
121
- - 'clf': number of promising element combinations involving this element. (value < n_elms)
122
- - 'regress_data': R2-value of the sigmoidal fit. (value in [0,1])
123
- - 'regression': R2-value of the multivariable Gaussian fit. (value in [0,1])
124
- - ``found_scores_1``: Hotspot score of h1. (analogous to h0)
125
- - ``found_acc_0``: Accuracy of h0. (value in [0,1])
126
- Only differs from the hotspot score when using the CLF-method, in which case this denotes the decision tree classifier accuracy. (= how well the h0 e-field describes the TMS effect)
127
- - ``found_acc_1``: Accuracy of h1. (analogous to h1)
128
- - ``found_hotspots_corr``: Correlation of found hotspots.
129
- (Measured as the Pearson correlation coefficient of their e-fields.) (value in [0,1])
130
- - ``found_hotspots_distance``: Distance between found hotspots. (Geodesic distance in mm)
131
- - ``found_network_type``: Type of network found, network IDs:
132
- - (1) `NO`: No network ("pseudonetwork").
133
- - (2) `AND`: Dual node network: Effect if elm0 AND elm1 are stimulated.
134
- - (3) `1_INH_0`: Dual node network: elm1 inhibits elm0, elm0 has an effect.
135
- - (4) `SH_0`: Single hotspot: Only elm0 has an effect.
136
- - (5) `0_INH_1`: Dual node network: elm0 inhibits elm1, elm1 has an effect.
137
- - (6) `SH_1`: Single hotspot: Only elm1 has an effect.
138
- - (7) `XOR`: Dual node network: elm0 inhibits elm1, elm1 inhibits elm0. Both have an effect.
139
- - (8) `OR`: Dual node network: Effect if either elm0 or elm1 is stimulated.
140
- - ``network_type_certainty``: Certainty of the network type identified. (value in [0,1])
141
- Measured as the maximal entry of the network identification vector divided by its second maximal entry. (How close was the call?)
142
- - ``network_type_vector_[0:8]``: Value (int) of the network type vector for each network type. (in the code: `shape_vector`)
143
- The highest value belongs to the identified network.
144
- - ``identification_evaluation``: (boolean) Whether the network was identified correctly. (`real_network_type` == `found_network_type`)
145
- - ``localization_evaluation``: (boolean) Whether both hotspots were localized within tolerated area. (which is 10mm around the real hotspots)
146
- - `real_hotspot_dist`: Distance between real hotspots. (Geodesic distance in mm)
147
- - `real_hotspot_corr`: Correlation of real hotspots.
148
- (Measured as the Pearson correlation coefficient of their e-fields.) (value in [0,1])
149
- - `real_hotspot_emax_0`: The maximal e-field magnitude of real hotspot 0 over all trials. (As a proxy for stimulatability. The lower the e-mag max, the harder a hotspot is to detect.)
150
- - `real_hotspot_emax_1`: The maximal e-field magnitude of real hotspot 1 over all trials.
151
- - `found_distance_0`: Distance between `found_hotspot_0` and its assigned real hotspot. (Geodesic distance in mm) (Assignment is done such that overall distances are minimized.)
152
- - `found_distance_1`: Distance between `found_hotspot_1` and its assigned real hotspot. (Geodesic distance in mm)
153
- - `num_hotspot-candidates`: The number of elements with a hotspot score > 0. (Only meaningful in `clf`-method - if even.)
154
-
155
- <u> Additional: </u>
156
-
157
- - ``response_max``: Maximum response observed.
158
- - ``response_mean``: Mean response.
159
- - ``response_dev``: Standard deviation of the response.
160
- - ``runtime_gen``: Runtime for the data generation step.
161
- - ``runtime_scores``: Runtime for the scoring step.
162
- - ``runtime_eval``: Runtime for the evaluation step.
163
-
164
-
165
- ## Validation procedure
166
-
167
- A challenging part of validation is finding a response measure and according ROI with a reasonable assumption about a network effect
168
- being in place.
169
- Assuming that is the case, validation of NDA results in a second session could be done as follows:
170
-
171
- Based on all known e-field data `e_matrix` from the first session and the detection result, an effect map can be created using the function
172
- `write_effect_map_hdf5()`.
173
- To create that map, for every ROI element of interest (`elm_i`), an expected effect value is estimated:
174
- - Of all available stimulations/zaps, the one
175
- inducing the highest e-field value on element `elm_i` is chosen.
176
- - For that zap, the e-field magnitudes of the hotspot elements are taken into consideration and using the network type and
177
- its effect function (see `create_artificial_response_data()`), the expected effect for that zap is computed.
178
- (E.g. Assuming the hotspot elements are stimulated at this certain value, and form the network type OR, how high is the effect on the response expected to be?)
179
- - This effect value is assigned to the ROI element `elm_i`.
180
-
181
- Applying this procedure to each element leads to an initial ROI effect map, on which stimulation points of interest can be chosen (e.g. maxima, mimima,...)
182
- For those specific stimulation configurations, a more precise effect value can be computed, since the initial map was
183
- just a proxy (because the needed stimulation positions may not have been included in the first session.).
184
- After measuring the response values for these stimulation points of interest, their values and deviation from the
185
- baseline response can be compared to the predicted effect values.
@@ -1,77 +0,0 @@
1
- ## What is the accuracy threshold?
2
-
3
- Lower bound for the accuracy (clf) or scores (other scoring methods) of hotspot elements. Below that,
4
- an element will not be categorized as hotspot.
5
-
6
- ## How to find out a threshold that makes sense?
7
- A good source of knowledge to go on is the accuracy/score of a pseudonetwork (NO effect) of comparable parameters.
8
- Accuracy mostly depends on the given sample size, while also being influenced by the noise level and effect strength.
9
- The higher the threshold, the higher the specificity of the detection - but also the higher the chance NO network is
10
- detected, even when there could be one.
11
-
12
-
13
- ## CLF-accuracies per sample size
14
- Using the decision tree classification scores (`clf`), the recommended accuracy thresholds are listed in the table below.
15
- The results were obtained by running 50 pseudonetwork trials (NO effect) with the `network_detection_algorithm_testing()`, for each sample size
16
- in np.range(20,1000,20). The corresponding data is in `/data/pt_01756/studies/network_mapping/testing_NDA/15484.08/pseudonetwork_data.csv`.
17
-
18
- The given recommendations represent the highest achieved accuracies of the tested pseudonetworks per sample size.
19
- To conduct a more elaborate analysis use `appprox_optimal_acc_threshold()` in ``result_analysis.py``.
20
-
21
-
22
- | Sample Size | Accuracy Threshold |
23
- |-------------|--------------------|
24
- | 20 | 1 |
25
- | 40 | 0.93 |
26
- | 60 | 0.87 |
27
- | 80 | 0.81 |
28
- | 100 | 0.77 |
29
- | 120 | 0.77 |
30
- | 140 | 0.74 |
31
- | 160 | 0.73 |
32
- | 180 | 0.72 |
33
- | 200 | 0.71 |
34
- | 220 | 0.71 |
35
- | 240 | 0.7 |
36
- | 260 | 0.69 |
37
- | 280 | 0.69 |
38
- | 300 | 0.69 |
39
- | 320 | 0.7 |
40
- | 340 | 0.67 |
41
- | 360 | 0.67 |
42
- | 380 | 0.67 |
43
- | 400 | 0.65 |
44
- | 420 | 0.65 |
45
- | 440 | 0.64 |
46
- | 460 | 0.64 |
47
- | 480 | 0.64 |
48
- | 500 | 0.63 |
49
- | 520 | 0.63 |
50
- | 540 | 0.63 |
51
- | 560 | 0.63 |
52
- | 580 | 0.63 |
53
- | 600 | 0.62 |
54
- | 620 | 0.63 |
55
- | 640 | 0.62 |
56
- | 660 | 0.62 |
57
- | 680 | 0.62 |
58
- | 700 | 0.61 |
59
- | 720 | 0.61 |
60
- | 740 | 0.61 |
61
- | 760 | 0.62 |
62
- | 780 | 0.61 |
63
- | 800 | 0.61 |
64
- | 820 | 0.61 |
65
- | 840 | 0.61 |
66
- | 860 | 0.61 |
67
- | 880 | 0.6 |
68
- | 900 | 0.6 |
69
- | 920 | 0.6 |
70
- | 940 | 0.6 |
71
- | 960 | 0.6 |
72
- | 980 | 0.6 |
73
- | 1000 | 0.6 |
74
-
75
- ## R2 scores
76
- No proper analysis has been conducted, but they tend to be much lower than clf-accuracies.
77
- Values of about ``0.15`` have proven sufficient.