Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
fzimmermann89 committed Jan 13, 2025
1 parent df16dd9 commit 929aa0d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
12 changes: 7 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def sync_notebooks(source_folder, dest_folder):
"""Sync notebooks from source to destination folder.
Copy only new or updated files.
Set execution mode to 'cache' for all copied files.
Set execution mode to 'force' for all copied files and 'off' for all existing files.
"""
dest = Path(dest_folder)
dest.mkdir(parents=True, exist_ok=True)
Expand All @@ -272,12 +272,14 @@ def sync_notebooks(source_folder, dest_folder):
dest_file = dest / src_file.name
if not dest_file.exists() or src_file.stat().st_mtime > dest_file.stat().st_mtime:
shutil.copy2(src_file, dest_file)
print(f'Copied {src_file} to {dest_file}')
print(f'Copied {src_file} to {dest_file}. Setting execution mode to "force".')
mode = 'force'
else:
print(f'Existing {dest_file}. Skipping execution.')
content = nbformat.read(dest_file, as_version=nbformat.NO_CONVERT)
content.metadata['mystnb'] = {'execution_mode': 'off'}
nbformat.write(content, dest_file)
mode = 'off'
content = nbformat.read(dest_file, as_version=nbformat.NO_CONVERT)
content.metadata['mystnb'] = {'execution_mode': mode}
nbformat.write(content, dest_file)


def setup(app):
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contributor_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This repository uses a *pyproject.toml* file to specify all the requirements.
an online repository (e.g. zenodo) such that it can be automatically downloaded.
Individual cells should be indicated with ``# %%``. For markdown cells use ``# %% [markdown]``.
The translation from python script to jupyter notebook is done in pre-commit (locally and and on GitHub)
using `jupytext <https://jupytext.readthedocs.io/en/latest/>`_ . See their documentation for more details.
using `jupytext <https://jupytext.readthedocs.io/en/latest/>`_ . See its documentation for more details.

After translating the scripts to notebooks, the notebooks are run and their output is converted to html and added
to this documentation in the *Examples* section.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MR image reconstruction and processing package for PyTorch
| **Source code:** `<https://github.com/PTB-MR/mrpro>`_
| **Bug reports:** `<https://github.com/PTB-MR/mrpro/issues>`_
| **Try it out:** `Open in Colab <https://colab.research.google.com/github/PTB-MR/mrpro>`_
| **See our examples: ** :doc:`examples`
| **See our examples:** :doc:`examples`
Main Features
-------------
Expand Down
8 changes: 8 additions & 0 deletions src/mrpro/algorithms/optimizers/cg.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def cg(
This implementation assumes that :math:`H` is self-adjoint and does not verify this condition.
See [Hestenes1952]_, [Nocedal2006]_, and [WikipediaCG]_ for more information.
Parameters
----------
Expand All @@ -63,6 +64,13 @@ def cg(
Returns
-------
an approximate solution of the linear system :math:`Hx=b`
References
----------
.. [Hestenes1952] Hestenes, M. R., & Stiefel, E. (1952). Methods of conjugate gradients for solving linear systems.
*Journal of Research of the National Bureau of Standards*, 49(6), 409-436
.. [Nocedal2006] Nocedal, J. (2006). *Numerical Optimization* (2nd ed.). Springer.
.. [WikipediaCG] Wikipedia: Conjugate Gradient`<https://en.wikipedia.org/wiki/Conjugate_gradient>_
"""
if initial_value is not None and (initial_value.shape != right_hand_side.shape):
raise ValueError(
Expand Down

0 comments on commit 929aa0d

Please sign in to comment.