Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse2D version 3 #183

Merged
merged 15 commits into from
Jan 19, 2023
Merged
41 changes: 18 additions & 23 deletions .github/workflows/cd-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Conda with Python 3.9
uses: conda-incubator/setup-miniconda@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
auto-update-conda: true
python-version: 3.9
auto-activate-base: false
python-version: ${{ matrix.python-version }}

- name: Check Python Version
run: python --version

- name: Install Package Dependencies
shell: bash -l {0}
run: |
python --version
python -m pip install --upgrade pip
python -m pip install nose nose-exclude coverage pycodestyle
python -m pip install -r develop.txt

- name: Install PySAP
run: python -m pip install .

- name: Run Tests
shell: bash -l {0}
run: |
python setup.py nosetests
run: python -m pytest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand All @@ -57,23 +57,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Conda with Python 3.9
uses: conda-incubator/setup-miniconda@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
auto-update-conda: true
python-version: 3.9
auto-activate-base: false
python-version: ${{ matrix.python-version }}

- name: Check Python Version
run: python --version

- name: Install dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install --upgrade pip
python -m pip install pandoc
python -m pip install -r docs/requirements.txt
python -m pip install .

- name: Download plug-ins
shell: bash -l {0}
if: ${{ inputs.build_plugins }}
run: |
while read _plugin; do
Expand All @@ -85,7 +84,6 @@ jobs:
rm *.tar.gz

- name: Extract plug-in examples
shell: bash -l {0}
if: ${{ inputs.build_examples }}
run: |
while read _plugin; do
Expand All @@ -95,11 +93,9 @@ jobs:
done < plugins.txt

- name: Build PySAP source files
shell: bash -l {0}
run: sphinx-apidoc ${sphinx_opts} pysap

- name: Build plug-in source files
shell: bash -l {0}
if: ${{ inputs.build_plugins }}
run: |
while read _plugin; do
Expand All @@ -109,7 +105,6 @@ jobs:
done < plugins.txt

- name: Build API documentation
shell: bash -l {0}
run: sphinx-build -E docs/source docs/_build

- name: Deploy API documentation
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Conda with Python 3.9
uses: conda-incubator/setup-miniconda@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
auto-update-conda: true
python-version: 3.9
auto-activate-base: false
python-version: ${{ matrix.python-version }}

- name: Check Python Version
run: python --version

- name: Install dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install --upgrade pip
python -m pip install pandoc
python -m pip install -r docs/requirements.txt
python -m pip install .

- name: Download plug-ins
shell: bash -l {0}
if: ${{ inputs.build_plugins }}
run: |
while read _plugin; do
Expand All @@ -57,7 +56,6 @@ jobs:
rm *.tar.gz

- name: Extract plug-in examples
shell: bash -l {0}
if: ${{ inputs.build_examples }}
run: |
while read _plugin; do
Expand All @@ -67,11 +65,9 @@ jobs:
done < plugins.txt

- name: Build PySAP source files
shell: bash -l {0}
run: sphinx-apidoc ${sphinx_opts} pysap

- name: Build plug-in source files
shell: bash -l {0}
if: ${{ inputs.build_plugins }}
run: |
while read _plugin; do
Expand All @@ -81,13 +77,11 @@ jobs:
done < plugins.txt

- name: Build API documentation
shell: bash -l {0}
run: sphinx-build -E docs/source docs/_build

- name: Archive API build
uses: actions/upload-artifact@v2
with:
name: api-docs
retention-days: 14
path: |
docs/_build
path: docs/_build
78 changes: 38 additions & 40 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,63 +16,55 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.8]
python-version: ["3.10"]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Conda with Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Check Conda
shell: bash -l {0}
run: |
conda info
conda list
python --version
- name: Check Python Version
run: python --version

- name: Install macOS Dependencies
shell: bash -l {0}
if: runner.os == 'macOS'
run: |
brew install libomp
brew tap sfarrens/sf
brew install bigmac libomp

- name: Install Package Dependencies
shell: bash -l {0}
run: |
python --version
python -m pip install --upgrade pip
python -m pip install nose nose-exclude coverage pycodestyle
python -m pip install -r develop.txt
python -m pip install twine

- name: Run Tests
shell: bash -l {0}
- name: Install PySAP
run: python -m pip install .

