Skip to content

Commit 8bdfecc

Browse files
bwohlbergBrendt Wohlberg
andauthored
Resolve some deprecation warnings (#36)
* Resolve some deprecation warnings * Bump tested python versions * Update docs requirements * Loosen test threshold * Resolve warnings * Add requirement for example script * Resolve some errors and warnings * Update change summary * Clean up * Grammar fix * Bug fix * Fix some bugs due to changed sphinx functions * Fix bug due to changed sphinx functions * Bug fix --------- Co-authored-by: Brendt Wohlberg <brendt@lanl.gov>
1 parent eb6a915 commit 8bdfecc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+109
-101
lines changed

.github/workflows/pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.11", "3.12"]
19+
python-version: ["3.12", "3.13"]
2020
os: [ubuntu-latest, macOS-latest, windows-latest]
2121

2222
steps:

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Version 0.2.2 (unreleased)
88

99
• Removed deprecated sporco.fista modules
1010
• Removed deprecation warning redirects for functions renamed in 0.2.0
11+
• Resolved a number of deprecation warnings
12+
• Fixed bugs in a number of example scripts
1113

1214

1315
Version 0.2.1 (2022-02-17)

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
future
22
scipy
3+
filetype
34
matplotlib
45
sphinx>=5.0.0
56
numpydoc

docs/source/docntbk.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import os
1010
import os.path
11+
from pathlib import Path
1112
from glob import glob
1213
import re
1314
import pickle
@@ -68,11 +69,14 @@ def fetch_intersphinx_inventory(uri):
6869

6970
# See https://stackoverflow.com/a/30981554
7071
class MockConfig(object):
72+
intersphinx_cache_limit = None
7173
intersphinx_timeout = None
7274
tls_verify = False
75+
tls_cacerts = None
76+
user_agent = None
7377

7478
class MockApp(object):
75-
srcdir = ''
79+
srcdir = Path('')
7680
config = MockConfig()
7781

7882
def warn(self, msg):
@@ -126,6 +130,8 @@ def preprocess_script_string(str):
126130

127131
# Remove header comment
128132
str = re.sub(r'^(#[^#\n]+\n){5}\n*', r'', str)
133+
# Remove r from r""" ... """
134+
str = re.sub('^r"""', '"""', str, flags=re.MULTILINE)
129135
# Insert notebook plotting configuration function
130136
str = re.sub(r'from sporco import plot', r'from sporco import plot'
131137
'\nplot.config_notebook_plotting()',
@@ -500,7 +506,7 @@ def write_notebook_rst(txt, res, fnm, pth):
500506
# Partial path for current output image
501507
rpth = os.path.join(extfnm, rnew)
502508
# In RST text, replace old output name with the new one
503-
txt = re.sub('\.\. image:: ' + r, '.. image:: ' + rpth, txt, re.M)
509+
txt = re.sub(r'\.\. image:: ' + r, '.. image:: ' + rpth, txt, re.M)
504510
# Full path of the current output image
505511
fullrpth = os.path.join(pth, rpth)
506512
# Write the current output image to disk
@@ -818,7 +824,7 @@ def __init__(self, env, inv, baseurl):
818824
self.citeid = {}
819825
if not hasattr(env, 'bibtex_cache'):
820826
for cite in env.domaindata['cite']['citations']:
821-
self.citenum[cite.key] = cite.label
827+
self.citenum[cite.key] = cite.citation_id[2:]
822828
self.citeid[cite.key] = cite.citation_id
823829

824830

examples/scripts/cdl/cbpdndl_grd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Convolutional Dictionary Learning
99
=================================
1010
11-
This example demonstrating the use of :class:`.dictlrn.DictLearn` to construct a dictionary learning algorithm with the flexibility of choosing the sparse coding and dictionary update classes. In this case they are :class:`.cbpdn.ConvBPDNGradReg` and :func:`.admm.ccmod.ConvCnstrMOD` respectively, so the resulting dictionary learning algorithm is not equivalent to :class:`.dictlrn.cbpdndl.ConvBPDNDictLearn`. Sparse coding with a CBPDN variant that includes a gradient regularization term on one of the coefficient maps :cite:`wohlberg-2016-convolutional2` enables CDL without the need for the usual lowpass/highpass filtering as a pre-processing of the training images.
11+
This example demonstrates the use of :class:`.dictlrn.DictLearn` to construct a dictionary learning algorithm with the flexibility of choosing the sparse coding and dictionary update classes. In this case they are :class:`.cbpdn.ConvBPDNGradReg` and :func:`.admm.ccmod.ConvCnstrMOD` respectively, so the resulting dictionary learning algorithm is not equivalent to :class:`.dictlrn.cbpdndl.ConvBPDNDictLearn`. Sparse coding with a CBPDN variant that includes a gradient regularization term on one of the coefficient maps :cite:`wohlberg-2016-convolutional2` enables CDL without the need for the usual lowpass/highpass filtering as a pre-processing of the training images.
1212
"""
1313

1414

@@ -53,15 +53,15 @@
5353
cri = cnvrep.CDU_ConvRepIndexing(D0.shape, S)
5454

5555

56-
"""
56+
r"""
5757
Set up weights for the $\ell_1$ norm to disable regularization of the coefficient map corresponding to the impulse filter.
5858
"""
5959

6060
wl1 = np.ones((1,)*4 + (D0.shape[2:]), dtype=np.float32)
6161
wl1[..., 0] = 0.0
6262

6363

64-
"""
64+
r"""
6565
Set of weights for the $\ell_2$ norm of the gradient to disable regularization of all coefficient maps except for the one corresponding to the impulse filter.
6666
"""
6767

examples/scripts/cdl/cbpdndl_jnt_clr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Convolutional Dictionary Learning
99
=================================
1010
11-
This example demonstrating the use of :class:`.dictlrn.DictLearn` to construct a dictionary learning algorithm with the flexibility of choosing the sparse coding and dictionary update classes. In this case they are :class:`.cbpdn.ConvBPDNJoint` and :func:`.admm.ccmod.ConvCnstrMOD` respectively, so the resulting dictionary learning algorithm is not equivalent to :class:`.dictlrn.cbpdndl.ConvBPDNDictLearn`. The example uses colour input images and a greyscale dictionary :cite:`wohlberg-2016-convolutional`.
11+
This example demonstrates the use of :class:`.dictlrn.DictLearn` to construct a dictionary learning algorithm with the flexibility of choosing the sparse coding and dictionary update classes. In this case they are :class:`.cbpdn.ConvBPDNJoint` and :func:`.admm.ccmod.ConvCnstrMOD` respectively, so the resulting dictionary learning algorithm is not equivalent to :class:`.dictlrn.cbpdndl.ConvBPDNDictLearn`. The example uses colour input images and a greyscale dictionary :cite:`wohlberg-2016-convolutional`.
1212
"""
1313

1414

examples/scripts/cdl/cbpdndl_md_clr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
Sw = W * S
5454

5555

56-
"""
56+
r"""
5757
$\ell_2$-TV denoising with a spatial mask as a non-linear lowpass filter.
5858
"""
5959

examples/scripts/cdl/cbpdndl_md_gry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
Sw = W * S
5454

5555

56-
"""
56+
r"""
5757
$\ell_2$-TV denoising with a spatial mask as a non-linear lowpass filter.
5858
"""
5959

examples/scripts/cdl/cbpdndl_video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
frmlst = []
3535
for i, frm in enumerate(reader):
3636
if i >= 250:
37-
frm = zoom(signal.rgb2gray(frm.astype(np.float32)/255.0), 0.25)
37+
frm = zoom(signal.rgb2gray(np.array(frm, dtype=np.float32)/255.0), 0.25)
3838
frmlst.append(frm[20:-20, 70:-70])
3939
vid = np.stack(frmlst, axis=2)
4040

examples/scripts/csc/cbpdn_ams_clr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
imgwp = spad(imgw)
6464

6565

66-
"""
66+
r"""
6767
$\ell_2$-TV denoising with a spatial mask as a non-linear lowpass filter. The highpass component is the difference between the test image and the lowpass component, multiplied by the mask for faster convergence of the convolutional sparse coding (see :cite:`wohlberg-2017-convolutional3`).
6868
"""
6969

0 commit comments

Comments
 (0)