brukerapi 0.2.3__tar.gz → 0.2.5__tar.gz
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-0.2.3/brukerapi.egg-info → brukerapi-0.2.5}/PKG-INFO +1 -1
- brukerapi-0.2.5/brukerapi/config/properties_traj_core.json +188 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/dataset.py +6 -5
- {brukerapi-0.2.3 → brukerapi-0.2.5/brukerapi.egg-info}/PKG-INFO +1 -1
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi.egg-info/SOURCES.txt +2 -1
- {brukerapi-0.2.3 → brukerapi-0.2.5}/pyproject.toml +1 -1
- brukerapi-0.2.5/test/test_trajectory.py +27 -0
- brukerapi-0.2.3/brukerapi/config/properties_traj_core.json +0 -109
- {brukerapi-0.2.3 → brukerapi-0.2.5}/LICENSE +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/MANIFEST.in +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/README.rst +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/__init__.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/cli.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_2dseq_core.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_2dseq_custom.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_fid_core.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_fid_custom.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_rawdata_core.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_rawdata_custom.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/config/properties_traj_custom.json +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/data.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/exceptions.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/folders.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/jcampdx.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/mergers.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/schemas.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/splitters.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi/utils.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi.egg-info/dependency_links.txt +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi.egg-info/entry_points.txt +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi.egg-info/not-zip-safe +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi.egg-info/requires.txt +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/brukerapi.egg-info/top_level.txt +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/setup.cfg +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/test/test_dataset.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/test/test_exceptions.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/test/test_jcampdx.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/test/test_random_access.py +0 -0
- {brukerapi-0.2.3 → brukerapi-0.2.5}/test/test_split.py +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
{
|
|
2
|
+
"numpy_dtype": [
|
|
3
|
+
{
|
|
4
|
+
"cmd": "np.dtype('f8')",
|
|
5
|
+
"conditions": []
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"scheme_id": [
|
|
9
|
+
{
|
|
10
|
+
"cmd": "'RADIAL'",
|
|
11
|
+
"conditions": [
|
|
12
|
+
[
|
|
13
|
+
"#PULPROG[1:-1]",
|
|
14
|
+
[
|
|
15
|
+
"UTE.ppg",
|
|
16
|
+
"UTE3D.ppg",
|
|
17
|
+
"IgUTE.ppg",
|
|
18
|
+
"ZTE.ppg"
|
|
19
|
+
]
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"#ACQ_sw_version",
|
|
23
|
+
[
|
|
24
|
+
"<PV 6.0.1>",
|
|
25
|
+
"<PV 5.1>",
|
|
26
|
+
"<PV-7.0.0>",
|
|
27
|
+
"<PV-360.3.0>",
|
|
28
|
+
"<PV-360.3.1>",
|
|
29
|
+
"<PV-360.3.2>",
|
|
30
|
+
"<PV-360.3.3>",
|
|
31
|
+
"<PV-360.3.4>",
|
|
32
|
+
"<PV-360.3.5>",
|
|
33
|
+
"<PV-360.3.6>",
|
|
34
|
+
"<PV-360.3.7>"
|
|
35
|
+
]
|
|
36
|
+
]
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cmd": "'SPIRAL'",
|
|
41
|
+
"conditions": [
|
|
42
|
+
[
|
|
43
|
+
"#PULPROG[1:-1]",
|
|
44
|
+
[
|
|
45
|
+
"SPIRAL.ppg",
|
|
46
|
+
"DtiSpiral.ppg"
|
|
47
|
+
]
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"#ACQ_sw_version",
|
|
51
|
+
[
|
|
52
|
+
"<PV 6.0.1>",
|
|
53
|
+
"<PV 5.1>",
|
|
54
|
+
"<PV-7.0.0>",
|
|
55
|
+
"<PV-360.3.0>",
|
|
56
|
+
"<PV-360.3.1>",
|
|
57
|
+
"<PV-360.3.2>",
|
|
58
|
+
"<PV-360.3.3>",
|
|
59
|
+
"<PV-360.3.4>",
|
|
60
|
+
"<PV-360.3.5>",
|
|
61
|
+
"<PV-360.3.6>",
|
|
62
|
+
"<PV-360.3.7>"
|
|
63
|
+
]
|
|
64
|
+
]
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"cmd": "'ZTE'",
|
|
69
|
+
"conditions": [
|
|
70
|
+
[
|
|
71
|
+
"#PULPROG[1:-1]",
|
|
72
|
+
[
|
|
73
|
+
"ZTE.ppg"
|
|
74
|
+
]
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"#ACQ_sw_version",
|
|
78
|
+
[
|
|
79
|
+
"<PV 6.0.1>",
|
|
80
|
+
"<PV 5.1>"
|
|
81
|
+
]
|
|
82
|
+
]
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"traj_type": [
|
|
87
|
+
{
|
|
88
|
+
"cmd": "'radial'",
|
|
89
|
+
"conditions": [
|
|
90
|
+
[
|
|
91
|
+
"@scheme_id",
|
|
92
|
+
[
|
|
93
|
+
"RADIAL",
|
|
94
|
+
"ZTE"
|
|
95
|
+
]
|
|
96
|
+
]
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"cmd": "'spiral'",
|
|
101
|
+
"conditions": [
|
|
102
|
+
[
|
|
103
|
+
"@scheme_id",
|
|
104
|
+
[
|
|
105
|
+
"SPIRAL"
|
|
106
|
+
]
|
|
107
|
+
]
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"shape_storage": [
|
|
112
|
+
{
|
|
113
|
+
"cmd": "(#ACQ_dim, int(os.stat(self.path).st_size // @numpy_dtype.itemsize // #ACQ_dim // #NPro), #NPro)",
|
|
114
|
+
"conditions": [
|
|
115
|
+
[
|
|
116
|
+
"@scheme_id",
|
|
117
|
+
[
|
|
118
|
+
"RADIAL",
|
|
119
|
+
"ZTE"
|
|
120
|
+
]
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"cmd": "(#ACQ_dim, int(os.stat(self.path).st_size // @numpy_dtype.itemsize // #ACQ_dim // #PVM_SpiralNbOfInterleaves), #PVM_SpiralNbOfInterleaves)",
|
|
126
|
+
"conditions": [
|
|
127
|
+
[
|
|
128
|
+
"@scheme_id",
|
|
129
|
+
[
|
|
130
|
+
"SPIRAL"
|
|
131
|
+
]
|
|
132
|
+
]
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"permute": [
|
|
137
|
+
{
|
|
138
|
+
"cmd": [
|
|
139
|
+
0,
|
|
140
|
+
1,
|
|
141
|
+
2
|
|
142
|
+
],
|
|
143
|
+
"conditions": [
|
|
144
|
+
[
|
|
145
|
+
"@scheme_id",
|
|
146
|
+
[
|
|
147
|
+
"RADIAL",
|
|
148
|
+
"ZTE",
|
|
149
|
+
"SPIRAL"
|
|
150
|
+
]
|
|
151
|
+
]
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"final": [
|
|
156
|
+
{
|
|
157
|
+
"cmd": [
|
|
158
|
+
"#ACQ_dim",
|
|
159
|
+
"int(os.stat(self.path).st_size // @numpy_dtype.itemsize // #ACQ_dim // #NPro)",
|
|
160
|
+
"#NPro"
|
|
161
|
+
],
|
|
162
|
+
"conditions": [
|
|
163
|
+
[
|
|
164
|
+
"@scheme_id",
|
|
165
|
+
[
|
|
166
|
+
"RADIAL",
|
|
167
|
+
"ZTE"
|
|
168
|
+
]
|
|
169
|
+
]
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"cmd": [
|
|
174
|
+
"#ACQ_dim",
|
|
175
|
+
"int(os.stat(self.path).st_size // @numpy_dtype.itemsize // #ACQ_dim // #PVM_SpiralNbOfInterleaves)",
|
|
176
|
+
"#PVM_SpiralNbOfInterleaves"
|
|
177
|
+
],
|
|
178
|
+
"conditions": [
|
|
179
|
+
[
|
|
180
|
+
"@scheme_id",
|
|
181
|
+
[
|
|
182
|
+
"SPIRAL"
|
|
183
|
+
]
|
|
184
|
+
]
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
@@ -291,7 +291,7 @@ class Dataset:
|
|
|
291
291
|
|
|
292
292
|
self.load_schema()
|
|
293
293
|
self.load_data()
|
|
294
|
-
|
|
294
|
+
self.load_traj()
|
|
295
295
|
|
|
296
296
|
def unload(self):
|
|
297
297
|
"""
|
|
@@ -455,7 +455,7 @@ class Dataset:
|
|
|
455
455
|
:return: value of property, or list of values of properties
|
|
456
456
|
"""
|
|
457
457
|
if isinstance(cmd, str):
|
|
458
|
-
return eval(self._sub_parameters(cmd))
|
|
458
|
+
return eval(self._sub_parameters(cmd), {**globals(), "self": self})
|
|
459
459
|
if isinstance(cmd, (int, float)):
|
|
460
460
|
return cmd
|
|
461
461
|
if isinstance(cmd, list):
|
|
@@ -588,9 +588,10 @@ class Dataset:
|
|
|
588
588
|
|
|
589
589
|
def load_traj(self, **kwargs):
|
|
590
590
|
if Path(self.path.parent / "traj").exists() and self.type != "traj":
|
|
591
|
-
self._traj = Dataset(self.path.parent / "traj", load=
|
|
591
|
+
self._traj = Dataset(self.path.parent / "traj", load=LOAD_STAGES["empty"])
|
|
592
592
|
self._traj._parameters = self.parameters
|
|
593
|
-
self._traj.
|
|
593
|
+
self._traj.load_properties()
|
|
594
|
+
self._traj._schema = SchemaTraj(self._traj)
|
|
594
595
|
self._traj.load_data()
|
|
595
596
|
else:
|
|
596
597
|
self._traj = None
|
|
@@ -730,7 +731,7 @@ class Dataset:
|
|
|
730
731
|
|
|
731
732
|
for q in query:
|
|
732
733
|
try:
|
|
733
|
-
if not eval(self._sub_parameters(q)):
|
|
734
|
+
if not eval(self._sub_parameters(q), {**globals(), "self": self}):
|
|
734
735
|
raise FilterEvalFalse
|
|
735
736
|
except (KeyError, AttributeError) as e:
|
|
736
737
|
raise FilterEvalFalse from e
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from brukerapi.dataset import Dataset
|
|
6
|
+
|
|
7
|
+
TRAJ_PATHS = sorted(Path("test/test_data").rglob("traj"))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.parametrize("traj_path", TRAJ_PATHS, ids=[str(path) for path in TRAJ_PATHS])
|
|
11
|
+
def test_traj_loads_directly(traj_path):
|
|
12
|
+
dataset = Dataset(traj_path)
|
|
13
|
+
|
|
14
|
+
assert dataset.data.shape == dataset.shape_storage
|
|
15
|
+
assert dataset.data.size > 0
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.mark.parametrize("traj_path", TRAJ_PATHS, ids=[str(path) for path in TRAJ_PATHS])
|
|
19
|
+
def test_traj_loads_from_parent_fid(traj_path):
|
|
20
|
+
parent_path = traj_path.parent / "fid"
|
|
21
|
+
if not parent_path.exists():
|
|
22
|
+
parent_path = traj_path.parent / "rawdata.job0"
|
|
23
|
+
|
|
24
|
+
dataset = Dataset(parent_path)
|
|
25
|
+
|
|
26
|
+
assert dataset.traj.shape == dataset._traj.shape_storage
|
|
27
|
+
assert dataset.traj.size > 0
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"numpy_dtype": [
|
|
3
|
-
{
|
|
4
|
-
"cmd": "np.dtype('i4')",
|
|
5
|
-
"conditions": []
|
|
6
|
-
}
|
|
7
|
-
],
|
|
8
|
-
"scheme_id": [
|
|
9
|
-
{
|
|
10
|
-
"cmd": "'RADIAL'" ,
|
|
11
|
-
"conditions": [
|
|
12
|
-
["#PULPROG[1:-1]",
|
|
13
|
-
[
|
|
14
|
-
"UTE.ppg",
|
|
15
|
-
"UTE3D.ppg",
|
|
16
|
-
"ZTE.ppg"
|
|
17
|
-
]
|
|
18
|
-
],
|
|
19
|
-
["#ACQ_sw_version",
|
|
20
|
-
[
|
|
21
|
-
"<PV 6.0.1>",
|
|
22
|
-
"<PV 5.1>"
|
|
23
|
-
]
|
|
24
|
-
]
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"cmd": "'SPIRAL'" ,
|
|
29
|
-
"conditions": [
|
|
30
|
-
["#PULPROG[1:-1]",
|
|
31
|
-
[
|
|
32
|
-
"SPIRAL.ppg",
|
|
33
|
-
"DtiSpiral.ppg"
|
|
34
|
-
]
|
|
35
|
-
],
|
|
36
|
-
["#ACQ_sw_version",
|
|
37
|
-
[
|
|
38
|
-
"<PV 6.0.1>",
|
|
39
|
-
"<PV 5.1>"
|
|
40
|
-
]
|
|
41
|
-
]
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"cmd": "'ZTE'" ,
|
|
46
|
-
"conditions": [
|
|
47
|
-
["#PULPROG[1:-1]",
|
|
48
|
-
[
|
|
49
|
-
"ZTE.ppg"
|
|
50
|
-
]
|
|
51
|
-
],
|
|
52
|
-
["#ACQ_sw_version",
|
|
53
|
-
[
|
|
54
|
-
"<PV 6.0.1>",
|
|
55
|
-
"<PV 5.1>"
|
|
56
|
-
]
|
|
57
|
-
]
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"traj_type": [
|
|
62
|
-
{
|
|
63
|
-
"cmd": "'radial'",
|
|
64
|
-
"conditions": [["@scheme_id",["'RADIAL'","'ZTE'"]]]
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"cmd": "'spiral'",
|
|
68
|
-
"conditions": [["@scheme_id",["SPIRAL"]]]
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"shape_storage": [
|
|
72
|
-
{
|
|
73
|
-
"cmd": "(#ACQ_dim,#ACQ_size[0]//2,#NPro)",
|
|
74
|
-
"conditions": [["@scheme_id",["RADIAL","ZTE"]]]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"cmd": "(#ACQ_dim,#ACQ_size[0]//2,#PVM_SpiralNbOfInterleaves)",
|
|
78
|
-
"conditions": [["@scheme_id",["SPIRAL"]]]
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"permute": [
|
|
82
|
-
{
|
|
83
|
-
"cmd": [
|
|
84
|
-
0,
|
|
85
|
-
1,
|
|
86
|
-
2
|
|
87
|
-
],
|
|
88
|
-
"conditions": [["@scheme_id",["RADIAL","ZTE","SPIRAL"]]]
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"final": [
|
|
92
|
-
{
|
|
93
|
-
"cmd": [
|
|
94
|
-
"#ACQ_dim",
|
|
95
|
-
"#ACQ_size[0]//2",
|
|
96
|
-
"#NPro"
|
|
97
|
-
],
|
|
98
|
-
"conditions": [["@scheme_id",["RADIAL","ZTE"]]]
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"cmd": [
|
|
102
|
-
"#ACQ_dim",
|
|
103
|
-
"#ACQ_size[0]//2",
|
|
104
|
-
"#PVM_SpiralNbOfInterleaves"
|
|
105
|
-
],
|
|
106
|
-
"conditions": [["@scheme_id",["SPIRAL"]]]
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|