Skip to content

Commit

Permalink
Update examples (#540)
Browse files Browse the repository at this point in the history
* Minor comment edits

* Fix missing typing import

* Docs fixes

* Improve docs

* Docs fixes

* Add missing dependency (due to recent changes in other packages) for building notebooks

* Update submodule

* Fix script to notebook conversion bug

* Update submodule

* Update submodule

* Update submodule

* Update submodule

* Add missing dependency for building notebooks

* Update submodule

* Improve example script docstring

* Update submodule

* Avoid ray complaints

* Remove second ray.init call

* Update submodule

* Update submodule

* Update submodule

* Replace deprecated matplotlib method

* Update submodule

* Update submodule

* Remove largely redundant example

* Update example index

* Rename example script

* Edit script title and fix docs

* Update example index

* Update submodule

* Update submodule

* void doctest errors resulting from unimportable astra or svmbir

* Avoid doctest errors resulting from unimportable astra or svmbir

---------

Co-authored-by: Brendt Wohlberg <[email protected]>
  • Loading branch information
bwohlberg and Brendt Wohlberg authored Jul 19, 2024
1 parent 722846d commit 4450fac
Show file tree
Hide file tree
Showing 19 changed files with 138 additions and 258 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Run doc tests
if: matrix.group == 1
run: |
pytest --ignore-glob="*test_*.py" --doctest-modules scico
pytest --ignore-glob="*test_*.py" --ignore=scico/linop/xray --doctest-modules scico
pytest --doctest-glob="*.rst" docs
coverage:
Expand Down
3 changes: 2 additions & 1 deletion docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Computed Tomography
examples/ct_astra_odp_train_foam2
examples/ct_astra_unet_train_foam2
examples/ct_projector_comparison
examples/ct_multi_cs_tv_admm
examples/ct_multi_tv_admm

Deconvolution
Expand Down Expand Up @@ -137,6 +136,7 @@ Total Variation
examples/ct_astra_3d_tv_admm
examples/ct_astra_3d_tv_padmm
examples/ct_astra_weighted_tv_admm
examples/ct_multi_tv_admm
examples/ct_svmbir_tv_multi
examples/deconv_circ_tv_admm
examples/deconv_tv_admm
Expand Down Expand Up @@ -208,6 +208,7 @@ ADMM
examples/ct_tv_admm
examples/ct_astra_3d_tv_admm
examples/ct_astra_weighted_tv_admm
examples/ct_multi_tv_admm
examples/ct_svmbir_tv_multi
examples/ct_svmbir_ppp_bm3d_admm_cg
examples/ct_svmbir_ppp_bm3d_admm_prox
Expand Down
2 changes: 1 addition & 1 deletion docs/source/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ classes, or method definitions.
Comment explaining example 1.
>>> np.add(1, 2)
>>> int(np.add(1, 2))
3
Comment explaining a new example.
Expand Down
9 changes: 5 additions & 4 deletions examples/jnb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ def py_file_to_string(src):
if import_seen:
# Once an import statement has been seen, break on encountering a line that
# is neither an import statement nor a newline, nor a component of an import
# statement extended over multiple lines, nor an os.environ statement, nor
# components of a try/except construction (note that handling of these final
# two cases is probably not very robust).
# statement extended over multiple lines, nor an os.environ statement, nor a
# ray.init statement, nor components of a try/except construction (note that
# handling of these final two cases is probably not very robust).
if not re.match(
r"(^import|^from|^\n$|^\W+[^\W]|^\)$|^os.environ|^try:$|^except)", line
r"(^import|^from|^\n$|^\W+[^\W]|^\)$|^os.environ|^ray.init|^try:$|^except)",
line,
):
lines.append(line)
break
Expand Down
2 changes: 2 additions & 0 deletions examples/notebooks_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
-r examples-requirements.txt
ipykernel
ipywidgets
nbformat
nbconvert
nb_conda_kernels
Expand Down
6 changes: 4 additions & 2 deletions examples/scripts/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Computed Tomography
CT Training and Reconstructions with UNet
`ct_projector_comparison.py <ct_projector_comparison.py>`_
X-ray Transform Comparison
`ct_multi_cs_tv_admm.py <ct_multi_cs_tv_admm.py>`_
TV-Regularized Sparse-View CT Reconstruction (Multiple Projectors, Common Sinogram)
`ct_multi_tv_admm.py <ct_multi_tv_admm.py>`_
TV-Regularized Sparse-View CT Reconstruction (Multiple Projectors)

Expand Down Expand Up @@ -176,6 +174,8 @@ Total Variation
3D TV-Regularized Sparse-View CT Reconstruction (Proximal ADMM Solver)
`ct_astra_weighted_tv_admm.py <ct_astra_weighted_tv_admm.py>`_
TV-Regularized Low-Dose CT Reconstruction
`ct_multi_tv_admm.py <ct_multi_tv_admm.py>`_
TV-Regularized Sparse-View CT Reconstruction (Multiple Projectors)
`ct_svmbir_tv_multi.py <ct_svmbir_tv_multi.py>`_
TV-Regularized CT Reconstruction (Multiple Algorithms)
`deconv_circ_tv_admm.py <deconv_circ_tv_admm.py>`_
Expand Down Expand Up @@ -275,6 +275,8 @@ ADMM
3D TV-Regularized Sparse-View CT Reconstruction (ADMM Solver)
`ct_astra_weighted_tv_admm.py <ct_astra_weighted_tv_admm.py>`_
TV-Regularized Low-Dose CT Reconstruction
`ct_multi_tv_admm.py <ct_multi_tv_admm.py>`_
TV-Regularized Sparse-View CT Reconstruction (Multiple Projectors)
`ct_svmbir_tv_multi.py <ct_svmbir_tv_multi.py>`_
TV-Regularized CT Reconstruction (Multiple Algorithms)
`ct_svmbir_ppp_bm3d_admm_cg.py <ct_svmbir_ppp_bm3d_admm_cg.py>`_
Expand Down
186 changes: 0 additions & 186 deletions examples/scripts/ct_multi_cs_tv_admm.py

This file was deleted.

Loading

0 comments on commit 4450fac

Please sign in to comment.