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

PyQt6 #299

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

PyQt6 #299

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
52 changes: 30 additions & 22 deletions .github/workflows/test_pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aydin/gui/_qt/custom_widgets/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 7 additions & 1 deletion aydin/gui/_qt/custom_widgets/system_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions aydin/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
6 changes: 6 additions & 0 deletions aydin/gui/tabs/qt/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
34 changes: 27 additions & 7 deletions aydin/restoration/denoise/noise2selffgr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import importlib
import inspect
import os
import platform
import shutil
import sys
from typing import Optional

from aydin import regression
Expand All @@ -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" (
Expand Down Expand Up @@ -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"
Expand All @@ -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):
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black=22.12.0
black==22.12.0
flake8==4.0.1
mock==4.0.3
pytest==6.2.5
Expand Down
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 0 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down