diff --git a/brukerapi/dataset.py b/brukerapi/dataset.py index 41ba197..32323ea 100644 --- a/brukerapi/dataset.py +++ b/brukerapi/dataset.py @@ -24,7 +24,7 @@ UnsuportedDatasetType, ) from .jcampdx import JCAMPDX -from .schemas import Schema2dseq, SchemaFid, SchemaRawdata, SchemaSer, SchemaTraj +from .schemas import Schema2dseq, SchemaFid, SchemaRawdata, SchemaTraj LOAD_STAGES = { "empty": 0, @@ -60,12 +60,6 @@ "load": LOAD_STAGES["all"], "mmap": False, }, - "ser": { - "parameter_files": ["acqp", "method"], - "property_files": [Path(__file__).parents[0] / "config/properties_ser_core.json", Path(__file__).parents[0] / "config/properties_ser_custom.json"], - "load": LOAD_STAGES["all"], - "mmap": False, - }, "rawdata": { "parameter_files": ["acqp", "method"], "property_files": [Path(__file__).parents[0] / "config/properties_rawdata_core.json", Path(__file__).parents[0] / "config/properties_rawdata_custom.json"], @@ -144,7 +138,6 @@ class Dataset: - **schema**: - :py:class:`~brukerapi.schemas.SchemaFid` - :py:class:`~brukerapi.schemas.Schema2dseq` - - :py:class:`~brukerapi.schemas.SchemaSer` - :py:class:`~brukerapi.schemas.SchemaRawdata` An object encapsulating all functionality dependent on metadata. It provides method to reshape data. @@ -197,6 +190,9 @@ def __init__(self, path, **state): self.subtype = self.subtype[1:] # remove the dot from the suffix self._properties = [] + if self.type not in DEFAULT_STATES: + raise UnsuportedDatasetType(self.type) + # set self._set_state(state) @@ -512,8 +508,6 @@ def load_schema(self): self._schema = Schema2dseq(self) elif self.type == "rawdata": self._schema = SchemaRawdata(self) - elif self.type == "ser": - self._schema = SchemaSer(self) elif self.type == "traj": self._schema = SchemaTraj(self) @@ -531,7 +525,7 @@ def load_data(self): deserialized into a data array. The process of deserialization is different for each data set type and is implemented in the individual subclasses of the :class:`brukerapi.schemas.Schema`, i.e. :class:`brukerapi.schemas.SchemaFid`, :class:`brukerapi.schemas.Schema2dseq`, - :class:`brukerapi.schemas.SchemaRawdata`, :class:`brukerapi.schemas.SchemaSer`. + :class:`brukerapi.schemas.SchemaRawdata`. If the object was created with random_access=True, the data is not read, instead it can be accessed using sub-arrays. diff --git a/brukerapi/schemas.py b/brukerapi/schemas.py index 62a0124..4975a81 100644 --- a/brukerapi/schemas.py +++ b/brukerapi/schemas.py @@ -462,28 +462,6 @@ def serialize(self, data, layouts): SchemaRawdata.seralize = SchemaRawdata.serialize -class SchemaSer(Schema): - @property - def layouts(self): - if self._layouts is not None: - return self._layouts - - PVM_SpecMatrix = self._dataset.get_value("PVM_SpecMatrix") - PVM_Matrix = self._dataset.get_value("PVM_Matrix") - PVM_EncNReceivers = self._dataset.get_value("PVM_EncNReceivers") - layouts = {} - layouts["raw"] = (PVM_SpecMatrix, PVM_EncNReceivers, PVM_Matrix[0], PVM_Matrix[1]) - return layouts - - def deserialize(self, data): - data = data[0::2] + 1j * data[1::2] - data = np.reshape(data, self.layouts["raw"], order="F") - return data - - def serialize(self, data): - raise NotImplementedError - - class Schema2dseq(Schema): """ Schema2dseq class diff --git a/test/test_dataset.py b/test/test_dataset.py index a642345..6fdaa6b 100644 --- a/test/test_dataset.py +++ b/test/test_dataset.py @@ -7,10 +7,19 @@ import pytest from brukerapi.dataset import Dataset +from brukerapi.exceptions import UnsuportedDatasetType data = 0 +def test_unsupported_dataset_type(tmp_path): + path = tmp_path / "unsupported" + path.touch() + + with pytest.raises(UnsuportedDatasetType, match="Dataset type: unsupported is not supported"): + Dataset(path) + + @pytest.mark.skip(reason="in progress") def test_parameters(test_parameters): dataset = Dataset(test_parameters[0], load=False) diff --git a/test/test_folders.py b/test/test_folders.py index 91bc0d9..ed183da 100644 --- a/test/test_folders.py +++ b/test/test_folders.py @@ -2,7 +2,7 @@ from brukerapi.folders import Folder, Processing -def test_folder_traversal_skips_ser_and_processed_spectra(tmp_path): +def test_folder_traversal_skips_processed_spectra(tmp_path): experiment_path = tmp_path / "1" processing_path = experiment_path / "pdata" / "1" processing_path.mkdir(parents=True) @@ -11,7 +11,6 @@ def test_folder_traversal_skips_ser_and_processed_spectra(tmp_path): experiment_path / "acqp", experiment_path / "method", experiment_path / "fid", - experiment_path / "ser", processing_path / "visu_pars", processing_path / "reco", processing_path / "2dseq",