Skip to content

Commit

Permalink
Merge pull request #39 from LCAV/fix/pycsou_v2
Browse files Browse the repository at this point in the history
Pycsou v2
  • Loading branch information
ebezzam authored Apr 25, 2023
2 parents e31c9a7 + c08c1ee commit 822ef6b
Show file tree
Hide file tree
Showing 14 changed files with 293 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
max-parallel: 12
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10"]
python-version: [3.8, "3.11"]
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/python_pycsou.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: lensless

on: [push, pull_request]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 12
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, "3.10"]
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and build package
run: |
python -m pip install --upgrade pip
python -m pip install -e .
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=B,C,E,F,W,T4,B9 --show-source --statistics --max-complexity=18 --max-line-length=100 --ignore=E203,E266,E501,W503,F403,F401,C901 --exclude=profile,scripts,docs
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Format with black
run: |
pip install black
black *.py -l 100
black lensless/*.py -l 100
black scripts/*.py -l 100
black scripts/recon/*.py -l 100
black profile/*.py -l 100
black test/*.py -l 100
- name: Test with pytest
run: |
pip install -U pytest
pip install -r recon_requirements.txt
pip install git+https://github.com/matthieumeo/pycsou.git@v2-dev
pytest
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ Changed
- CONTRIBUTING and CHANGELOG, to .rst for documentation.
- Shorten README to separate contents in different pages of docs.
- Fix typo in GradientDescent class name.
- Updated to Pycsou V2, as ``pip install pycsou`` (Pycsou V1) may not work on some machines.

Bugfix
~~~~~~

- Loading grayscale PSFs would cause an dimension error when removing the background pixels
- Loading grayscale PSFs would cause an dimension error when removing the background pixels.

1.0.2 - (2022-05-31)
--------------------
Expand Down
21 changes: 17 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,23 @@ install the library locally.
python scripts/recon/admm.py
Note (as of 19-04-2023), there is a problem setting up Pycsou via ``pip`` as
the `setup file <https://github.com/matthieumeo/pycsou/blob/master/requirements.txt>`__
uses asterisks with greater than or equal requirements, which is no longer supported.
Therefore ``pycsou>=1.0.6`` has been removed from ``recon_requirements.txt``.
Note (25-04-2023): for using reconstruction method based on Pycsou ``lensless.apgd.APGD``,
V2 has to be installed:

.. code:: bash
pip install git+https://github.com/matthieumeo/pycsou.git@v2-dev
If PyTorch is installed, you will need to be sure to have PyTorch 2.0 or higher,
as Pycsou V2 is not compatible with earlier versions of PyTorch. Moreover,
Pycsou requires Python within
`[3.9, 3.11) <https://github.com/matthieumeo/pycsou/blob/v2-dev/setup.cfg#L28>`__.

Moreover, ``numba`` (requirement for Pycsou V2) may require an older version of NumPy:

.. code:: bash
pip install numpy==1.23.5
**Raspberry Pi**

Expand Down
47 changes: 0 additions & 47 deletions configs/apgd_thumbs_up.yaml

This file was deleted.

17 changes: 16 additions & 1 deletion configs/defaults_recon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,19 @@ admm:
mu1: 1e-6
mu2: 1e-5
mu3: 4e-5
tau: 0.0001
tau: 0.0001

apgd:
# Stopping criteria
max_iter: 1000
rel_error: 1e-6
acceleration: True
# Differentiable prior / regularization: l2, null
diff_penalty: null
diff_lambda: 0.001
# Proximal prior / regularization: nonneg, l1, null
prox_penalty: nonneg
prox_lambda: 0.001
# Lipschitz
lipschitz_tight: True
lipschitz_tol: 1.0
Loading

0 comments on commit 822ef6b

Please sign in to comment.