diff --git a/Manifest.toml b/Manifest.toml index 08542ee45b7c05f53cfdd46660647bc471bc4647..41892f5aeb9a9a23c6b2761170d5bf15296e0d3d 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -312,11 +312,11 @@ version = "1.9.2" [[deps.PlanarLarvae]] deps = ["DelimitedFiles", "HDF5", "JSON3", "LinearAlgebra", "MAT", "Meshes", "OrderedCollections", "Random", "SHA", "StaticArrays", "Statistics", "StatsBase", "StructTypes"] -git-tree-sha1 = "3672831638c71be6e111ffde3376580d0d2bfaf5" -repo-rev = "3bffeb68ab85f82c048bcb5aea3d19048e211ef9" +git-tree-sha1 = "6b2dc28d56bcef101672cbf2bb784bbd5d88d579" +repo-rev = "main" repo-url = "https://gitlab.pasteur.fr/nyx/PlanarLarvae.jl" uuid = "c2615984-ef14-4d40-b148-916c85b43307" -version = "0.14.0" +version = "0.15.0" [[deps.PrecompileTools]] deps = ["Preferences"] diff --git a/src/taggingbackends/data/dataset.py b/src/taggingbackends/data/dataset.py index 0700b0ac2795c3b941b220f1a0ff5568bbc5990c..008a7af69cf265cbe33b17701304d34b10f455ae 100644 --- a/src/taggingbackends/data/dataset.py +++ b/src/taggingbackends/data/dataset.py @@ -26,16 +26,29 @@ class LarvaDataset: self.weight_classes = isinstance(balancing_strategy, str) and (balancing_strategy.lower() == 'auto') else: self.class_weights = class_weights + self._path = None """ *h5py.File*: *larva_dataset hdf5* file handler. """ @property def full_set(self): - if isinstance(self._full_set, (str, pathlib.Path)): - self._full_set = h5py.File(str(self._full_set), "r") + if not isinstance(self._full_set, h5py.File): + self._full_set = h5py.File(str(self.path), "r") return self._full_set """ + *pathlib.Path*: file path. + """ + @property + def path(self): + if self._path is None: + if isinstance(self._full_set, (str, pathlib.Path)): + self.path = self._full_set + return self._path + @path.setter + def path(self, p): + self._path = p if isinstance(p, pathlib.Path) else pathlib.Path(p) + """ *list* of *bytes*: Set of distinct labels. If the hdf5 file does not feature a top-level `labels` element that lists