brukerapi 0.1.10__py3-none-any.whl → 0.2.0__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.
brukerapi/cli.py CHANGED
@@ -1,18 +1,17 @@
1
- from argparse import ArgumentParser
2
- from brukerapi.splitters import *
3
- from brukerapi.folders import *
4
1
  import sys
2
+ from argparse import ArgumentParser
5
3
 
4
+ from brukerapi.folders import Dataset, Filter, Folder, Path
5
+ from brukerapi.splitters import FrameGroupSplitter, SlicePackageSplitter
6
6
 
7
- def main():
8
- """
9
7
 
10
- """
11
- parser = ArgumentParser(prog='bruker')
8
+ def main():
9
+ """ """
10
+ parser = ArgumentParser(prog="bruker")
12
11
  subparsers = parser.add_subparsers()
13
12
 
14
13
  # report sub-command
15
- parser_report = subparsers.add_parser('report', help='export properties of data sets to json, or yaml file')
14
+ parser_report = subparsers.add_parser("report", help="export properties of data sets to json, or yaml file")
16
15
  parser_report.add_argument(
17
16
  "-i",
18
17
  "--input",
@@ -27,27 +26,22 @@ def main():
27
26
  parser_report.add_argument(
28
27
  "-f",
29
28
  "--format",
30
- choices=['json', 'yml'],
31
- default='json',
29
+ choices=["json", "yml"],
30
+ default="json",
32
31
  help="Format of report files",
33
32
  )
34
33
  parser_report.add_argument(
35
34
  "-p",
36
35
  "--props",
37
36
  type=str,
38
- nargs='+',
37
+ nargs="+",
39
38
  help="List of properties to include",
40
39
  )
41
- parser_report.add_argument(
42
- "-v",
43
- "--verbose",
44
- help="make verbose",
45
- action="store_true"
46
- )
40
+ parser_report.add_argument("-v", "--verbose", help="make verbose", action="store_true")
47
41
  parser_report.set_defaults(func=report)
48
42
 
49
43
  # report sub-command
50
- parser_split = subparsers.add_parser('split', help='split dataset into several sub-datasets')
44
+ parser_split = subparsers.add_parser("split", help="split dataset into several sub-datasets")
51
45
  parser_split.add_argument(
52
46
  "-i",
53
47
  "--input",
@@ -68,7 +62,7 @@ def main():
68
62
  "-s",
69
63
  "--slice_package",
70
64
  dest="slice_package",
71
- action='store_true',
65
+ action="store_true",
72
66
  help="Split by slice package",
73
67
  )
74
68
  parser_split.add_argument(
@@ -81,7 +75,7 @@ def main():
81
75
  parser_split.set_defaults(func=split)
82
76
 
83
77
  # filter sub-command
84
- parser_filter = subparsers.add_parser('filter', help='get files based on query')
78
+ parser_filter = subparsers.add_parser("filter", help="get files based on query")
85
79
  parser_filter.add_argument(
86
80
  "-i",
87
81
  "--input",
@@ -108,8 +102,6 @@ def main():
108
102
  func(args)
109
103
 
110
104
 
111
-
112
-
113
105
  def split(args):
114
106
  """
115
107
  split sub-command
@@ -145,13 +137,12 @@ def report(args):
145
137
  elif output.is_dir():
146
138
  # folder to folder
147
139
  Folder(input).report(path_out=output, format_=args.format, props=args.props, verbose=args.verbose)
148
- else:
149
- # dataset in-place
150
- if output is None:
151
- Dataset(input, add_parameters=['subject']).report(props=args.props, verbose=args.verbose)
152
- # dataset to folder, or dataset to file
153
- elif output.is_dir():
154
- Dataset(input, add_parameters=['subject']).report(path=output, props=args.props, verbose=args.verbose)
140
+ # dataset in-place
141
+ elif output is None:
142
+ Dataset(input, add_parameters=["subject"]).report(props=args.props, verbose=args.verbose)
143
+ # dataset to folder, or dataset to file
144
+ elif output.is_dir():
145
+ Dataset(input, add_parameters=["subject"]).report(path=output, props=args.props, verbose=args.verbose)
155
146
 
156
147
 
157
148
  def filter(args):
@@ -223,9 +223,7 @@
223
223
  ["#PULPROG[1:-1]",
224
224
  [
225
225
  "EPI.ppg",
226
- "DtiEpi.ppg",
227
226
  "navigatorEPI_OM.ppg",
228
- "EPSI.ppg",
229
227
  "FAIR_EPI.ppg",
230
228
  "CASL_EPI.ppg",
231
229
  "T1_EPI.ppg",
@@ -236,6 +234,18 @@
236
234
  "#ACQ_sw_version in ['<PV 5.1>', '<PV 6.0>', '<PV 6.0.1>', '<PV-7.0.0>']"
237
235
  ]
238
236
  },
237
+ {
238
+ "cmd": "'dEPI'" ,
239
+ "conditions": [
240
+ ["#PULPROG[1:-1]",
241
+ [
242
+ "DtiEpi.ppg",
243
+ "EPSI.ppg"
244
+ ]
245
+ ],
246
+ "#ACQ_sw_version in ['<PV 5.1>', '<PV 6.0>', '<PV 6.0.1>', '<PV-7.0.0>']"
247
+ ]
248
+ },
239
249
  {
240
250
  "cmd": "'SPECTROSCOPY'" ,
241
251
  "conditions": [
@@ -322,7 +332,13 @@
322
332
  ]
323
333
  },
324
334
  {
325
- "cmd": "#NR",
335
+ "cmd": "#NSegments*#NI*#NR*(#ACQ_size[2] if len(#ACQ_size)>2 else 1)",
336
+ "conditions": [
337
+ "@scheme_id=='dEPI'"
338
+ ]
339
+ },
340
+ {
341
+ "cmd": "#NR*#NI",
326
342
  "conditions": [
327
343
  "@scheme_id=='SPECTROSCOPY'"
328
344
  ]
@@ -430,9 +446,23 @@
430
446
  "@scheme_id=='EPI'"
431
447
  ]
432
448
  },
449
+ {
450
+ "cmd": [
451
+ "#PVM_EncMatrix[0] * #PVM_EncMatrix[1] // #NSegments",
452
+ "#PVM_EncNReceivers",
453
+ "#NSegments",
454
+ "#NI",
455
+ "#NR",
456
+ "#ACQ_size[2] if len(#ACQ_size)>2 else 1"
457
+ ],
458
+ "conditions": [
459
+ "@scheme_id=='dEPI'"
460
+ ]
461
+ },
433
462
  {
434
463
  "cmd": [
435
464
  "#ACQ_size.tuple[0] // 2",
465
+ "#NI",
436
466
  "#NR"
437
467
  ],
438
468
  "conditions": [
@@ -527,11 +557,24 @@
527
557
  {
528
558
  "cmd": [0,2,3,4,1],
529
559
  "conditions": [
530
- "@scheme_id in ['EPI', 'SPIRAL']"
560
+ "@scheme_id in ['SPIRAL']"
561
+ ]
562
+ },
563
+ {
564
+ "cmd": [0,2,3,4,1],
565
+ "conditions": [
566
+ "@scheme_id in ['EPI']"
567
+ ]
568
+ },
569
+ {
570
+ "cmd": [0,2,3,4,1,5],
571
+ "conditions": [
572
+ "@scheme_id in ['dEPI']"
531
573
  ]
532
574
  },
575
+
533
576
  {
534
- "cmd": [0,1],
577
+ "cmd": [0,1,2],
535
578
  "conditions": [
536
579
  "@scheme_id=='SPECTROSCOPY'"
537
580
  ]
@@ -604,9 +647,23 @@
604
647
  "@scheme_id=='EPI'"
605
648
  ]
606
649
  },
650
+ {
651
+ "cmd": [
652
+ "#PVM_EncMatrix[0]",
653
+ "#PVM_EncMatrix[1]",
654
+ "#NI",
655
+ "#NR",
656
+ "#PVM_EncNReceivers",
657
+ "#ACQ_size[2] if len(#ACQ_size)>2 else 1"
658
+ ],
659
+ "conditions": [
660
+ "@scheme_id=='dEPI'"
661
+ ]
662
+ },
607
663
  {
608
664
  "cmd": [
609
665
  "#ACQ_size.tuple[0] // 2",
666
+ "#NI",
610
667
  "#NR"
611
668
  ],
612
669
  "conditions": [
@@ -701,7 +758,7 @@
701
758
  "'channel'"
702
759
  ],
703
760
  "conditions": [
704
- ["@scheme_id",["CART_2D","RADIAL","EPI","SPIRAL","ZTE"]]
761
+ ["@scheme_id",["CART_2D","RADIAL","EPI","dEPI","SPIRAL","ZTE"]]
705
762
  ]
706
763
  },
707
764
  {
@@ -5,7 +5,7 @@
5
5
  "conditions": [
6
6
  "#GO_raw_data_format=='GO_32BIT_SGN_INT'",
7
7
  "#BYTORDA=='little'",
8
- ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
8
+ ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
9
9
  ]
10
10
  },
11
11
  {
@@ -13,7 +13,7 @@
13
13
  "conditions": [
14
14
  "#GO_raw_data_format=='GO_16BIT_SGN_INT'",
15
15
  "#BYTORDA=='little'",
16
- ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
16
+ ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
17
17
  ]
18
18
  },
19
19
  {
@@ -21,7 +21,7 @@
21
21
  "conditions": [
22
22
  "#GO_raw_data_format=='GO_32BIT_FLOAT'",
23
23
  "#BYTORDA=='little'",
24
- ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
24
+ ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
25
25
  ]
26
26
  },
27
27
  {
@@ -29,7 +29,7 @@
29
29
  "conditions": [
30
30
  "#GO_raw_data_format=='GO_32BIT_SGN_INT'",
31
31
  "#BYTORDA=='big'",
32
- ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
32
+ ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
33
33
  ]
34
34
  },
35
35
  {
@@ -37,7 +37,7 @@
37
37
  "conditions": [
38
38
  "#GO_raw_data_format=='GO_16BIT_SGN_INT'",
39
39
  "#BYTORDA=='big'",
40
- ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
40
+ ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
41
41
  ]
42
42
  },
43
43
  {
@@ -45,7 +45,7 @@
45
45
  "conditions": [
46
46
  "#GO_raw_data_format=='GO_32BIT_FLOAT'",
47
47
  "#BYTORDA=='big'",
48
- ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>"]]
48
+ ["#ACQ_sw_version",["<PV 5.1>", "<PV 6.0>", "<PV 6.0.1>","<PV-7.0.0>"]]
49
49
  ]
50
50
  },
51
51
  {
@@ -53,7 +53,7 @@
53
53
  "conditions": [
54
54
  "#ACQ_word_size=='_32_BIT'",
55
55
  "#BYTORDA=='little'",
56
- ["#ACQ_sw_version",["<PV-360.1.1>"]]
56
+ ["#ACQ_sw_version",["<PV-360.1.1>","<PV-360.3.0>","<PV-360.3.1>","<PV-360.3.2>","<PV-360.3.3>","<PV-360.3.4>","<PV-360.3.5>","<PV-360.3.6>","<PV-360.3.7>"]]
57
57
  ]
58
58
  }
59
59
  ],
@@ -61,9 +61,16 @@
61
61
  {
62
62
  "cmd": "#ACQ_jobs.primed_dict(7)['<{}>'.format(@subtype)]",
63
63
  "conditions": [
64
- "#ACQ_sw_version in ['<PV-360.1.1>']"
64
+ ["#ACQ_sw_version",["<PV-360.1.1>"]]
65
65
  ]
66
66
  },
67
+ {
68
+ "cmd": "[v for v in #ACQ_jobs.nested if v[-1] == '<{}>'.format(@subtype)][0]",
69
+ "conditions": [
70
+ ["#ACQ_sw_version",["<PV-360.3.0>","<PV-360.3.1>","<PV-360.3.2>","<PV-360.3.3>","<PV-360.3.4>","<PV-360.3.5>","<PV-360.3.6>","<PV-360.3.7>"]]
71
+ ]
72
+ },
73
+
67
74
  {
68
75
  "cmd": "#ACQ_jobs.nested[0]",
69
76
  "conditions": [
@@ -88,7 +95,7 @@
88
95
  ],
89
96
  "shape_storage": [
90
97
  {
91
- "cmd": "(@job_desc[0],) + (@job_desc[3],)",
98
+ "cmd": "(@job_desc[0],) + (#PVM_EncNReceivers,) + (@job_desc[3],)",
92
99
  "conditions": []
93
100
  }
94
101
  ]
@@ -1 +1,65 @@
1
- {}
1
+ {
2
+ "subj_id": [
3
+ {
4
+ "cmd": "#SUBJECT_id[1:-1]",
5
+ "conditions": [
6
+
7
+ ]
8
+ },
9
+ {
10
+ "cmd": "''",
11
+ "conditions": [
12
+
13
+ ]
14
+ }
15
+ ],
16
+ "study_id": [
17
+ {
18
+ "cmd": "str(#SUBJECT_study_nr)",
19
+ "conditions": [
20
+
21
+ ]
22
+ },
23
+ {
24
+ "cmd": "''",
25
+ "conditions": [
26
+
27
+ ]
28
+ }
29
+ ],
30
+ "exp_id": [
31
+ {
32
+ "cmd": "@path.parent.name",
33
+ "conditions": [
34
+
35
+ ]
36
+ },
37
+ {
38
+ "cmd": "''",
39
+ "conditions": [
40
+
41
+ ]
42
+ }
43
+ ],
44
+ "id": [
45
+ {
46
+ "cmd": "f'RawData_{@subtype}_{@exp_id}_{@subj_id}_{@study_id}'",
47
+ "conditions": [
48
+ ]
49
+ }
50
+ ],
51
+ "TR": [
52
+ {
53
+ "cmd": "#PVM_RepetitionTime",
54
+ "conditions": [],
55
+ "unit": "ms"
56
+ }
57
+ ],
58
+ "TE": [
59
+ {
60
+ "cmd": "#PVM_EchoTime",
61
+ "conditions": [],
62
+ "unit": "ms"
63
+ }
64
+ ]
65
+ }
brukerapi/data.py CHANGED
@@ -1,8 +1,7 @@
1
- class DataRandomAccess():
2
-
1
+ class DataRandomAccess:
3
2
  def __init__(self, dataset):
4
3
  self._dataset = dataset
5
4
  self._scheme = dataset._scheme
6
5
 
7
6
  def __getitem__(self, slice):
8
- return self._scheme.ra(slice)
7
+ return self._scheme.ra(slice)