From 61b2a2c35bfe59e19d57fca540e940ae01d8682a Mon Sep 17 00:00:00 2001 From: pswain <peter.swain@ed.ac.uk> Date: Thu, 1 Dec 2022 20:01:05 +0000 Subject: [PATCH] changed @cached_property to @property to run in 3.7 --- src/agora/io/cells.py | 6 +++--- src/agora/io/signal.py | 17 +++++++++-------- src/aliby/pipeline.py | 8 ++++++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/agora/io/cells.py b/src/agora/io/cells.py index d1108691..d86b3a13 100644 --- a/src/agora/io/cells.py +++ b/src/agora/io/cells.py @@ -3,7 +3,7 @@ import typing as t from collections.abc import Iterable from itertools import groupby from pathlib import Path, PosixPath -from functools import lru_cache, cached_property +from functools import lru_cache import h5py import numpy as np @@ -268,7 +268,7 @@ class Cells: def mothers_in_trap(self, trap_id: int): return self.mothers[trap_id] - @cached_property + @property def mothers(self): """ Return nested list with final prediction of mother id for each cell @@ -280,7 +280,7 @@ class Cells: self.ntraps, ) - @cached_property + @property def mothers_daughters(self) -> np.ndarray: """ Return mothers and daugters as a single array with three columns: diff --git a/src/agora/io/signal.py b/src/agora/io/signal.py index 489a5256..ca1858ab 100644 --- a/src/agora/io/signal.py +++ b/src/agora/io/signal.py @@ -1,6 +1,7 @@ import typing as t from copy import copy -from functools import cached_property, lru_cache +#from functools import cached_property, lru_cache +from functools import lru_cache from pathlib import PosixPath import bottleneck as bn @@ -77,12 +78,12 @@ class Signal(BridgeH5): ) return df - @cached_property + @property def ntimepoints(self): with h5py.File(self.filename, "r") as f: return f["extraction/general/None/area/timepoint"][-1] + 1 - @cached_property + @property def tinterval(self) -> int: tinterval_location = "time_settings/timeinterval" with h5py.File(self.filename, "r") as f: @@ -214,12 +215,12 @@ class Signal(BridgeH5): for sig in self.siglist: print(sig) - @cached_property + @property def p_available(self): """Print signal list""" self.datasets - @cached_property + @property def available(self): """Return list of available signals""" try: @@ -237,17 +238,17 @@ class Signal(BridgeH5): def get_merged(self, dataset): return self.apply_prepost(dataset, picks=False) - @cached_property + @property def merges(self): with h5py.File(self.filename, "r") as f: dsets = f.visititems(self._if_merges) return dsets - @cached_property + @property def n_merges(self): return len(self.merges) - @cached_property + @property def picks(self): with h5py.File(self.filename, "r") as f: dsets = f.visititems(self._if_picks) diff --git a/src/aliby/pipeline.py b/src/aliby/pipeline.py index 00f50a38..71e066f5 100644 --- a/src/aliby/pipeline.py +++ b/src/aliby/pipeline.py @@ -7,7 +7,11 @@ import re import traceback import typing as t from copy import copy -from importlib.metadata import version +try: + from importlib.metadata import version +except ImportError: + # for python < 3.8 + from importlib_metadata import version from pathlib import Path, PosixPath from time import perf_counter from typing import Union @@ -597,7 +601,7 @@ class Pipeline(ProcessABC): ]: """ Initialise pipeline components and if necessary use - exising file to continue existing experiments. + existing file to continue existing experiments. Parameters -- GitLab