Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:


jobs:
check:
Expand Down Expand Up @@ -49,6 +49,8 @@ jobs:
- name: Install dependencies
run: |
pip install tox tox-gh-actions
# Optional packages
pip install pyfftw # `test_fft` runs for pyfftw when installed
- name: Test with tox
run: tox --skip-missing-interpreters false -e py${{ matrix.python-version }}-${{ matrix.pyenv }}
- name: Upload Coverage to CodeCov
Expand Down Expand Up @@ -215,3 +217,32 @@ jobs:
name: sphinx-docs
path: docs/build
retention-days: 7

osx_arm:
defaults:
run:
shell: bash -l {0}
needs: check
runs-on: macos-14
# Run on every code push, but only on review ready PRs
if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }}
steps:
- uses: actions/checkout@v4
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2.3.0
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: '3.8'
activate-environment: aspire
environment-file: environment-accelerate.yml
auto-activate-base: false
- name: Complete Install and Log Environment ${{ matrix.os }} Python ${{ matrix.python-version }}
run: |
conda info
conda list
conda install pyshtools # debug depends issues
pip install -e ".[dev]" # install aspire
pip freeze
- name: Test
run: python -m pytest -n3 --durations=50
9 changes: 3 additions & 6 deletions environment-accelerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ channels:
- defaults

dependencies:
- fftw
# There is a potential pyFFTW bug, pin to 0.12
# https://github.com/pyFFTW/pyFFTW/issues/294
- pyfftw=0.12
- pip
- python=3.8
- numpy=1.23.5
- scipy=1.9.3
- pyshtools
- numpy=1.24.1
- scipy=1.10.1
- scikit-learn
- scikit-image
- libblas=*=*accelerate
4 changes: 0 additions & 4 deletions environment-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ channels:
- defaults

dependencies:
- fftw
# There is a potential pyFFTW bug, pin to 0.12
# https://github.com/pyFFTW/pyFFTW/issues/294
- pyfftw=0.12
- pip
- python=3.8
- numpy=1.23.5
Expand Down
4 changes: 0 additions & 4 deletions environment-intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ channels:
- defaults

dependencies:
- fftw
# There is a potential pyFFTW bug, pin to 0.12
# https://github.com/pyFFTW/pyFFTW/issues/294
- pyfftw=0.12
- pip
- python=3.8
- numpy=1.23.5
Expand Down
4 changes: 0 additions & 4 deletions environment-openblas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ channels:
- defaults

dependencies:
- fftw
# There is a potential pyFFTW bug, pin to 0.12
# https://github.com/pyFFTW/pyFFTW/issues/294
- pyfftw=0.12
- pip
- python=3.8
- numpy=1.23.5
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ dependencies = [
"joblib",
"matplotlib >= 3.2.0",
"mrcfile",
"numpy>=1.21.5",
"numpy>=1.21.5, <2.0.0",
"packaging",
"pooch>=1.7.0",
"pillow",
"psutil",
"pyfftw",
"pymanopt",
"pyshtools<=4.10.4", # 4.11.7 might have a packaging bug
"PyWavelets",
Expand Down
2 changes: 1 addition & 1 deletion src/aspire/config_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ common:
# numeric module to use - one of numpy/cupy
numeric: numpy
# fft backend to use - one of pyfftw/scipy/cupy/mkl
fft: pyfftw
fft: scipy

# Set cache directory for ASPIRE example data.
# By default the cache location will be set by pooch.os_cache(),
Expand Down
6 changes: 5 additions & 1 deletion src/aspire/numeric/pyfftw_fft.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import os
from threading import Lock

import pyfftw
try:
import pyfftw
except ModuleNotFoundError:
raise ModuleNotFoundError("Install `pyfftw` to use as a backend.")

import pyfftw.interfaces.scipy_fftpack as scipy_fft

from aspire.numeric.base_fft import FFT
Expand Down
12 changes: 11 additions & 1 deletion tests/test_fft.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import logging
from unittest import TestCase

import numpy as np

from aspire import config
from aspire.numeric import fft_object, numeric_object

logger = logging.getLogger(__name__)
# Create test option combinations between numerical modules and FFT libs
test_backends = [("numpy", "scipy"), ("numpy", "pyfftw")]
test_backends = [("numpy", "scipy")]

try:
import pyfftw # noqa: F401

test_backends.append(("numpy", "pyfftw"))
except ModuleNotFoundError:
logger.info("`pyfftw` module is not installed, skipping `pyfftw` FFT backend.")


# Create Cupy fft backend if Cupy module is enabled and lib exits.
if config["common"]["numeric"].as_str() == "cupy":
Expand Down
2 changes: 1 addition & 1 deletion tests/test_synthetic_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ def test_volume_symmetry(vol_fixture):
corr = np.dot(rot_vol[0].flatten(), vol[0].flatten()) / np.dot(
vol[0].flatten(), vol[0].flatten()
)
assert abs(corr - 1) < 1e-5
assert abs(corr - 1) < 1.1e-5