- name: Check PySAP Installation
run: |
python setup.py nosetests
pycodestyle pysap --ignore="E121,E123,E126,E226,E24,E704,E402,E731,E722,E741,W503,W504,W605"
pycodestyle examples --ignore="E121,E123,E126,E226,E24,E704,E402,E731,E741,W503,W504,W605"
python -c "import pysparse"
python -c "import pysap; print(pysap.info())"

- name: Run Tests
run: python -m pytest

- name: Save Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: unit-test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: nosetests.xml
path: pytest.xml

- name: Run Examples
continue-on-error: true
shell: bash -l {0}
run: |
python -m pip install .
python pysap/test/test_examples.py
run: python pysap/test/test_examples.py

- name: Check Distribution
shell: bash -l {0}
run: |
python setup.py sdist
twine check dist/*
Expand All @@ -92,33 +84,39 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.9]
python-version: ["3.7", "3.8", "3.9"]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Conda with Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Check Python Version
run: python --version

- name: Install macOS Dependencies
shell: bash -l {0}
if: runner.os == 'macOS'
run: |
brew install libomp
brew tap sfarrens/sf
brew install bigmac libomp

- name: Install Package Dependencies
shell: bash -l {0}
run: |
python --version
python -m pip install --upgrade pip
python -m pip install nose nose-exclude coverage pycodestyle
python -m pip install -r develop.txt

- name: Run Tests
shell: bash -l {0}
- name: Install PySAP
run: python -m pip install .

- name: Check PySAP Installation
run: |
python setup.py nosetests
python -c "import pysparse"
python -c "import pysap; print(pysap.info())"

- name: Run Tests
run: python -m pytest
3 changes: 3 additions & 0 deletions develop.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pytest
pytest-cov
pytest-pycodestyle
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ channels:
- conda-forge
- astra-toolbox
dependencies:
- python=3.9
- python=3.10
- astra-toolbox>=2.0.0
- cmake>=3.12.0
- jupyter>=1.0.0
- matplotlib>=3.3.4
- pynfft>=1.3.2
Expand All @@ -17,7 +18,6 @@ dependencies:
- nibabel>=3.2.1
- numpy>=1.19.5
- progressbar2>=3.53.1
- pyqtgraph>=0.11.1
- PyWavelets>=1.1.1
- scikit-image>=0.17.2
- scikit-learn>=0.24.1
Expand Down
7 changes: 7 additions & 0 deletions pysap/base/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

# System import
import numpy
from warnings import warn

# Package import
from .observable import Observable
Expand Down Expand Up @@ -88,6 +89,12 @@ def __init__(self, shape=None, spacing=None, data_type="scalar",
def show(self):
""" Display the image data.
"""
warn(
'The show method has been deprecated and will be removed in a '
+ 'future release. In the future Please use the Image.data '
+ 'attribute and your plotting package of choice.',
FutureWarning
)
plot_data(self.data, scroll_axis=self._scroll_axis)

def modified(self):
Expand Down
2 changes: 1 addition & 1 deletion pysap/base/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def find_module(self, name, path=None):
package/module-finding code kicks in.
"""
# Use this loader only on registered modules
match = re.match("pysap\.plugins\.(.*)", name)
match = re.match(r"pysap\.plugins\.(.*)", name)
if match is None:
return None
name = match.groups()[0]
Expand Down
10 changes: 9 additions & 1 deletion pysap/base/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pprint import pprint
import uuid
import os
import warnings
from warnings import warn

# Package import
import pysap
Expand Down Expand Up @@ -352,6 +352,14 @@ def bands_shapes(cls, bands_lengths, ratio=None):
def show(self):
""" Display the different bands at the different decomposition scales.
"""
warn(
'The show method has been deprecated and will be removed in a '
+ 'future release. In the future Please use the Transform.data '
+ 'and/or Transform.analysis_data attributes and your plotting '
+ 'package of choice. To use this deprecated function you will '
+ 'need to install pyqtgraph manually.',
FutureWarning
)
plot_transform(self)

def analysis(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion pysap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _check_python_versions():
mod_name = "pywt"
try:
mod_install_version = importlib.import_module(mod_name).__version__
except:
except ImportError:
mod_install_version = "?"
versions[mod_name] = (operator + mod_min_version, mod_install_version)
return versions
Expand Down
Loading