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: 0 additions & 33 deletions .flake8

This file was deleted.

17 changes: 8 additions & 9 deletions .github/workflows/check_headers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,20 @@ jobs:
*.py) echo "$PYTHON_HEADER" ;;
*.yml|*.yaml) echo "$YML_HEADER" ;;
*.md) echo "$MARKDOWN_HEADER" ;;
*.ini|.gitignore|.flake8) echo "$INI_HEADER" ;;
*.ini|.gitignore) echo "$INI_HEADER" ;;
*) echo "$INI_HEADER" ;; # Default to # comments
esac
}

# Find all relevant files excluding specified directories
PYTHON_FILES=$(find . -name "*.py" -not -path "./datalabs_setup/*" -not -path "./utility_scripts/*" -not -path "./.git/*" -not -path "./__pycache__/*" -not -path "./.*/__pycache__/*")
YML_FILES=$(find . -name "*.yml" -o -name "*.yaml" | grep -v "./.git/")
MARKDOWN_FILES=$(find . -name "*.md" -not -path "./.github/ISSUE_TEMPLATE/*" | grep -v "./.git/")
INI_FILES=$(find . -name "*.ini" | grep -v "./.git/")
GITIGNORE_FILES=$(find . -name ".gitignore" | grep -v "./.git/")
FLAKE8_FILES=$(find . -name ".flake8" | grep -v "./.git/")

YML_FILES=$(find . -name "*.yml" -o -name "*.yaml" | grep -v "./.git/" || true)
MARKDOWN_FILES=$(find . -name "*.md" -not -path "./.github/ISSUE_TEMPLATE/*" | grep -v "./.git/" || true)
INI_FILES=$(find . -name "*.ini" | grep -v "./.git/" || true)
GITIGNORE_FILES=$(find . -name ".gitignore" | grep -v "./.git/" || true)

# Combine all files
ALL_FILES="$PYTHON_FILES $YML_FILES $MARKDOWN_FILES $INI_FILES $GITIGNORE_FILES $FLAKE8_FILES"
ALL_FILES="$PYTHON_FILES $YML_FILES $MARKDOWN_FILES $INI_FILES $GITIGNORE_FILES"

MISSING_HEADERS=()

Expand Down Expand Up @@ -118,7 +117,7 @@ jobs:
done
echo ""
echo "Please add the correct license header to these files."
echo "File types checked: .py, .yml/.yaml, .md, .ini, .gitignore, .flake8"
echo "File types checked: .py, .yml/.yaml, .md, .ini, .gitignore"
echo "Note: Python files exclude datalabs_setup/ and utility_scripts/ directories"
exit 1
fi
4 changes: 2 additions & 2 deletions .github/workflows/dead_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Run vulture (100% confidence)
run: |
echo "Running vulture dead code detection (100% confidence - blocking)..."
vulture anomaly_match/ .vulture_whitelist.py --min-confidence 100
vulture anomaly_match/ anomaly_match_ui/ .vulture_whitelist.py --min-confidence 100

vulture-warnings:
name: Vulture (60% confidence - not required)
Expand All @@ -41,4 +41,4 @@ jobs:
echo "Running vulture dead code detection (60% confidence)..."
echo "This check fails if potential dead code is found, but is not required to pass."
echo ""
vulture anomaly_match/ .vulture_whitelist.py --min-confidence 60
vulture anomaly_match/ anomaly_match_ui/ .vulture_whitelist.py --min-confidence 60
12 changes: 7 additions & 5 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# is part of this source code package. No part of the package, including
# this file, may be copied, modified, propagated, or distributed except according to
# the terms contained in the file 'LICENCE.txt'.
name: Black Format Check
name: Ruff Lint and Format Check

on: [pull_request]

