Skip to content

Commit

Permalink
Merge branch 'master' into processors_out
Browse files Browse the repository at this point in the history
Signed-off-by: Hannah Robarts <77114597+hrobarts@users.noreply.github.com>
  • Loading branch information
hrobarts authored Jul 24, 2024
2 parents c593c6d + a9ce83a commit 00f0d06
Show file tree
Hide file tree
Showing 24 changed files with 1,491 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
working-directory: recipe
run: |
conda install boa
conda mambabuild . -c conda-forge -c intel -c ccpi --python=${{ matrix.python-version }} --numpy=${{ matrix.numpy-version }} --output-folder .
conda mambabuild . -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi --python=${{ matrix.python-version }} --numpy=${{ matrix.numpy-version }} --output-folder .
- name: Upload artifact of the conda package
uses: actions/upload-artifact@v4
with:
Expand Down
16 changes: 11 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@

* XX.X.X

* 24.x.x
- New Features:
- Added SAG and SAGA stochastic functions (#1624)
- Enhancements:
- New unit tests for operators and functions to check for in place errors and the behaviour of `out` (#1805)

* 24.1.0
- New Features:
- Added method to plot filter in `GenericFilteredBackProjection` (#1667)
- Added wavelet operator, wrapping PyWavelets operator as a CIL operator (#1618)
- Added wavelet operator, wrapping PyWavelets operator as a CIL operator (#1615)
- Added PaganinProcessor processor, to perform phase retrieval from phase contrast images (#1737)
- Added L1Sparsity function, allowing calculations of `|Ax-b|_1` and its proximal, in the case of orthogonal operators, `A` (#1618)
- Options in algorithms GD, ISTA and FISTA to pass a `cil.optimisation.utilities.StepSizeRule` or a `cil.optimisation.utilities.Preconditioner`(#1768)
- an implementation of the Armijo Rule as a child class of `cil.optimisation.utilities.StepSizeRule` (#1768)
Expand All @@ -13,8 +18,9 @@
- Raises error in `BlockDataContainer.pnorm` if the shape of the containers is not the same (#1799)
- Operators and functions now also return when out is specified (#1742)
- The CIL function class now has a `__neg__` function, so you can write `-YourFunction(x)` rather than `-1*YourFunction(x)` (#1808)
- Added documentation for the Partitioner to `framework.rst` (#1828)
- Added CIL vs SIRF tests comparing preconditioned ISTA in CIL and MLEM in SIRF (#1823)
- New unit tests for operators and functions to check for in place errors and the behaviour of `out` (#1805)
- Update to CCPi-Regularisation toolkit v24.0.1 (#1868)
- Bug fixes:
- gradient descent `update_objective` called twice on the initial point.(#1789)
- ProjectionMap operator bug fix in adjoint and added documentation (#1743)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY --chown="${NB_USER}" scripts/requirements-test.yml environment.yml
RUN sed -ri '/tigre|astra-toolbox| python /d' environment.yml \
&& for pkg in 'jupyter-server-proxy>4.1.0' $CIL_EXTRA_PACKAGES; do echo " - $pkg" >> environment.yml; done \
&& conda config --env --set channel_priority strict \
&& for ch in defaults nvidia ccpi intel conda-forge; do conda config --env --add channels $ch; done \
&& for ch in defaults nvidia ccpi https://software.repos.intel.com/python/conda conda-forge; do conda config --env --add channels $ch; done \
&& mamba env update -n base \
&& mamba clean -a -y -f \
&& rm environment.yml \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ We recommend using either [`miniconda`](https://docs.conda.io/projects/miniconda
Install a new environment using:

```sh
conda create --name cil -c conda-forge -c intel -c ccpi cil=24.0.0
conda create --name cil -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi cil=24.1.0
```

To install CIL and the additional packages and plugins needed to run the [CIL demos](https://github.com/TomographicImaging/CIL-Demos) install the environment with:

```sh
conda create --name cil -c conda-forge -c intel -c ccpi cil=24.0.0 astra-toolbox=*=cuda* tigre ccpi-regulariser tomophantom ipywidgets
conda create --name cil -c conda-forge -c https://software.repos.intel.com/python/conda -c ccpi cil=24.1.0 astra-toolbox=*=cuda* tigre ccpi-regulariser tomophantom ipywidgets
```

where:
Expand All @@ -44,7 +44,7 @@ where:

CIL's [optimised FDK/FBP](https://github.com/TomographicImaging/CIL/discussions/1070) `recon` module requires:

1. the Intel [Integrated Performance Primitives](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ipp.html#gs.gxwq5p) Library ([license](https://www.intel.com/content/dam/develop/external/us/en/documents/pdf/intel-simplified-software-license-version-august-2021.pdf)) which can be installed via conda from the `intel` [channel](https://anaconda.org/intel/ipp).
1. the Intel [Integrated Performance Primitives](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ipp.html#gs.gxwq5p) Library ([license](https://www.intel.com/content/dam/develop/external/us/en/documents/pdf/intel-simplified-software-license-version-august-2021.pdf)) which can be installed via conda from the `https://software.repos.intel.com/python/conda` channel.
2. [TIGRE](https://github.com/CERN/TIGRE), which can be installed via conda from the `ccpi` channel.

### Docker
Expand Down
34 changes: 32 additions & 2 deletions Wrappers/Python/cil/framework/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,22 @@ def get_centre_slice(self):
return self

def calculate_magnification(self):
return [None, None, 1.0]
'''Method to calculate magnification and distance from the sample to
the detector using the detector positions and the rotation axis.
For parallel beam geometry magnification = 1
Returns
-------
list
A list containing the [0] distance from the source to the rotate
axis, [1] distance from the rotate axis to the detector,
[2] magnification of the system
'''
ab = (self.rotation_axis.position - self.detector.position)
dist_center_detector = float(numpy.sqrt(ab.dot(ab)))

return [None, dist_center_detector, 1.0]

class Parallel3D(SystemConfiguration):
r'''This class creates the SystemConfiguration of a parallel beam 3D tomographic system
Expand Down Expand Up @@ -1116,7 +1131,22 @@ def __eq__(self, other):
return False

def calculate_magnification(self):
return [None, None, 1.0]
'''Method to calculate magnification and distance from the sample to
the detector using the detector positions and the rotation axis.
For parallel beam geometry magnification = 1
Returns
-------
list
A list containing the [0] distance from the source to the rotate
axis, [1] distance from the rotate axis to the detector,
[2] magnification of the system
'''
ab = (self.rotation_axis.position - self.detector.position)
dist_center_detector = float(numpy.sqrt(ab.dot(ab)))

return [None, dist_center_detector, 1.0]

def get_centre_slice(self):
"""Returns the 2D system configuration corresponding to the centre slice
Expand Down
5 changes: 4 additions & 1 deletion Wrappers/Python/cil/optimisation/algorithms/Algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#
# Authors:
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt
from itertools import count
from numbers import Integral
from typing import List, Optional
from warnings import warn
Expand Down Expand Up @@ -237,7 +238,9 @@ def run(self, iterations=None, callbacks: Optional[List[Callback]]=None, verbose

# call `__next__` upto `iterations` times or until `StopIteration` is raised
self.max_iteration = self.iteration + iterations
for _ in zip(range(self.iteration, self.iteration + iterations), self):
iters = (count(self.iteration) if np.isposinf(self.max_iteration)
else range(self.iteration, self.max_iteration))
for _ in zip(iters, self):
try:
for callback in callbacks:
callback(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def data_passes_indices(self):
def data_passes(self):
""" The property :code:`data_passes` is a list of floats that holds the amount of data that has been processed up until each call of `gradient`. This list is updated each time `gradient` is called by appending the proportion of the data used when calculating the approximate gradient since the class was initialised (a full gradient calculation would be 1 full data pass). Warning: if your functions do not contain an equal `amount` of data, for example your data was not partitioned into equal batches, then you must first use the `set_data_partition_weights" function for this to be accurate. """
data_passes = []
for el in self._data_passes_indices:
for el in self.data_passes_indices:
try:
data_passes.append(data_passes[-1])
except IndexError:
Expand Down
Loading

0 comments on commit 00f0d06

Please sign in to comment.