Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions nolds/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
oct, open, pow, round, super, filter, map, zip
)
import numpy as np
import pkg_resources
from importlib import resources
import datetime


Expand Down Expand Up @@ -144,7 +144,7 @@ def load_qrandom():
the dataset
"""
fname = "datasets/qrandom.npy"
with pkg_resources.resource_stream(__name__, fname) as f:
with resources.files(__name__).joinpath(fname).open('rb') as f:
return np.load(f)


Expand All @@ -159,7 +159,7 @@ def load_brown72():
the dataset
"""
fname = "datasets/brown72.npy"
with pkg_resources.resource_stream(__name__, fname) as f:
with resources.files(__name__).joinpath(fname).open('rb') as f:
return np.load(f)


Expand All @@ -185,10 +185,10 @@ def load_lorenz_physionet():
x- and y-coordinates of the line fitting step in the PhysioNet output
"""
fname = "datasets/lorenz.txt"
with pkg_resources.resource_stream(__name__, fname) as f:
with resources.files(__name__).joinpath(fname).open('rb') as f:
data_in = np.loadtxt(f)
fname = "datasets/lorenz_physionet.txt"
with pkg_resources.resource_stream(__name__, fname) as f:
with resources.files(__name__).joinpath(fname).open('rb') as f:
data_out = np.loadtxt(f)
return data_in, data_out

Expand Down Expand Up @@ -393,7 +393,7 @@ def pad_opening_values(values):
data = []
for index in ["^JKSE", "^N225", "^NDX"]:
fname = "datasets/{}.csv".format(index)
with pkg_resources.resource_stream(__name__, fname) as f:
with resources.files(__name__).joinpath(fname).open('rb') as f:
days, values = load_finance_yahoo_data(f)
pad_opening_values(values)
data.append((days, values))
Expand Down
Loading