Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions pytorch_wavelets/dtcwt/coeffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from __future__ import absolute_import

from numpy import load
from pkg_resources import resource_stream
from importlib.resources import files
from numpy import load

try:
import pywt
_HAVE_PYWT = True
Expand All @@ -19,10 +21,12 @@ def _load_from_file(basename, varnames):
try:
mat = COEFF_CACHE[basename]
except KeyError:
with resource_stream('pytorch_wavelets.dtcwt.data', basename + '.npz') as f:
data_path = files('pytorch_wavelets.dtcwt.data').joinpath(f'{basename}.npz')
with data_path.open('rb') as f:
mat = dict(load(f))
COEFF_CACHE[basename] = mat


try:
return tuple(mat[k] for k in varnames)
except KeyError:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy
torch>=1.0.0
PyWavelets>=1.0.0
importlib_resources >= 6.5 ; python_version >= "3.14"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import re

from setuptools import setup, find_packages
from setuptools import setup


# Utility function to read the README file.
Expand All @@ -25,7 +25,7 @@ def read(fname):
license="Free To Use",
keywords="pytorch, DWT, DTCWT, wavelet, complex wavelet",
url="https://github.com/fbcotter/pytorch_wavelets",
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
packages=["pytorch_wavelets","pytorch_wavelets.dtcwt","pytorch_wavelets.dtcwt.data","pytorch_wavelets.dwt","pytorch_wavelets.scatternet"],
long_description=read('README.rst'),
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down