Skip to content

Commit 7f9bf0b

Browse files
Merge pull request #206 from CosmoStat/release/v3.1.0
Release/v3.1.0
2 parents 64c146c + 3f3788e commit 7f9bf0b

File tree

102 files changed

+7145
-3545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+7145
-3545
lines changed

.github/workflows/cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v3
20-
20+
2121
- name: Set up Python 3.10.11
2222
uses: actions/setup-python@v3
2323
with:
2424
python-version: "3.10.11"
25-
25+
2626
- name: Check Python Version
2727
run: python --version
2828

2929
- name: Install dependencies
3030
run: |
3131
python -m pip install ".[docs]"
32-
32+
3333
- name: Build API documentation
3434
run: |
3535
make -C docs clean
3636
make -C docs html
37-
37+
3838
- name: Deploy API documentation
3939
uses: peaceiris/actions-gh-pages@v3.5.9
4040
with:

.github/workflows/cd_manual.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v3
16-
16+
1717
- name: Set up Python 3.10.11
1818
uses: actions/setup-python@v3
1919
with:
2020
python-version: "3.10.11"
21-
21+
2222
- name: Check Python Version
2323
run: python --version
2424

2525
- name: Install dependencies
2626
run: |
27-
python -m pip install ".[docs]"
28-
27+
python -m pip install --upgrade pip setuptools wheel
28+
pip install -e ".[docs]"
29+
2930
- name: Build API documentation
3031
run: |
3132
make -C docs clean
3233
make -C docs html
33-
34+
3435
- name: Archive documentation as artifact
3536
uses: actions/upload-artifact@v4
3637
with:
3738
name: api-docs
38-
publish_dir: docs/build/html
39+
path: docs/build/html

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v3
23-
23+
2424
- name: Set up Python ${{ matrix.python-version }}
2525
uses: actions/setup-python@v3
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828

2929
- name: Install dependencies
3030
run: python -m pip install ".[test]"
31-
31+
3232
- name: Test with pytest
3333
run: python -m pytest
3434

.github/workflows/ci_manual.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
steps:
1717
- name:
1818
uses: actions/checkout@v3
19-
19+
2020
- name: Set up Python ${{ matrix.python-version }}
2121
uses: actions/setup-python@v3
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

2525
- name: Install dependencies
2626
run: python -m pip install ".[test]"
27-
27+
2828
- name: Test with pytest
2929
run: python -m pytest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ instance/
8989

9090
# Sphinx documentation
9191
docs/build/
92+
docs/_build/
9293
docs/source/wf_psf*.rst
9394
docs/source/_static/file.png
9495
docs/source/_static/images/logo_colab.png

.pre-commit-config.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# .pre-commit-config.yaml
2+
# WaveDiff pre-commit configuration
3+
# Globally excludes notebooks and historical papers directories
4+
5+
default_stages: [commit]
6+
7+
# Apply globally to all hooks
8+
exclude: '(^papers/|\.ipynb$)'
9+
10+
repos:
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v5.0.0
13+
hooks:
14+
- id: check-toml
15+
- id: check-yaml
16+
- id: trailing-whitespace
17+
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: v0.10.0
20+
hooks:
21+
- id: ruff
22+
args: [--fix, --exit-non-zero-on-fix]
23+
24+
- id: ruff-format
25+
26+
- repo: https://github.com/adamchainz/blacken-docs
27+
rev: 1.19.1
28+
hooks:
29+
- id: blacken-docs
30+
additional_dependencies: [black==24.10.0]
31+
args: [-l, '120', -t, py312]
32+
33+
- repo: local
34+
hooks:
35+
- id: check-scriv-fragment
36+
name: Ensure Scriv fragment exists for PR
37+
entry: bash -c
38+
args:
39+
- |
40+
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.py$|\.md$|\.rst$|\.yaml$" | grep -v "^docs/")
41+
FRAGMENTS=$(git diff --cached --name-only --diff-filter=ACM | grep "^changelog.d/")
42+
if [ -n "$CHANGED_FILES" ] && [ -z "$FRAGMENTS" ]; then
43+
echo "ERROR: Please add a Scriv changelog fragment in changelog.d/ for this PR."
44+
exit 1
45+
fi
46+
language: system

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,67 @@
22

