brukerapi 0.2.0__tar.gz → 0.2.3__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.0/brukerapi.egg-info → brukerapi-0.2.3}/PKG-INFO +2 -1
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_fid_custom.json +1 -1
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/dataset.py +27 -7
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/exceptions.py +13 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/folders.py +3 -2
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/schemas.py +14 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3/brukerapi.egg-info}/PKG-INFO +2 -1
- {brukerapi-0.2.0 → brukerapi-0.2.3}/pyproject.toml +5 -1
- {brukerapi-0.2.0 → brukerapi-0.2.3}/LICENSE +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/MANIFEST.in +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/README.rst +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/__init__.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/cli.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_2dseq_core.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_2dseq_custom.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_fid_core.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_rawdata_core.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_rawdata_custom.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_traj_core.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/config/properties_traj_custom.json +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/data.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/jcampdx.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/mergers.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/splitters.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi/utils.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi.egg-info/SOURCES.txt +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi.egg-info/dependency_links.txt +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi.egg-info/entry_points.txt +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi.egg-info/not-zip-safe +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi.egg-info/requires.txt +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/brukerapi.egg-info/top_level.txt +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/setup.cfg +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/test/test_dataset.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/test/test_exceptions.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/test/test_jcampdx.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/test/test_random_access.py +0 -0
- {brukerapi-0.2.0 → brukerapi-0.2.3}/test/test_split.py +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: brukerapi
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Bruker API
|
|
5
5
|
Author-email: Tomas Psorn <tomaspsorn@isibrno.cz>, Jiri Vitous <vitous@isibrno.cz>
|
|
6
|
+
Maintainer-email: Jiri Vitous <vitous@isibrno.cz>
|
|
6
7
|
License: MIT
|
|
7
8
|
Project-URL: Homepage, https://github.com/isi-nmr/brukerapi-python
|
|
8
9
|
Project-URL: Download, https://github.com/isi-nmr/brukerapi-python/releases/latest
|
|
@@ -15,6 +15,7 @@ from .exceptions import (
|
|
|
15
15
|
DatasetTypeMissmatch,
|
|
16
16
|
FilterEvalFalse,
|
|
17
17
|
IncompleteDataset,
|
|
18
|
+
InvalidDataset,
|
|
18
19
|
NotADatasetDir,
|
|
19
20
|
ParametersNotLoaded,
|
|
20
21
|
PropertyConditionNotMet,
|
|
@@ -40,6 +41,12 @@ DEFAULT_STATES = {
|
|
|
40
41
|
"load": LOAD_STAGES["all"],
|
|
41
42
|
"mmap": False,
|
|
42
43
|
},
|
|
44
|
+
"fid_proc": {
|
|
45
|
+
"parameter_files": ["acqp", "method"],
|
|
46
|
+
"property_files": [Path(__file__).parents[0] / "config/properties_fid_core.json", Path(__file__).parents[0] / "config/properties_fid_custom.json"],
|
|
47
|
+
"load": LOAD_STAGES["all"],
|
|
48
|
+
"mmap": False,
|
|
49
|
+
},
|
|
43
50
|
"2dseq": {
|
|
44
51
|
"parameter_files": ["visu_pars"],
|
|
45
52
|
"property_files": [Path(__file__).parents[0] / "config/properties_2dseq_core.json", Path(__file__).parents[0] / "config/properties_2dseq_custom.json"],
|
|
@@ -77,6 +84,15 @@ RELATIVE_PATHS = {
|
|
|
77
84
|
"AdjStatePerScan": "./AdjStatePerScan",
|
|
78
85
|
"AdjStatePerStudy": "../AdjStatePerStudy",
|
|
79
86
|
},
|
|
87
|
+
"fid_proc": {
|
|
88
|
+
"method": "../../method",
|
|
89
|
+
"acqp": "../../acqp",
|
|
90
|
+
"subject": "../../../subject",
|
|
91
|
+
"reco": "./reco",
|
|
92
|
+
"visu_pars": "./visu_pars",
|
|
93
|
+
"AdjStatePerScan": "../../AdjStatePerScan",
|
|
94
|
+
"AdjStatePerStudy": "../../../AdjStatePerStudy",
|
|
95
|
+
},
|
|
80
96
|
"2dseq": {
|
|
81
97
|
"method": "../../method",
|
|
82
98
|
"acqp": "../../acqp",
|
|
@@ -156,7 +172,7 @@ class Dataset:
|
|
|
156
172
|
containing it. It is possible, to create an empty object using the load switch.
|
|
157
173
|
|
|
158
174
|
:param path: **str** path to dataset
|
|
159
|
-
:raise: :
|
|
175
|
+
:raise: :UnsupportedDatasetType: In case `Dataset.type` is not in SUPPORTED
|
|
160
176
|
:raise: :IncompleteDataset: If any of the JCAMP-DX files, necessary to create a Dataset instance is missing
|
|
161
177
|
|
|
162
178
|
"""
|
|
@@ -248,8 +264,11 @@ class Dataset:
|
|
|
248
264
|
raise UnsuportedDatasetType(self.type)
|
|
249
265
|
|
|
250
266
|
# Check whether all necessary JCAMP-DX files are present
|
|
251
|
-
if self._state.get("load") >= LOAD_STAGES["parameters"]
|
|
252
|
-
|
|
267
|
+
if self._state.get("load") >= LOAD_STAGES["parameters"]:
|
|
268
|
+
for i in DEFAULT_STATES[self.type]["parameter_files"]:
|
|
269
|
+
param_path = self.path.parent / RELATIVE_PATHS[self.type][i]
|
|
270
|
+
if i not in set(os.listdir(str(param_path.parent))):
|
|
271
|
+
raise IncompleteDataset
|
|
253
272
|
|
|
254
273
|
def load(self):
|
|
255
274
|
"""
|
|
@@ -381,7 +400,8 @@ class Dataset:
|
|
|
381
400
|
|
|
382
401
|
def unload_properties(self):
|
|
383
402
|
for property in self._properties:
|
|
384
|
-
|
|
403
|
+
if hasattr(self, property):
|
|
404
|
+
delattr(self, property)
|
|
385
405
|
self._properties = []
|
|
386
406
|
self._state["load_properties"] = False
|
|
387
407
|
|
|
@@ -486,7 +506,7 @@ class Dataset:
|
|
|
486
506
|
"""
|
|
487
507
|
Load the schema for given data set.
|
|
488
508
|
"""
|
|
489
|
-
if self.type
|
|
509
|
+
if self.type in ["fid", "fid_proc"]:
|
|
490
510
|
self._schema = SchemaFid(self)
|
|
491
511
|
elif self.type == "2dseq":
|
|
492
512
|
self._schema = Schema2dseq(self)
|
|
@@ -545,11 +565,11 @@ class Dataset:
|
|
|
545
565
|
-------
|
|
546
566
|
1D ndarray containing the full data vector
|
|
547
567
|
"""
|
|
548
|
-
|
|
568
|
+
|
|
549
569
|
try:
|
|
550
570
|
assert os.stat(str(path)).st_size == np.prod(shape) * dtype.itemsize
|
|
551
571
|
except AssertionError:
|
|
552
|
-
raise
|
|
572
|
+
raise InvalidDataset("Invalid dataset, dimension mismatch") from AssertionError
|
|
553
573
|
|
|
554
574
|
return np.array(np.memmap(path, dtype=dtype, shape=shape, order="F")[:])
|
|
555
575
|
|
|
@@ -248,6 +248,19 @@ class DataNotLoaded(Exception):
|
|
|
248
248
|
return "DataNotLoaded"
|
|
249
249
|
|
|
250
250
|
|
|
251
|
+
class InvalidDataset(Exception):
|
|
252
|
+
def __init__(self, *args):
|
|
253
|
+
if args:
|
|
254
|
+
self.message = args[0]
|
|
255
|
+
else:
|
|
256
|
+
self.message = None
|
|
257
|
+
|
|
258
|
+
def __str__(self):
|
|
259
|
+
if self.message:
|
|
260
|
+
return f"{self.message}"
|
|
261
|
+
return "Invalid dataset loaded"
|
|
262
|
+
|
|
263
|
+
|
|
251
264
|
class TrajNotLoaded(Exception):
|
|
252
265
|
def __init__(self, *args):
|
|
253
266
|
if args:
|
|
@@ -7,6 +7,7 @@ from .dataset import Dataset
|
|
|
7
7
|
from .exceptions import (
|
|
8
8
|
FilterEvalFalse,
|
|
9
9
|
IncompleteDataset,
|
|
10
|
+
InvalidDataset,
|
|
10
11
|
InvalidJcampdxFile,
|
|
11
12
|
JcampdxVersionError,
|
|
12
13
|
NotADatasetDir,
|
|
@@ -17,7 +18,7 @@ from .exceptions import (
|
|
|
17
18
|
)
|
|
18
19
|
from .jcampdx import JCAMPDX
|
|
19
20
|
|
|
20
|
-
DEFAULT_DATASET_STATE = {"parameter_files": [], "property_files": [], "load":
|
|
21
|
+
DEFAULT_DATASET_STATE = {"parameter_files": [], "property_files": [], "load": 3}
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class Folder:
|
|
@@ -220,7 +221,7 @@ class Folder:
|
|
|
220
221
|
if path.name in self._dataset_index or (path.name.partition(".")[0] in self._dataset_index and "rawdata" in path.name):
|
|
221
222
|
try:
|
|
222
223
|
children.append(Dataset(path, **self._dataset_state))
|
|
223
|
-
except (UnsuportedDatasetType, IncompleteDataset, NotADatasetDir):
|
|
224
|
+
except (UnsuportedDatasetType, IncompleteDataset, NotADatasetDir, InvalidDataset):
|
|
224
225
|
continue
|
|
225
226
|
|
|
226
227
|
try:
|
|
@@ -10,6 +10,20 @@ config_paths = {"core": Path(__file__).parents[0] / "config", "custom": Path(__f
|
|
|
10
10
|
# properties required for loading of the data array for each dataset type
|
|
11
11
|
REQUIRED_PROPERTIES = {
|
|
12
12
|
"fid": ["numpy_dtype", "channels", "block_size", "acq_lenght", "scheme_id", "block_count", "encoding_space", "permute", "k_space", "encoded_dim", "shape_storage", "dim_type"],
|
|
13
|
+
"fid_proc": [
|
|
14
|
+
"numpy_dtype",
|
|
15
|
+
"channels",
|
|
16
|
+
"block_size",
|
|
17
|
+
"acq_lenght",
|
|
18
|
+
"scheme_id",
|
|
19
|
+
"block_count",
|
|
20
|
+
"encoding_space",
|
|
21
|
+
"permute",
|
|
22
|
+
"k_space",
|
|
23
|
+
"encoded_dim",
|
|
24
|
+
"shape_storage",
|
|
25
|
+
"dim_type"
|
|
26
|
+
],
|
|
13
27
|
"2dseq": [
|
|
14
28
|
"pv_version",
|
|
15
29
|
"numpy_dtype",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: brukerapi
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Bruker API
|
|
5
5
|
Author-email: Tomas Psorn <tomaspsorn@isibrno.cz>, Jiri Vitous <vitous@isibrno.cz>
|
|
6
|
+
Maintainer-email: Jiri Vitous <vitous@isibrno.cz>
|
|
6
7
|
License: MIT
|
|
7
8
|
Project-URL: Homepage, https://github.com/isi-nmr/brukerapi-python
|
|
8
9
|
Project-URL: Download, https://github.com/isi-nmr/brukerapi-python/releases/latest
|
|
@@ -4,12 +4,14 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "brukerapi"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Bruker API"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Tomas Psorn", email = "tomaspsorn@isibrno.cz" },
|
|
11
11
|
{ name = "Jiri Vitous", email = "vitous@isibrno.cz" },
|
|
12
12
|
]
|
|
13
|
+
maintainers = [{ name = "Jiri Vitous", email = "vitous@isibrno.cz" }]
|
|
14
|
+
|
|
13
15
|
license = { text = "MIT" }
|
|
14
16
|
readme = "README.rst"
|
|
15
17
|
requires-python = ">=3.8"
|
|
@@ -18,6 +20,8 @@ dependencies = [
|
|
|
18
20
|
"numpy>=1.26.0; python_version>='3.9'",
|
|
19
21
|
"pyyaml",
|
|
20
22
|
]
|
|
23
|
+
|
|
24
|
+
|
|
21
25
|
urls = { "Homepage" = "https://github.com/isi-nmr/brukerapi-python", "Download" = "https://github.com/isi-nmr/brukerapi-python/releases/latest" }
|
|
22
26
|
|
|
23
27
|
[project.scripts]
|
|
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
|