Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.12
- name: Install dependencies
run: |
$CONDA/bin/conda config --env --append channels conda-forge
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.11", "3.12"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.11"
apt_packages:
- graphviz

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2015-2022, Triad National Security, LLC.
Copyright (c) 2015-2025, Triad National Security, LLC.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 7 additions & 3 deletions docs/source/automodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ def _fix_disable(cls, nstnm):
coattr.append(co.co_posonlyargcount)
coattr.extend([co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
co.co_flags, _fix_disable.__code__.co_code, co.co_consts,
co.co_names, co.co_varnames, co.co_filename, co.co_name,
co.co_firstlineno, co.co_lnotab, co.co_freevars,
co.co_cellvars])
co.co_names, co.co_varnames, co.co_filename, co.co_name])
if hasattr(co, 'co_qualname'):
coattr.append(co.co_qualname)
coattr.extend([co.co_firstlineno, co.co_lnotab])
if hasattr(co, 'co_exceptiontable'):
coattr.append(co.co_exceptiontable)
coattr.extend([co.co_freevars, co.co_cellvars])
sporco.common._fix_nested_class_lookup.__code__ = CodeType(*coattr)


Expand Down
15 changes: 8 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,14 @@


# Intersphinx mapping
intersphinx_mapping = {'https://docs.python.org/3/': None,
'https://numpy.org/doc/stable/': None,
'https://docs.scipy.org/doc/scipy/reference/': None,
'https://matplotlib.org/': None,
'http://hgomersall.github.io/pyFFTW/': None,
'https://docs.cupy.dev/en/stable/': None
}
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"pyfftw": ("http://hgomersall.github.io/pyFFTW/", None),
"cupy": ("https://docs.cupy.dev/en/stable/", None)
}
# Added timeout due to periodic scipy.org down time
#intersphinx_timeout = 30

Expand Down
5 changes: 0 additions & 5 deletions docs/source/modules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,3 @@ API Reference
sporco.dictlrn.onlinecdl
sporco.cuda
sporco.cupy
sporco.fista.bpdn
sporco.fista.cbpdn
sporco.fista.ccmod
sporco.fista.fista
sporco.fista.ppp
18 changes: 9 additions & 9 deletions docs/source/modules/sporco.cuda.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ The content of the ``sporco.cuda`` namespace is summarised below. For full detai
Always available
~~~~~~~~~~~~~~~~

.. np:attribute:: have_cuda
.. py:attribute:: have_cuda

A boolean value indicating whether the import of ``sporco_cuda`` succeeded.


.. np:function:: device_count()
.. py:function:: device_count()

Get the number of CUDA GPU devices installed on the host system. Returns 0
if no devices are installed or if the import of ``sporco_cuda`` failed.
Expand All @@ -62,7 +62,7 @@ Always available
Only available if ``have_cuda`` is `True`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. np:function:: current_device(id=None)
.. py:function:: current_device(id=None)

Get or set the current CUDA GPU device. The current device is not set
if `id` is None.
Expand All @@ -79,7 +79,7 @@ Only available if ``have_cuda`` is `True`



.. np:function:: memory_info()
.. py:function:: memory_info()

Get memory information for the current CUDA GPU device.

Expand All @@ -92,7 +92,7 @@ Only available if ``have_cuda`` is `True`



.. np:function:: device_name(int dev=0)
.. py:function:: device_name(int dev=0)

Get hardware model name for the specified CUDA GPU device.

Expand All @@ -108,7 +108,7 @@ Only available if ``have_cuda`` is `True`



.. np:function:: cbpdn(D, S, lmbda, opt, dev=0)
.. py:function:: cbpdn(D, S, lmbda, opt, dev=0)

A GPU-accelerated version of :class:`.admm.cbpdn.ConvBPDN`. Multiple
images and multi-channel images in input signal ``S`` are currently not
Expand Down Expand Up @@ -136,7 +136,7 @@ Only available if ``have_cuda`` is `True`



.. np:function:: cbpdngrd(D, S, lmbda, mu, opt, dev=0)
.. py:function:: cbpdngrd(D, S, lmbda, mu, opt, dev=0)