33
All notable changes to WaveDiff are documented in this file.
44

5+
<!-- scriv-end-here -->
6+
57
## [Unreleased]
68

79
- Changes in progress for the next release.
10+
11+
<a id='changelog-v3.1.0'></a>
12+
# v3.1.0 — 2026-02-23
13+
14+
## New features
15+
16+
- Added PSF inference capabilities for generating broadband (polychromatic) PSFs from trained models given star positions and SEDs
17+
- Introduced `PSFInferenceEngine` class to centralize training, simulation, metrics, and inference workflows
18+
- Added `run_type` attribute to `DataHandler` supporting training, simulation, metrics, and inference modes
19+
- Implemented `ZernikeInputsFactory` class for building `ZernikeInputs` instances based on run type
20+
- Added `psf_model_loader.py` module for centralized model weights loading
21+
22+
- Added configurable optimizer selection system via new `optimizer.py` module with `get_optimizer` function
23+
- Optimizer configuration now supports multiple input types: `RecursiveNamespace` from configs, dictionaries, or string names
24+
- Added support for hyperparameter overrides (learning rate, beta1/beta2, epsilon, amsgrad) via YAML or programmatic configuration
25+
- `RectifiedAdam` optimizer now dynamically imports TensorFlow Addons only when explicitly specified in configuration
26+
27+
## Bug fixes
28+
29+
- Fix logger formatting for relative RMSE metrics in `metrics.py` (values were not being displayed)
30+
31+
## Internal changes
832

33+
- Added pre-commit hooks for code quality, formatting, and changelog enforcement
34+
- Refactored `TFPhysicalPolychromatic` and related modules to separate training vs. inference behavior
35+
- Enhanced `ZernikeInputs` data class with intelligent assembly based on run type and available data
36+
- Implemented hybrid loading pattern with eager loading in constructors and lazy-loading via property decorators
37+
- Centralized PSF data extraction in `data_handler` module
38+
- Improved code organization with new `tf_utils.py` module in `psf_models` sub-package
39+
- Updated configuration handling to support inference workflows via `inference_config.yaml`
40+
- Fixed incorrect argument name in `DataHandler` that prevented proper TensorFlow data type conversion
41+
- Removed deprecated `get_obs_positions` method
42+
- Updated documentation to include inference package
43+
- Refactored `build_PSF_model` to accept either Keras optimizer instances or configuration passed through `get_optimizer`
44+
- Added `interpolation.py` and `types.py` modules with vendored code from TensorFlow Addons repository
45+
- Replaced `tfa.image.interpolate_spline` with local `tfa_interpolate_spline_rbf` implementation
46+
- Added comprehensive unit tests in `test_optimizer.py` and `test_interpolation.py`
47+
- Updated README and added THIRD_PARTY_LICENSE directory with TensorFlow Addons license
48+
- Training now runs on TensorFlow 2.11 without requiring TensorFlow Addons installation
49+
- Removed TensorFlow Addons as a required dependency; RectifiedAdam optimizer now requires explicit TFA installation if needed
50+
- Remove deprecated/optional import tensorflow-addons statement from tf_layers.py
51+
- Fixed Sphinx autosummary import errors by removing core dependencies (tensorflow) from `autodoc_mock_imports` in `conf.py`.
52+
- Updated pyproject.toml to include all wf_psf packages under `src/` and include config/yaml files.
53+
- Updated example configuration files with clearer inline comments.
54+
- Generated API documentation for new `inference` package in `api.rst`
55+
- Generated API documentation for new `instrument` package in `api.rst`
56+
- Inference Configuration section in `configuration.md` documenting `inference_config.yaml`
57+
- Restructured Configuration documentation:
58+
- Split workflows into "CLI Tasks" and "Additional Components" sections
59+
- Added configuration file dependency table showing required vs optional files per task
60+
- Clarified configuration filename flexibility (filenames customizable, internal structure fixed)
61+
- Standardized section titles (Training Configuration, Metrics Configuration, etc.)
62+
- Improved markdown formatting and fixed broken anchor links
63+
- Updated `dependencies.md` to document `tensorflow-addons` as optional dependency with manual installation instructions
64+
- `tensorflow-addons` from core dependencies documentation (now documented as optional)
65+
s
966
## [3.0.0] – 2026-01-20
1067

