diff --git a/.github/workflows/test_pull_requests.yml b/.github/workflows/test_pull_requests.yml index 77c1b6f9..a025fc87 100644 --- a/.github/workflows/test_pull_requests.yml +++ b/.github/workflows/test_pull_requests.yml @@ -54,30 +54,32 @@ jobs: flake8 --ignore E501,E203,W503 aydin test-linux39: - needs: [style, lint] - name: Tests - runs-on: ubuntu-latest - if: github.repository == 'royerlab/aydin' + needs: [style, lint] + name: Tests + runs-on: ubuntu-latest + if: github.repository == 'royerlab/aydin' - strategy: - matrix: - python-version: [ "3.9" ] + strategy: + matrix: + python-version: [ "3.9" ] - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e . - pip install pytest==6.2.5 - pip install mock==4.0.3 - - name: Run the tests - run: | - python -m pytest . --disable-pytest-warnings --durations=30 --show-capture=stderr + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libegl1 + python -m pip install --upgrade pip + pip install -e . + pip install pytest==6.2.5 + pip install mock==4.0.3 + - name: Run the tests + run: | + python -m pytest . --disable-pytest-warnings --durations=30 --show-capture=stderr test-unstable-linux39: needs: [ test-linux39 ] @@ -97,6 +99,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + sudo apt-get update + sudo apt-get install -y libegl1 python -m pip install --upgrade pip pip install -e . pip install pytest==6.2.5 @@ -123,6 +127,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + sudo apt-get update + sudo apt-get install -y libegl1 python -m pip install --upgrade pip pip install -e . pip install pytest==6.2.5 @@ -149,6 +155,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + sudo apt-get update + sudo apt-get install -y libegl1 python -m pip install --upgrade pip pip install -e . pip install pytest==6.2.5 diff --git a/aydin/gui/_qt/custom_widgets/overlay.py b/aydin/gui/_qt/custom_widgets/overlay.py index 78ffa2ac..428c4a9d 100644 --- a/aydin/gui/_qt/custom_widgets/overlay.py +++ b/aydin/gui/_qt/custom_widgets/overlay.py @@ -11,7 +11,7 @@ def __init__(self, parent=None): QWidget.__init__(self, parent) palette = QPalette(self.palette()) - palette.setColor(palette.Background, Qt.transparent) + # palette.setColor(palette.Background, Qt.transparent) self.setPalette(palette) def paintEvent(self, event): diff --git a/aydin/gui/_qt/custom_widgets/system_summary.py b/aydin/gui/_qt/custom_widgets/system_summary.py index eb985c4b..2b871d94 100644 --- a/aydin/gui/_qt/custom_widgets/system_summary.py +++ b/aydin/gui/_qt/custom_widgets/system_summary.py @@ -4,6 +4,7 @@ from numba.cuda import CudaSupportError from qtpy.QtCore import Qt from qtpy.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QGroupBox +import platform from aydin.util.misc.units import human_readable_byte_size @@ -23,8 +24,13 @@ def __init__(self, parent): self.cpu_group_box.setLayout(self.cpu_group_box_layout) # CPU freq + cpu_freq = ( + round(psutil.cpu_freq().current, 2) + if platform.processor() != "arm" + else "N/A" + ) self.cpu_freq_stats_label = QLabel( - f"Current CPU frequency:\t {round(psutil.cpu_freq().current, 2)} Mhz", self + f"Current CPU frequency:\t {cpu_freq} Mhz", self ) self.cpu_group_box_layout.addWidget(self.cpu_freq_stats_label) diff --git a/aydin/gui/gui.py b/aydin/gui/gui.py index 610359d5..5affcd98 100644 --- a/aydin/gui/gui.py +++ b/aydin/gui/gui.py @@ -23,8 +23,8 @@ def __init__(self, ver): self.title = "Aydin Studio - image denoising, but chill..." - self.desktop = QApplication.desktop() - self.screenRect = self.desktop.screenGeometry() + self.desktop = QApplication.primaryScreen() + self.screenRect = self.desktop.availableGeometry() height, width = self.screenRect.height(), self.screenRect.width() self.width = width // 3 @@ -131,7 +131,7 @@ def run(ver): """ app = QApplication(sys.argv) - app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) + app.setStyleSheet(qdarkstyle.load_stylesheet()) ex = App(ver) ex.show() sys.exit(app.exec()) diff --git a/aydin/gui/tabs/qt/denoise.py b/aydin/gui/tabs/qt/denoise.py index 5520196f..b566e91f 100644 --- a/aydin/gui/tabs/qt/denoise.py +++ b/aydin/gui/tabs/qt/denoise.py @@ -89,6 +89,12 @@ def __init__(self, parent): 'Noise2SelfFGR-random_forest', ] + self.basic_backend_options = [ + option + for option in self.backend_options + if option in self.basic_backend_options + ] + self.basic_backend_options_descriptions = [ description for option, description in zip( diff --git a/aydin/restoration/denoise/noise2selffgr.py b/aydin/restoration/denoise/noise2selffgr.py index 15c2fe14..84887517 100644 --- a/aydin/restoration/denoise/noise2selffgr.py +++ b/aydin/restoration/denoise/noise2selffgr.py @@ -1,7 +1,9 @@ import importlib import inspect import os +import platform import shutil +import sys from typing import Optional from aydin import regression @@ -12,15 +14,18 @@ from aydin.it.transforms.range import RangeTransform from aydin.it.transforms.variance_stabilisation import VarianceStabilisationTransform from aydin.regression.cb import CBRegressor -from aydin.regression.lgbm import LGBMRegressor from aydin.regression.linear import LinearRegressor from aydin.regression.perceptron import PerceptronRegressor -from aydin.regression.random_forest import RandomForestRegressor from aydin.regression.support_vector import SupportVectorRegressor from aydin.restoration.denoise.base import DenoiseRestorationBase from aydin.util.log.log import lsection +if sys.platform != "darwin": + from aydin.regression.lgbm import LGBMRegressor + from aydin.regression.random_forest import RandomForestRegressor + + class Noise2SelfFGR(DenoiseRestorationBase): """ Noise2Self image denoising using the "Feature Generation & Regression" ( @@ -107,6 +112,11 @@ def configurable_arguments(self): regression ) + if platform.system() == "Darwin": + for module in regression_modules: + if module.name in ["lgbm", "random_forest"]: + regression_modules.remove(module) + for module in regression_modules: regressor_args = self.get_class_implementation_kwargs( regression, module, module.name.replace("_", "") + "Regressor" @@ -123,10 +133,14 @@ def configurable_arguments(self): @property def implementations(self): """Returns the list of discovered implementations for given method.""" - return [ - "Noise2SelfFGR-" + x.name - for x in self.get_implementations_in_a_module(regression) - ] + regression_modules = self.get_implementations_in_a_module(regression) + + if platform.system() == "Darwin": + for module in regression_modules: + if module.name in ["lgbm", "random_forest"]: + regression_modules.remove(module) + + return ["Noise2SelfFGR-" + x.name for x in regression_modules] @property def implementations_description(self): @@ -139,7 +153,13 @@ def implementations_description(self): descriptions = [] - for module in self.get_implementations_in_a_module(regression): + regression_modules = self.get_implementations_in_a_module(regression) + if platform.system() == "Darwin": + for module in regression_modules: + if module.name in ["lgbm", "random_forest"]: + regression_modules.remove(module) + + for module in regression_modules: response = importlib.import_module(regression.__name__ + '.' + module.name) elem = [ x diff --git a/requirements/development.txt b/requirements/development.txt index 11af1e55..e8b3b692 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,4 +1,4 @@ -black=22.12.0 +black==22.12.0 flake8==4.0.1 mock==4.0.3 pytest==6.2.5 diff --git a/setup.cfg b/setup.cfg index 507409dd..232b91a1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,23 +37,23 @@ install_requires = importlib-metadata>=4.10.0 imageio==2.21.1 jsonpickle==1.3.0 - lightgbm>=3.3.1 - napari==0.4.15 + lightgbm>=3.3.1 ; sys_platform != "darwin" + napari==0.4.17 nd2reader>=3.3.0 numba>=0.55.1 numpy>=1.21.2 protobuf==3.20.1 pynndescent>=0.5.5 - PyQt5>=5.15.6 + PyQt6>=6.4.0 QDarkStyle==3.0.2 qtpy>=1.11.2 - scikit-image==0.18.3 + scikit-image>=0.18.3 scipy==1.9.3 # TODO: change after fix for 1.10.0 on osx - tensorflow==2.8.1 + tensorflow==2.8.0 ; sys_platform != "darwin" + tensorflow-macos==2.8.0 ; sys_platform == "darwin" torch>=1.10.1 keras==2.8.0 zarr>=2.12.0 - imagecodecs==2022.2.22 memoization>=0.4.0 [options.extras_require] diff --git a/setup.py b/setup.py index 1baaef30..8b6e882d 100644 --- a/setup.py +++ b/setup.py @@ -12,14 +12,6 @@ ) sys.exit(1) -# with open(os.path.join('requirements', 'default.txt')) as f: -# default_requirements = [ -# line.strip() for line in f if line and not line.startswith('#') -# ] -# -# INSTALL_REQUIRES = default_requirements -# REQUIRES = [] - setup( use_scm_version={"write_to": "aydin/_version.py"}, setup_requires=['setuptools_scm'],