Expand All @@ -13,9 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: astral-sh/ruff-action@v3
with:
options: "--check --line-length 100"
args: "check"
src: "."
jupyter: false
version: "24.8.0"
- uses: astral-sh/ruff-action@v3
with:
args: "format --check"
src: "."
31 changes: 9 additions & 22 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@ on:
pull_request:
workflow_dispatch:
jobs:
lint_flake8:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Lint with flake8
run: |
pip install flake8
flake8 . --count --show-source --statistics --max-line-length=127 --ignore=E402,W503,E203
build:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -36,32 +23,32 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Search for severe code errors with flake8
- name: Search for severe code errors with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
pip install flake8
flake8 . --count --select=E9,F63,F7,F82,F541 --show-source --statistics --max-line-length=127
pip install ruff
ruff check . --select=E9,F63,F7,F82,F541 --output-format=full
- name: provision-with-micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment_CI.yml
environment-name: am
cache-downloads: true
cache-environment: true
- name: Test with pytest
shell: bash -l {0}
run: |
set -e
set -o pipefail
micromamba activate am
micromamba install pytest pytest-cov
pytest --junitxml=pytest.xml --cov-report=xml:coverage.xml --cov-report=term --cov=anomaly_match tests/ | tee pytest-coverage.txt
pytest --durations=20 --junitxml=pytest.xml --cov-report=xml:coverage.xml --cov-report=term --cov=anomaly_match tests/ | tee pytest-coverage.txt
echo "===== Coverage report ====="
cat pytest-coverage.txt
cat pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
if: always() && github.event_name == 'pull_request'
Expand All @@ -75,4 +62,4 @@ jobs:
create-new-comment: false
hide-comment: false
report-only-changed-files: false
junitxml-path: ./pytest.xml
junitxml-path: ./pytest.xml
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,9 @@ pytest-coverage.txt
pytest.xml
# IDE and editor settings
.vscode/
.claude/
pr.md
# Local Cutana checkout for development
Cutana/
# Claude Code temp directories
tmpclaude-*
5 changes: 4 additions & 1 deletion .vulture_whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# FixMatch class attributes
requires_grad # noqa - PyTorch tensor property set to disable gradient for EMA model

# TestCNN - nn.Module.forward() called implicitly by PyTorch
TestCNN.forward # noqa - Called via model(x) in FixMatch training loop

# AnomalyDetectionDataset methods used in tests (tests/dataset_test.py)
_read_and_resize_image # noqa - Used in test_read_and_resize_different_formats
unlabeled_filepaths # noqa - Used in test_anomaly_detection_dataset_properties
Expand Down Expand Up @@ -60,5 +63,5 @@
_.benchmark # noqa - torch.backends.cudnn.benchmark attribute

# Image processing functions used in prediction scripts (root level, excluded from scan)
process_single_wrapper # noqa - Used in prediction_process_hdf5.py, prediction_process_zarr.py
process_single_wrapper # noqa - Used in prediction_utils.py, prediction_process_hdf5.py
_.n_expected_channels # noqa - fitsbolt config attribute set dynamically
36 changes: 36 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,42 @@
[//]: # (this file, may be copied, modified, propagated, or distributed except according to)
[//]: # (the terms contained in the file 'LICENCE.txt'.)

## [v1.3.0] – 2026-02-11

### Added
- **Multispectral image support** for arbitrary channel count images with configurable `channel_combination` matrices (#255)
- **UI separation** into standalone `anomaly_match_ui` package for cleaner architecture (#257)
- **Flux conversion configuration** (`apply_flux_conversion`) ensuring training/prediction consistency (#272)
- **timm model backend** replacing efficientnet-specific packages for broader model support (#268)
- **`test-cnn` model** for fast unit/integration testing without heavy model downloads (#265)

### Changed
- **Replaced black and flake8 with ruff** for linting and formatting (#258)
- **Restructured test suite** into unit/integration/e2e/ui directories with pytest markers and CI caching (#265)
- **Deduplicated prediction code** into shared `prediction_utils.py` module (#264)
- **Auto-inference of `n_output_channels`** from `channel_combination` matrix or FITS extension count (#276, #278)
- **PIL resize for CONVERSION_ONLY** normalisation achieving up to 73x faster image loading (#259)
- **Faster catalogue validation** by skipping per-chunk FITS existence checks and using parquet metadata (#277)

### Fixed
- **Double normalisation** in cutana streaming pipeline (#271)
- **Normalisation consistency** between cutana and training paths with channel_weights passthrough (#274)
- **Session logging** with eager directory creation and per-session log files (#260)
- **Gallery not updating** after prediction chunks complete (#262)
- **Cutana source ID handling** for non-string int64 source_ids (#261)
- **Albumentations 2.0 compatibility** renaming deprecated `mode` to `border_mode` (#276)
- **Prediction progress bar** with phase tracking for better user feedback (#276)
- **Identity channel_combination** auto-creation for multi-extension FITS configs (#278)
- **ASinh parameters** missing in cutana format config (#279)
- **Filter name resolution** from catalogue for cutana streaming (#281)
- **Primary HDU validation** raising ValueError when no image data found (#271)

### Documentation
- **Normalisation README** with improved channel_combination and flux conversion documentation (#275)
- **Auto-inference documentation** updating multispectral config examples (#284)

---

## [v1.2.0] – 2025-01-13

### Added
Expand Down
Loading