1168
Major update with PSF model refactoring, masked training, and CI/doc improvements.

DEV_WORKFLOW.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# **WaveDiff Development Plan**
22

33
## 1. **Define a Milestone**
4-
4+
55

66
* **Purpose**: Milestones mark the completion of project cycles and achievement of predefined goals. A milestone is a timeline point marking the end of a project cycle, where a set of goals defined at the start of the cycle have been completed.  Goals could be tasks associated with feature development, testing phase completion, etc. List & Open issues. 
7-
7+
88
* **Types of Milestones:** Differentiate between major, minor and patch release releases to track progress effectively.
9-
9+
1010

1111
Make a milestone related to a release on possibly a minor release schedule (e.g. monthly schedule). Differentiate between the different types of releases (minor, major, patch).
1212

1313
## 2. **Git Workflow Branching Model (Made with** [**mermaid**](https://mermaid.js.org)**)**
1414
![](assets/Git-Branching-Model.png)
1515

1616
* **main**: Stores official release history with tagged version numbers (see top row in the diagram above).
17-
17+
1818
* **develop**: This branch is the integration branch for features.
1919

2020
* **feature**: Branch off of `develop` for new feature development.  Features get merged to `develop` (never to main).
@@ -30,7 +30,7 @@ Make a milestone related to a release on possibly a minor release schedule (e.g.
3030

3131

3232
## 3. **New Branch naming conventions**
33-
33+
3434

3535
Branches created for the purpose of a Pull Request should be directly related to an open issue within the project’s issue tracker.  This ensures that all code changes are tied to specific tasks or features, facilitating better organisation and tracking of contributions. Below are the branch naming conventions:
3636

@@ -51,41 +51,41 @@ Branches created for the purpose of a Pull Request should be directly related to
5151
Replace with the corresponding issue number and provide a brief description of the changes in \`short\_description\`.
5252

5353
## 4. **Feature branch creation** 
54-
54+
5555

5656
* Pull the latest changes from the remote repository
5757

5858
* Checkout `develop`
5959

6060
* Create a new feature branch
61-
61+
6262
* Ensure the feature branch’s commits align with the defined scope
63-
63+
6464

6565
**Tip**: Keep feature branch development focused on the defined scope outlined in the corresponding issue. Avoid introducing unrelated changes. Instead, open a new issue for out-of-scope features or bugs, creating a separate branch for their development.
6666

6767
## 5. **Completion of development** 
68-
68+
6969

7070
* Run training and metrics validation tests locally to confirm no breaking behaviour or errors were introduced.  Include test reports as per the PR template.
7171

7272
* Open a Pull Request to start the review process, ensuring to map the branch correctly to the target branch (i.e. `feature` -> `develop` or `hotfix` -> `main`).
7373

7474
* In the description of the Pull Request, explicitly state whether the PR resolves or closes an open issue by using one of the following formats:
75-
75+
7676
* "Solves #"
77-
77+
7878
* "Closes #"
79-
79+
8080

8181
Example: "Solves #12345" or "Closes #8679".
8282

8383
* Ensure that the PR meets the defined requirements and passes Continuous Integration (CI) tests.
84-
84+
8585
* Assign a reviewer, assign yourself as assignee, select the correct project, choose the correct label that describes the nature of the issue (e.g. bug, enhancement, etc), choose Milestone if applicable if the issue is associated with a specific milestone or target release.
86-
86+
8787
* Address reviewer feedback in threads and iterate as needed, implementing the requested changes or explaining why the task is implemented in the manner it is.  Respect the rule: Whoever opens the thread/conversation in the Pull Request is responsible for closing it.
88-
88+
8989

9090
## 6. **Merging Pull Requests** 
9191

@@ -126,9 +126,9 @@ This separation keeps release notes accurate and enables clean backports
126126
## 8. **Preparing for a Release**
127127

128128

129-
* Each milestone targets a release (feature, patch, etc).
129+
* Each milestone targets a release (feature, patch, etc).
130130

131-
* Open a PR from `develop` to `release/vX.Y.Z` upon completing a milestone
131+
* Create release branch with `git checkout -b release/vX.Y.Z develop` upon completing a milestone
132132

133133
* Collect changelog fragments and generate release notes using:
134134

@@ -138,28 +138,28 @@ This separation keeps release notes accurate and enables clean backports
138138
* Ensure all checklist items for the release are completed.
139139

140140
* Merge the PR into main and tag the release.
141-
141+
142142

143143
## 9. **Continuous Improvement**
144144

145145

146146
* Regularly review and refine the workflow based on team feedback and lessons learned.
147-
147+
148148
* Encourage collaboration and communication among team members to streamline processes and enhance productivity.
149-
149+
150150

151151
## 10. **Documentation and Training**
152152

153153

154154
* Maintain up-to-date documentation outlining the development workflow and procedures.
155-
155+
156156
* Provide training to new team members and ensure existing members are familiar with the workflow and best practices.
157157

158158

159159
## 11. **Automation and Tooling**
160160

161161

162162
* Explore automation tools to streamline repetitive tasks, such as testing, code formatting, and deployment.
163-
163+
164164
* Integrate with CI/CD pipelines for automated testing and deployment processes.
165-
165+

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![arXiv:2203.04908](https://img.shields.io/badge/astro--ph.IM-arXiv%3A2203.04908-B31B1B.svg)](http://arxiv.org/abs/2203.04908)
2-
[![yapf](https://img.shields.io/badge/code%20style-yapf-blue.svg)](https://www.python.org/dev/peps/pep-0008/)
1+
[![arXiv:2203.04908](https://img.shields.io/badge/astro--ph.IM-arXiv%3A2203.04908-B31B1B.svg)](http://arxiv.org/abs/2203.04908)
2+
[![yapf](https://img.shields.io/badge/code%20style-yapf-blue.svg)](https://www.python.org/dev/peps/pep-0008/)
33
[![License](https://img.shields.io/badge/License-MIT-brigthgreen.svg)](https://github.com/tobias-liaudat/wf-psf/tree/master/LICENSE)
44
[![Documentation](https://img.shields.io/badge/docs-online-blue)](https://cosmostat.github.io/wf-psf/)
55
<h1 align='center'>WaveDiff</h1>
@@ -13,3 +13,15 @@ This repository includes:
1313
- A differentiable PSF model entirely built in [Tensorflow](https://github.com/tensorflow/tensorflow).
1414
- A [numpy-based PSF simulator](https://github.com/CosmoStat/wf-psf/tree/dummy_main/src/wf_psf/sims).
1515
- All the scripts, jobs and notebooks required to reproduce the results in [arXiv:2203.04908](http://arxiv.org/abs/2203.04908) and [arXiv:2111.12541](https://arxiv.org/abs/2111.12541).
16+
17+
---------------------------------------------------------------------------
18+
NOTICE ABOUT THIRD-PARTY CODE
19+
20+
This repository contains code copied from TensorFlow Addons
21+
(https://github.com/tensorflow/addons), specifically the
22+
`interpolate_spline` and `types.py` modules.
23+
24+
Those files are licensed under the Apache License, Version 2.0.
25+
The copyright and license headers are preserved in each copied file.
26+
27+
All other code in this repository remains under the MIT License.

0 commit comments

Comments
 (0)