A GPU-accelerated version of :class:`.admm.cbpdn.ConvBPDNGradReg`.
Multiple images and multi-channel images in input signal ``S`` are
Expand Down Expand Up @@ -166,7 +166,7 @@ Only available if ``have_cuda`` is `True`



.. np:function:: cbpdnmsk(D, s, w, lmbda, opt, dev=0)
.. py:function:: cbpdnmsk(D, s, w, lmbda, opt, dev=0)

A GPU-accelerated version of :class:`.admm.cbpdn.AddMaskSim` used
together with :class:`.admm.cbpdn.ConvBPDN`, providing a spatial
Expand Down Expand Up @@ -208,7 +208,7 @@ Only available if ``have_cuda`` is `True`



.. np:function:: cbpdngrdmsk(D, s, w, lmbda, mu, opt, dev=0)
.. py:function:: cbpdngrdmsk(D, s, w, lmbda, mu, opt, dev=0)

A GPU-accelerated version of of :class:`.admm.cbpdn.AddMaskSim`
used together with :class:`.admm.cbpdn.ConvBPDNGradReg`, providing
Expand Down
18 changes: 9 additions & 9 deletions docs/source/modules/sporco.cupy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ Utility Functions
Since it is necessary to explicitly convert between `NumPy <http://www.numpy.org/>`__ arrays and `CuPy <https://cupy.chainer.org/>`__ arrays, a number of utility functions in ``sporco.cupy`` support this conversion in a way that behaves correctly independent of the value of ``sporco.cupy.have_cupy``, in that conversion is performed when the value is ``True``, and no conversion is perfomed when it is ``False``.


.. np:function:: array_module(*args)
.. py:function:: array_module(*args)

Get the array module (``numpy`` or ``cupy``) of the array argument. This
function is an alias for :func:`cupy.get_array_module`.


.. np:function:: np2cp(u)
.. py:function:: np2cp(u)

Convert a ``numpy`` ndarray to a ``cupy`` array. This function is an alias
for :func:`cupy.asarray`


.. np:function:: cp2np(u)
.. py:function:: cp2np(u)

Convert a ``cupy`` array to a ``numpy`` ndarray. This function is an alias
for :func:`cupy.asnumpy`


.. np:function:: cupy_wrapper(func)
.. py:function:: cupy_wrapper(func)

A wrapper function that converts ``numpy`` ndarray arguments to ``cupy``
arrays, and convert any ``cupy`` arrays returned by the wrapped function
Expand All @@ -116,14 +116,14 @@ Since it is necessary to explicitly convert between `NumPy <http://www.numpy.org
Some additional utility functions provide useful functionality when package `GPUtil <https://github.com/anderskm/gputil>`__ is installed, and return fixed default return values when it is not installed:


.. np:function:: gpu_info()
.. py:function:: gpu_info()

Return a list of namedtuples representing attributes of each GPU
device. Returns an empty list if
`GPUtil <https://github.com/anderskm/gputil>`_ is not installed.


.. np:function:: gpu_load(wproc=0.5, wmem=0.5)
.. py:function:: gpu_load(wproc=0.5, wmem=0.5)

Return a list of namedtuples representing the current load for
each GPU device. The processor and memory loads are fractions
Expand All @@ -133,21 +133,21 @@ Some additional utility functions provide useful functionality when package `GPU
`GPUtil <https://github.com/anderskm/gputil>`_ is not installed.


.. np:function:: device_by_load(wproc=0.5, wmem=0.5)
.. py:function:: device_by_load(wproc=0.5, wmem=0.5)

Get a list of GPU device ids ordered by increasing weighted
average of processor and memory load. Returns an empty list if
`GPUtil <https://github.com/anderskm/gputil>`_ is not installed.


.. np:function:: select_device_by_load(wproc=0.5, wmem=0.5)
.. py:function:: select_device_by_load(wproc=0.5, wmem=0.5)

Set the current device for cupy as the device with the lowest
weighted average of processor and memory load. Returns 0 if
`GPUtil <https://github.com/anderskm/gputil>`_ is not installed.


.. np:function:: available_gpu(*args, **kwargs)
.. py:function:: available_gpu(*args, **kwargs)

