From 0158e340cc103c6724e6f721dfc58558e5cba858 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 3 Sep 2022 00:25:49 +0200 Subject: Dataset is now loaded along the module --- szilagyi/_dataset/__init__.py | 10 +++++----- szilagyi/plots.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/szilagyi/_dataset/__init__.py b/szilagyi/_dataset/__init__.py index c91abc3..8ff88ae 100644 --- a/szilagyi/_dataset/__init__.py +++ b/szilagyi/_dataset/__init__.py @@ -3,9 +3,6 @@ import os import re -ROOT = os.path.dirname(os.path.abspath(__file__)) - - class Vector(complex): def __getitem__(self, index): if index == 0: @@ -16,7 +13,7 @@ class Vector(complex): raise IndexError -def load(): +def _load_from(root): def _read(iterable): for x, y in iterable: yield Vector(float(x), float(y)) @@ -32,4 +29,7 @@ def load(): if match: yield int(match.group(1)), os.path.join(directory, filename) - return [(x, _load(y)) for x, y in sorted(_files(ROOT), key=lambda x: x[0])] + return [(x, _load(y)) for x, y in sorted(_files(root), key=lambda x: x[0])] + + +INDICES = _load_from(os.path.dirname(os.path.abspath(__file__))) diff --git a/szilagyi/plots.py b/szilagyi/plots.py index 9e0c2c5..072a32d 100644 --- a/szilagyi/plots.py +++ b/szilagyi/plots.py @@ -15,7 +15,7 @@ def grid(start, end, steps): if __name__ == "__main__": - swis = _dataset.load() + swis = _dataset.INDICES def _swi(x, y): # dt, depth segments = find_boundary_curves(swis, x, y) -- cgit v1.1