Skip to content
Snippets Groups Projects
Commit f6916d00 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

Added .npy loading helper.

parent 46f004c9
Branches
No related tags found
No related merge requests found
import numpy as np
import tensorflow as tf
from operator import itemgetter
from os import listdir, path
class SKDict(dict):
......@@ -210,3 +211,11 @@ class DSS(SKDict):
k: self[k].map(lambda x: x * (ref / s))
for k, s in sums.items()
})
@classmethod
def from_npy(cls, dir, sep="_", **kwargs):
return cls({
tuple(fn[:-4].split(sep)): np.load(path.join(dir, fn), **kwargs)
for fn in listdir(dir)
if fn.endswith(".npy")
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment