summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-09-03 00:25:49 +0200
committerAki <please@ignore.pl>2022-09-03 00:25:49 +0200
commit0158e340cc103c6724e6f721dfc58558e5cba858 (patch)
tree5445ad402d1cb15e3a2687cbe13628f875c86e3a
parent5013752d8649b6b2070f1e2f8a3817db28416dbd (diff)
downloadszilagyi-0158e340cc103c6724e6f721dfc58558e5cba858.zip
szilagyi-0158e340cc103c6724e6f721dfc58558e5cba858.tar.gz
szilagyi-0158e340cc103c6724e6f721dfc58558e5cba858.tar.bz2
Dataset is now loaded along the module
-rw-r--r--szilagyi/_dataset/__init__.py10
-rw-r--r--szilagyi/plots.py2
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)