Get the device id for an available GPU when multiple GPUs are installed.
This function is an alias for ``GPUtil.getAvailable``. Returns 0 if
Expand Down
4 changes: 2 additions & 2 deletions examples/scripts/sc/gwnden_clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
blocks = array.extract_blocks(imgn, blksz, stpsz)
blockmeans = np.mean(blocks, axis=(0, 1))
blocks -= blockmeans
blocks = blocks.reshape(np.product(blksz), -1)
blocks = blocks.reshape(np.prod(blksz), -1)


"""
Load dictionary.
"""

D = util.convdicts()['RGB:8x8x3x64'].reshape(np.product(blksz), -1)
D = util.convdicts()['RGB:8x8x3x64'].reshape(np.prod(blksz), -1)


"""
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
future
numpy>=1.12
scipy>=0.19.1
numpy>=1.26.4
scipy>=1.12.0
imageio
matplotlib>=1.3.1
pyfftw>=0.10.4
Expand Down
6 changes: 3 additions & 3 deletions sporco/admm/admm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2020 by Brendt Wohlberg <brendt@ieee.org>
# Copyright (C) 2015-2025 by Brendt Wohlberg <brendt@ieee.org>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
Expand Down Expand Up @@ -235,7 +235,7 @@ def __init__(self, Nx, yshape, ushape, dtype, opt=None):
self.Nx = Nx
# Working variable U has the same dimensionality as constant c
# in the constraint Ax + By = c
self.Nc = np.product(np.array(ushape))
self.Nc = np.prod(np.array(ushape))

# DataType option overrides data type inferred from __init__
# parameters of derived class
Expand Down Expand Up @@ -862,7 +862,7 @@ def __init__(self, xshape, dtype, opt=None):

if opt is None:
opt = ADMMEqual.Options()
Nx = np.product(np.array(xshape))
Nx = np.prod(np.array(xshape))
super(ADMMEqual, self).__init__(Nx, xshape, xshape, dtype, opt)


Expand Down
6 changes: 3 additions & 3 deletions sporco/admm/cbpdntv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-2019 by Brendt Wohlberg <brendt@ieee.org>
# Copyright (C) 2016-2025 by Brendt Wohlberg <brendt@ieee.org>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
Expand Down Expand Up @@ -199,7 +199,7 @@ def __init__(self, D, S, lmbda, mu=0.0, opt=None, dimK=None, dimN=2):
self.cri = cr.CSC_ConvRepIndexing(D, S, dimK=dimK, dimN=dimN)

# Call parent class __init__
Nx = np.product(np.array(self.cri.shpX))
Nx = np.prod(np.array(self.cri.shpX))
yshape = self.cri.shpX + (len(self.cri.axisN)+1,)
super(ConvBPDNScalarTV, self).__init__(Nx, yshape, yshape,
S.dtype, opt)
Expand Down Expand Up @@ -908,7 +908,7 @@ def __init__(self, D, S, lmbda, mu=0.0, opt=None, dimK=None, dimN=2):
self.cri = cr.CSC_ConvRepIndexing(D, S, dimK=dimK, dimN=dimN)

# Call parent class __init__
Nx = np.product(np.array(self.cri.shpX))
Nx = np.prod(np.array(self.cri.shpX))
yshape = list(self.cri.shpX)
yshape[self.cri.axisM] += len(self.cri.axisN) * self.cri.Cd
super(ConvBPDNRecTV, self).__init__(Nx, yshape, yshape,
Expand Down
6 changes: 3 additions & 3 deletions sporco/admm/parcbpdn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 by Erik Skau <ewskau@gmail.com>
# Brendt Wohlberg <brendt@ieee.org>
# Copyright (C) 2018-2025 by Erik Skau <ewskau@gmail.com>
# Brendt Wohlberg <brendt@ieee.org>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
Expand Down Expand Up @@ -105,7 +105,7 @@ def mpraw_as_np(shape, dtype):
Numpy array
"""

sz = int(np.product(shape))
sz = int(np.prod(shape))
csz = sz * np.dtype(dtype).itemsize
raw = mp.RawArray('c', csz)
return np.frombuffer(raw, dtype=dtype, count=sz).reshape(shape)
Expand Down
68 changes: 0 additions & 68 deletions sporco/cupy/fista/__init__.py

This file was deleted.

Loading
Loading