5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 " />
6
6
< meta name ="generator " content ="pdoc 0.8.1 " />
7
7
< title > gridgen.bin.parameters API documentation</ title >
8
- < meta name ="description " content ="" />
8
+ < meta name ="description " content ="Specify the parameters for all the commands in gridgen " />
9
9
< link href ='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css ' rel ='stylesheet '>
10
10
< link href ='https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/8.0.0/sanitize.min.css ' rel ='stylesheet '>
11
11
< link href ="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css " rel ="stylesheet ">
20
20
< h1 class ="title "> Module < code > gridgen.bin.parameters</ code > </ h1 >
21
21
</ header >
22
22
< section id ="section-intro ">
23
+ < p > Specify the parameters for all the commands in gridgen</ p >
23
24
< details class ="source ">
24
25
< summary >
25
26
< span > Expand source code</ span >
26
27
</ summary >
27
28
< pre > < code class ="python "> #!/usr/bin/env python3
28
-
29
+ """Specify the parameters for all the commands in gridgen
30
+ """
29
31
from pathlib import Path
30
32
from json import load
31
33
from collections.abc import Iterable
@@ -211,13 +213,13 @@ <h1 class="title">Module <code>gridgen.bin.parameters</code></h1>
211
213
"type": "str",
212
214
"necessary": False,
213
215
"values": ['gaussian', 'sphere', 'inverse'],
214
- "help": "TODO ",
216
+ "help": "method to compute the value at each electrode. `sphere` is the sum of the voxels around the electrodes, within `kernel` distance. `gaussian` is the weighted average of the voxels around an electrode, weighted by a 3d gaussian kernel. With `inverse`, the weights are based on the inverse of the distance. ",
215
217
"default": "inverse",
216
218
},
217
219
"kernel": {
218
220
"type": "float",
219
221
"necessary": False,
220
- "help": "TODO ",
222
+ "help": "With method `sphere`, this is the size of the sphere. With method `gaussian`, this is the size of the sigma of the 3D weighting kernel. With method `inverse`, this is the exponent (1 -> linear, 2 -> quadratic). ",
221
223
"default": 2,
222
224
},
223
225
},
@@ -355,6 +357,18 @@ <h1 class="title">Module <code>gridgen.bin.parameters</code></h1>
355
357
356
358
357
359
def prepare_template(temp):
360
+ """Prepare template by reading the TEMPLATE and converting it to markdown
361
+
362
+ Parameters
363
+ ----------
364
+ temp : dict
365
+ TEMPLATE (or its subfields)
366
+
367
+ Returns
368
+ -------
369
+ dict
370
+ with default values and necessary
371
+ """
358
372
out = {}
359
373
for k, v in temp.items():
360
374
if 'type' in v:
@@ -379,6 +393,18 @@ <h1 class="title">Module <code>gridgen.bin.parameters</code></h1>
379
393
380
394
381
395
def help_template(temp):
396
+ """Prepare template by reading the TEMPLATE and converting it to markdown
397
+
398
+ Parameters
399
+ ----------
400
+ temp : dict
401
+ TEMPLATE (or its subfields)
402
+
403
+ Returns
404
+ -------
405
+ list of str
406
+ dict converted to list, so that it can be exported to markdown
407
+ """
382
408
modules = _invert_dict(REQUIRED)
383
409
384
410
out = []
@@ -426,6 +452,21 @@ <h1 class="title">Module <code>gridgen.bin.parameters</code></h1>
426
452
427
453
428
454
def validate_template(temp, d):
455
+ """Check whether the parameters passed in json file are in accordance with
456
+ the template
457
+
458
+ Parameters
459
+ ----------
460
+ temp : dict
461
+ TEMPLATE of parameters
462
+ d : dict
463
+ actual parameters
464
+
465
+ Returns
466
+ -------
467
+ dict
468
+ input dictionary, with checked values and added defaults if necessary
469
+ """
429
470
out = {}
430
471
for k, v in temp.items():
431
472
@@ -476,6 +517,22 @@ <h1 class="title">Module <code>gridgen.bin.parameters</code></h1>
476
517
477
518
478
519
def parse_parameters(parameters, function, output_dir=None):
520
+ """Read the parameters file, for a specific command
521
+
522
+ Parameters
523
+ ----------
524
+ parameters : str
525
+ path to json file
526
+ function : str
527
+ one of the commands (grid2d, ecog, grid3d etc)
528
+ output_dir : path
529
+ path to use as output, if not specified in parameters
530
+
531
+ Returns
532
+ -------
533
+ dict
534
+ complete parameters
535
+ """
479
536
p_json = Path(parameters).resolve()
480
537
with p_json.open() as f:
481
538
parameters = load(f)
@@ -512,6 +569,7 @@ <h1 class="title">Module <code>gridgen.bin.parameters</code></h1>
512
569
513
570
514
571
def main():
572
+ """Simple function to create parameters.md"""
515
573
md = [
516
574
'## Parameters',
517
575
'',
@@ -593,12 +651,34 @@ <h2 id="returns">Returns</h2>
593
651
< span > def < span class ="ident "> help_template</ span > </ span > (< span > temp)</ span >
594
652
</ code > </ dt >
595
653
< dd >
596
- < div class ="desc "> </ div >
654
+ < div class ="desc "> < p > Prepare template by reading the TEMPLATE and converting it to markdown</ p >
655
+ < h2 id ="parameters "> Parameters</ h2 >
656
+ < dl >
657
+ < dt > < strong > < code > temp</ code > </ strong > : < code > dict</ code > </ dt >
658
+ < dd > TEMPLATE (or its subfields)</ dd >
659
+ </ dl >
660
+ < h2 id ="returns "> Returns</ h2 >
661
+ < dl >
662
+ < dt > < code > list</ code > of < code > str</ code > </ dt >
663
+ < dd > dict converted to list, so that it can be exported to markdown</ dd >
664
+ </ dl > </ div >
597
665
< details class ="source ">
598
666
< summary >
599
667
< span > Expand source code</ span >
600
668
</ summary >
601
669
< pre > < code class ="python "> def help_template(temp):
670
+ """Prepare template by reading the TEMPLATE and converting it to markdown
671
+
672
+ Parameters
673
+ ----------
674
+ temp : dict
675
+ TEMPLATE (or its subfields)
676
+
677
+ Returns
678
+ -------
679
+ list of str
680
+ dict converted to list, so that it can be exported to markdown
681
+ """
602
682
modules = _invert_dict(REQUIRED)
603
683
604
684
out = []
@@ -649,12 +729,13 @@ <h2 id="returns">Returns</h2>
649
729
< span > def < span class ="ident "> main</ span > </ span > (< span > )</ span >
650
730
</ code > </ dt >
651
731
< dd >
652
- < div class ="desc "> </ div >
732
+ < div class ="desc "> < p > Simple function to create parameters.md </ p > < /div >
653
733
< details class ="source ">
654
734
< summary >
655
735
< span > Expand source code</ span >
656
736
</ summary >
657
737
< pre > < code class ="python "> def main():
738
+ """Simple function to create parameters.md"""
658
739
md = [
659
740
'## Parameters',
660
741
'',
@@ -674,12 +755,42 @@ <h2 id="returns">Returns</h2>
674
755
< span > def < span class ="ident "> parse_parameters</ span > </ span > (< span > parameters, function, output_dir=None)</ span >
675
756
</ code > </ dt >
676
757
< dd >
677
- < div class ="desc "> </ div >
758
+ < div class ="desc "> < p > Read the parameters file, for a specific command</ p >
759
+ < h2 id ="parameters "> Parameters</ h2 >
760
+ < dl >
761
+ < dt > < strong > < code > parameters</ code > </ strong > : < code > str</ code > </ dt >
762
+ < dd > path to json file</ dd >
763
+ < dt > < strong > < code > function</ code > </ strong > : < code > str</ code > </ dt >
764
+ < dd > one of the commands (grid2d, ecog, grid3d etc)</ dd >
765
+ < dt > < strong > < code > output_dir</ code > </ strong > : < code > path</ code > </ dt >
766
+ < dd > path to use as output, if not specified in parameters</ dd >
767
+ </ dl >
768
+ < h2 id ="returns "> Returns</ h2 >
769
+ < dl >
770
+ < dt > < code > dict</ code > </ dt >
771
+ < dd > complete parameters</ dd >
772
+ </ dl > </ div >
678
773
< details class ="source ">
679
774
< summary >
680
775
< span > Expand source code</ span >
681
776
</ summary >
682
777
< pre > < code class ="python "> def parse_parameters(parameters, function, output_dir=None):
778
+ """Read the parameters file, for a specific command
779
+
780
+ Parameters
781
+ ----------
782
+ parameters : str
783
+ path to json file
784
+ function : str
785
+ one of the commands (grid2d, ecog, grid3d etc)
786
+ output_dir : path
787
+ path to use as output, if not specified in parameters
788
+
789
+ Returns
790
+ -------
791
+ dict
792
+ complete parameters
793
+ """
683
794
p_json = Path(parameters).resolve()
684
795
with p_json.open() as f:
685
796
parameters = load(f)
@@ -719,12 +830,34 @@ <h2 id="returns">Returns</h2>
719
830
< span > def < span class ="ident "> prepare_template</ span > </ span > (< span > temp)</ span >
720
831
</ code > </ dt >
721
832
< dd >
722
- < div class ="desc "> </ div >
833
+ < div class ="desc "> < p > Prepare template by reading the TEMPLATE and converting it to markdown</ p >
834
+ < h2 id ="parameters "> Parameters</ h2 >
835
+ < dl >
836
+ < dt > < strong > < code > temp</ code > </ strong > : < code > dict</ code > </ dt >
837
+ < dd > TEMPLATE (or its subfields)</ dd >
838
+ </ dl >
839
+ < h2 id ="returns "> Returns</ h2 >
840
+ < dl >
841
+ < dt > < code > dict</ code > </ dt >
842
+ < dd > with default values and necessary</ dd >
843
+ </ dl > </ div >
723
844
< details class ="source ">
724
845
< summary >
725
846
< span > Expand source code</ span >
726
847
</ summary >
727
848
< pre > < code class ="python "> def prepare_template(temp):
849
+ """Prepare template by reading the TEMPLATE and converting it to markdown
850
+
851
+ Parameters
852
+ ----------
853
+ temp : dict
854
+ TEMPLATE (or its subfields)
855
+
856
+ Returns
857
+ -------
858
+ dict
859
+ with default values and necessary
860
+ """
728
861
out = {}
729
862
for k, v in temp.items():
730
863
if 'type' in v:
@@ -752,12 +885,40 @@ <h2 id="returns">Returns</h2>
752
885
< span > def < span class ="ident "> validate_template</ span > </ span > (< span > temp, d)</ span >
753
886
</ code > </ dt >
754
887
< dd >
755
- < div class ="desc "> </ div >
888
+ < div class ="desc "> < p > Check whether the parameters passed in json file are in accordance with
889
+ the template</ p >
890
+ < h2 id ="parameters "> Parameters</ h2 >
891
+ < dl >
892
+ < dt > < strong > < code > temp</ code > </ strong > : < code > dict</ code > </ dt >
893
+ < dd > TEMPLATE of parameters</ dd >
894
+ < dt > < strong > < code > d</ code > </ strong > : < code > dict</ code > </ dt >
895
+ < dd > actual parameters</ dd >
896
+ </ dl >
897
+ < h2 id ="returns "> Returns</ h2 >
898
+ < dl >
899
+ < dt > < code > dict</ code > </ dt >
900
+ < dd > input dictionary, with checked values and added defaults if necessary</ dd >
901
+ </ dl > </ div >
756
902
< details class ="source ">
757
903
< summary >
758
904
< span > Expand source code</ span >
759
905
</ summary >
760
906
< pre > < code class ="python "> def validate_template(temp, d):
907
+ """Check whether the parameters passed in json file are in accordance with
908
+ the template
909
+
910
+ Parameters
911
+ ----------
912
+ temp : dict
913
+ TEMPLATE of parameters
914
+ d : dict
915
+ actual parameters
916
+
917
+ Returns
918
+ -------
919
+ dict
920
+ input dictionary, with checked values and added defaults if necessary
921
+ """
761
922
out = {}
762
923
for k, v in temp.items():
763
924
0 commit comments