Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
a-niem committed Jul 24, 2024
2 parents b3f685f + a58c065 commit f06fa4b
Show file tree
Hide file tree
Showing 37 changed files with 12,822 additions and 12,353 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_particledetection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python_version: ['3.8', '3.9', '3.10', '3.11']
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test_rodtracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
continue-on-error: true
strategy:
matrix:
python_version: ['3.8', '3.9', '3.10', '3.11']
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
env:
DISPLAY: ':99.0'
steps:
Expand All @@ -36,7 +36,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install ./RodTracker[test]
pip install pytest-xvfb
sudo apt install xvfb herbstluftwm libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
- name: Run Xvfb & window manager
run: |
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
sleep 3
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm
sleep 1
- name: Run tests
run: |
cd ./RodTracker
Expand Down
2 changes: 2 additions & 0 deletions ParticleDetection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## [Unreleased]
### Added
- support for Python 3.12

## [v0.4.1]
### Added
Expand Down
7 changes: 4 additions & 3 deletions ParticleDetection/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
Expand All @@ -29,14 +30,14 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
python = ">=3.8,<3.13"
matplotlib = [
{version = ">=3.8", python = ">=3.9"},
{version = ">=3.6.1,<3.8", python = "<3.9"}
]
networkx = ">=3.1"
numpy = [
{version = ">=1.23.4", python = ">=3.9"},
{version = ">=1.23.4,<2", python = ">=3.9"},
{version = ">=1.21,<=1.25", python = "<3.9"}
]
opencv-python-headless = ">=4.8.1.78"
Expand Down Expand Up @@ -78,7 +79,7 @@ TEST = ["pytest", "importlib_resources", "pytest-cov"]
addopts = [
"--cov=ParticleDetection",
"--cov-report=term",
"--cov-fail-under=50"
# "--cov-fail-under=50"
]
testpaths = [
"tests/",
Expand Down
21 changes: 20 additions & 1 deletion RodTracker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
## [Unreleased]

## [v0.6.3]
### Added
- support for Python 3.12
- viewing mode displaying all particles in a frame ([#94](https://github.com/ANP-Granular/ParticleTracking/issues/94))
- deleting particles from the `Particles` tab ([#93](https://github.com/ANP-Granular/ParticleTracking/issues/93))
- informative dialog before downloading the example model for rod detection ([#89](https://github.com/ANP-Granular/ParticleTracking/issues/89))

### Changed
- removed scaling of example data ([#95](https://github.com/ANP-Granular/ParticleTracking/issues/95))
- made error dialogues modal ([#92](https://github.com/ANP-Granular/ParticleTracking/issues/92))
- folders must be selected during image loading ([#88](https://github.com/ANP-Granular/ParticleTracking/issues/88))

### Fixed
- `numpy` & `torchvision` version conflict ([#90](https://github.com/ANP-Granular/ParticleTracking/issues/90))
- loss of dimension when detecting only 1 particle per frame ([#91](https://github.com/ANP-Granular/ParticleTracking/issues/91))
- multiple errors in tests


## [v0.6.2]
### Added
- automated testing using a GitHub workflow ([#84](https://github.com/ANP-Granular/ParticleTracking/issues/84))
Expand Down Expand Up @@ -166,7 +184,8 @@ This especially improves performance and responsiveness of the `RodTracker` when
### Added
- a versioning system

[Unreleased]: https://github.com/ANP-Granular/ParticleTracking/compare/v0.6.2...HEAD
[Unreleased]: https://github.com/ANP-Granular/ParticleTracking/compare/v0.6.3...HEAD
[v0.6.3]: https://github.com/ANP-Granular/ParticleTracking/compare/v0.6.2...v0.6.3
[v0.6.2]: https://github.com/ANP-Granular/ParticleTracking/compare/v0.6.1...v0.6.2
[v0.6.1]: https://github.com/ANP-Granular/ParticleTracking/compare/v0.6.0...v0.6.1
[v0.6.0]: https://github.com/ANP-Granular/ParticleTracking/compare/v0.5.8...v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions RodTracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ ubdirectory=RodTracker'
## Running the RodTracker
Run the **RodTracker** GUI using one of the possibilities:
- *(Standalone Program)* Run the executable installed by the installer.
- *(Python Package)* Run `RodTracker.py` manually:
- *(Python Package)* Run `main.py` manually:
```shell
YOUR/REPO/PATH/RodTracker/src/RodTracker$ python RodTracker.py
YOUR/REPO/PATH/RodTracker/src/RodTracker$ python main.py
```
- *(Python Package)* Use the registered command:
```shell
Expand Down
70 changes: 39 additions & 31 deletions RodTracker/build-files/build_onedir.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,61 @@ for dir in site.getsitepackages():

if platform.system() == "Darwin":
from PyInstaller.utils.hooks import collect_dynamic_libs
binaries += collect_dynamic_libs('torch')
binaries += [
(site_packages + '/torchaudio/lib/libtorchaudio.so', './torchaudio/lib'),
(site_packages + '/torchaudio/lib/libtorchaudio_sox.so', './torchaudio/lib'),

binaries += collect_dynamic_libs("torch")
binaries += [
(
site_packages + "/torchaudio/lib/libtorchaudio.so",
"./torchaudio/lib",
),
(
site_packages + "/torchaudio/lib/libtorchaudio_sox.so",
"./torchaudio/lib",
),
# FIXME: Causes the application to crash because of a version mismatch:
# ImportError: dlopen(/Users/Dmitry/DropBox_Adrian/Dropbox/ParticleTracking/REPO/RodTracker/dist/unix/RodTracker.app/Contents/Resources/cv2/cv2.abi3.so, 2): Library not loaded: @rpath/libpng16.16.dylib
# Referenced from: /Users/Dmitry/DropBox_Adrian/Dropbox/ParticleTracking/REPO/RodTracker/dist/unix/RodTracker.app/Contents/Frameworks/PIL/__dot__dylibs/libfreetype.6.dylib
# Reason: Incompatible library version: libfreetype.6.dylib requires version 57.0.0 or later, but libpng16.16.dylib provides version 56.0.0
# (site_packages + '/torchvision/image.so', './torchvision'),
]
icon_file = '../src/RodTracker/resources/icon_macOS.icns'
icon_file = "../src/RodTracker/resources/icon_macOS.icns"
elif platform.system() == "Windows":
icon_file = '../src/RodTracker/resources/icon_windows.ico'
version_info = 'version_info.txt'
icon_file = "../src/RodTracker/resources/icon_windows.ico"
version_info = "version_info.txt"
binaries += [
(site_packages + '/torchvision/image.pyd', './torchvision'),
(site_packages + "/torchvision/image.pyd", "./torchvision"),
]
elif platform.system() == "Linux":
binaries += [
(site_packages + '/torchaudio/lib/libtorchaudio.so', './torchaudio/lib'),
(
site_packages + "/torchaudio/lib/libtorchaudio.so",
"./torchaudio/lib",
),
# appears to have been removed in newer versions of torchaudio
# (site_packages + '/torchaudio/lib/libtorchaudio_ffmpeg.so', './torchaudio/lib'),
(site_packages + '/torchaudio/lib/libtorchaudio_sox.so', './torchaudio/lib'),
(site_packages + '/torchvision/image.so', './torchvision'),
(
site_packages + "/torchaudio/lib/libtorchaudio_sox.so",
"./torchaudio/lib",
),
(site_packages + "/torchvision/image.so", "./torchvision"),
]

a = Analysis(
['../src/RodTracker/RodTracker.py'],
pathex=['.'],
["../src/RodTracker/main.py"],
pathex=["."],
binaries=binaries,
datas=[
('../src/RodTracker/ui/*', './RodTracker/ui'),
('../src/RodTracker/backend/*', './RodTracker/backend'),
('../src/RodTracker/resources/*', './RodTracker/resources'),
('../../docs/build/html/', './docs/'),
('../../docs/build/html/_modules', './docs/_modules'),
('../../docs/build/html/_sources', './docs/_sources'),
('../../docs/build/html/_static', './docs/_static'),
(site_packages + '/pulp', './pulp'),
("../src/RodTracker/ui/*", "./RodTracker/ui"),
("../src/RodTracker/backend/*", "./RodTracker/backend"),
("../src/RodTracker/resources/*", "./RodTracker/resources"),
("../../docs/build/html/", "./docs/"),
("../../docs/build/html/_modules", "./docs/_modules"),
("../../docs/build/html/_sources", "./docs/_sources"),
("../../docs/build/html/_static", "./docs/_static"),
(site_packages + "/pulp", "./pulp"),
],
hiddenimports=[
'skimage.transform.hough_transform',
"skimage.transform.hough_transform",
],
hookspath=[],
hooksconfig={},
Expand All @@ -71,21 +83,17 @@ a = Analysis(
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False
noarchive=False,
)

pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='RodTrackerApp',
name="RodTrackerApp",
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand All @@ -94,7 +102,7 @@ exe = EXE(
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None ,
entitlements_file=None,
icon=icon_file,
version=version_info,
)
Expand All @@ -107,7 +115,7 @@ coll = COLLECT(
strip=False,
upx=True,
upx_exclude=[],
name='RodTracker'
name="RodTracker",
)

app = BUNDLE(
Expand Down
9 changes: 5 additions & 4 deletions RodTracker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
Expand All @@ -35,14 +36,14 @@ include = [
]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
python = ">=3.8,<3.13"
importlib-resources = {version = "^6.0"}
matplotlib = [
{version = ">=3.6.2", python = ">=3.9"},
{version = ">=3.6.2,<3.8", python ="<3.9"}
]
numpy = [
{version = ">=1.21", python = ">=3.9"},
{version = ">=1.21,<2", python = ">=3.9"},
{version = ">=1.21,<=1.25", python = "<3.9"}
]
pandas= [
Expand Down Expand Up @@ -81,13 +82,13 @@ test = ["pytest", "pytest-qt", "pytest-cov"]
docs = ["Sphinx", "docutils", "sphinx_rtd_theme", "myst_parser", "dunamai"]

[tool.poetry.scripts]
RodTracker = 'RodTracker.RodTracker:main'
RodTracker = 'RodTracker.main:main'

[tool.pytest.ini_options]
addopts = [
"--cov=RodTracker",
"--cov-report=term",
"--cov-fail-under=70"
# "--cov-fail-under=70"
]
testpaths = [
"tests/",
Expand Down
2 changes: 1 addition & 1 deletion RodTracker/src/RodTracker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
):
super().__init__(parent=parent)
self.setWindowIcon(QtGui.QIcon(fl.icon_path()))
self.setModal(False)
self.setModal(True)
self.setIcon(QtWidgets.QMessageBox.Warning)
self.setWindowTitle(APPNAME)
self.setText(
Expand Down
29 changes: 13 additions & 16 deletions RodTracker/src/RodTracker/backend/img_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"""**TBD**"""

import logging
import os
from pathlib import Path
from typing import List, Tuple

from PyQt5 import QtCore, QtGui, QtWidgets

import RodTracker.backend.logger as lg
import RodTracker.ui.dialogs as dialogs

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -102,9 +102,8 @@ def __init__(self, cam_number: int, *args, **kwargs) -> None:
def select_images(self, pre_selection: str = ""):
"""Lets the user select an image folder to show images from.
Lets the user select an image from folder out of which all images
are marked for later display. The selected image is opened
immediately.
Lets the user select a folder out of which all images are loaded for
later display. The first image in this folder is opened immediately.
Parameters
----------
Expand All @@ -117,22 +116,20 @@ def select_images(self, pre_selection: str = ""):
-------
None
"""
kwargs = {}
# handle file path issue when running on linux as a snap
if "SNAP" in os.environ:
kwargs["options"] = QtWidgets.QFileDialog.DontUseNativeDialog
chosen_file, _ = QtWidgets.QFileDialog.getOpenFileName(
None,
"Open an image",
chosen_folder = dialogs.select_data_folder(
"Open a folder of images",
pre_selection,
"Images (*.png *.jpeg *.jpg)",
**kwargs,
"Directory with Images (*.gif *.jpeg *.jpg *.png *.tiff)",
)
if chosen_file == "":
if chosen_folder is None:
# File selection was aborted
return
chosen_file = Path(chosen_file).resolve()
self.open_image_folder(chosen_file)
# Find and hand over the first file in the chosen directory
for file in chosen_folder.iterdir():
if file.is_dir():
continue
self.open_image_folder(file)
return

def open_image_folder(self, chosen_file: Path):
"""Tries to open an image folder to show the given image.
Expand Down
Loading

0 comments on commit f06fa4b

Please sign in to comment.