icarus-thermal 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- icarus_thermal-0.1.0/LICENSE +21 -0
- icarus_thermal-0.1.0/PKG-INFO +238 -0
- icarus_thermal-0.1.0/README.md +201 -0
- icarus_thermal-0.1.0/icarus/__init__.py +54 -0
- icarus_thermal-0.1.0/icarus/data/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/data/loader.py +213 -0
- icarus_thermal-0.1.0/icarus/data/preprocessor.py +203 -0
- icarus_thermal-0.1.0/icarus/decomposition/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/decomposition/dmd.py +214 -0
- icarus_thermal-0.1.0/icarus/decomposition/pod.py +237 -0
- icarus_thermal-0.1.0/icarus/features/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/features/engineer.py +171 -0
- icarus_thermal-0.1.0/icarus/metrics/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/metrics/evaluation.py +104 -0
- icarus_thermal-0.1.0/icarus/models/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/models/neural.py +341 -0
- icarus_thermal-0.1.0/icarus/pipeline/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/pipeline/runner.py +317 -0
- icarus_thermal-0.1.0/icarus/registry/__init__.py +5 -0
- icarus_thermal-0.1.0/icarus/registry/dataset.py +252 -0
- icarus_thermal-0.1.0/icarus/registry/extractor.py +203 -0
- icarus_thermal-0.1.0/icarus/registry/trainer.py +302 -0
- icarus_thermal-0.1.0/icarus/trainer.py +0 -0
- icarus_thermal-0.1.0/icarus/visualisation/__init__.py +1 -0
- icarus_thermal-0.1.0/icarus/visualisation/plots.py +266 -0
- icarus_thermal-0.1.0/icarus_thermal.egg-info/PKG-INFO +238 -0
- icarus_thermal-0.1.0/icarus_thermal.egg-info/SOURCES.txt +31 -0
- icarus_thermal-0.1.0/icarus_thermal.egg-info/dependency_links.txt +1 -0
- icarus_thermal-0.1.0/icarus_thermal.egg-info/requires.txt +17 -0
- icarus_thermal-0.1.0/icarus_thermal.egg-info/top_level.txt +1 -0
- icarus_thermal-0.1.0/pyproject.toml +50 -0
- icarus_thermal-0.1.0/setup.cfg +4 -0
- icarus_thermal-0.1.0/tests/test_core.py +343 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Raymond Twum-Barima
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: icarus-thermal
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Icarus: data-driven heat flux prediction from infrared thermography using POD, DMD, and machine learning
|
|
5
|
+
Author: Raymond Twum-Barima
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/twumbarimaraymond1-coder/icarus
|
|
8
|
+
Project-URL: Documentation, https://icarus.readthedocs.io
|
|
9
|
+
Project-URL: Issues, https://github.com/twumbarimaraymond1-coder/icarus/issues
|
|
10
|
+
Keywords: heat transfer,boiling,POD,DMD,machine learning,infrared thermography
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: numpy>=1.24
|
|
22
|
+
Requires-Dist: scipy>=1.10
|
|
23
|
+
Requires-Dist: scikit-learn>=1.3
|
|
24
|
+
Requires-Dist: optuna>=3.3
|
|
25
|
+
Requires-Dist: matplotlib>=3.7
|
|
26
|
+
Requires-Dist: h5py>=3.9
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy; extra == "dev"
|
|
32
|
+
Provides-Extra: docs
|
|
33
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
34
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
35
|
+
Requires-Dist: nbsphinx; extra == "docs"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# icarus
|
|
39
|
+
|
|
40
|
+
**Data-driven heat flux prediction from infrared thermography.**
|
|
41
|
+
|
|
42
|
+
`icarus` provides a full pipeline from raw IR camera data to trained
|
|
43
|
+
heat flux prediction models using Proper Orthogonal Decomposition (POD),
|
|
44
|
+
Dynamic Mode Decomposition (DMD), and artificial neural networks.
|
|
45
|
+
|
|
46
|
+
It implements the methodology from:
|
|
47
|
+
|
|
48
|
+
> *Investigating the efficacy of data-driven techniques and machine learning
|
|
49
|
+
> algorithms to predict heat transfer characteristics* (Twum-Barima, 2025)
|
|
50
|
+
|
|
51
|
+
The best-performing approach (Model C: POD modal mapping) achieved **R² = 0.729**
|
|
52
|
+
on a 17M-sample flow boiling dataset — a 69 % improvement over the linear baseline.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install icarus
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or from source:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/yourusername/icarus
|
|
66
|
+
cd icarus
|
|
67
|
+
pip install -e ".[dev]"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Requirements:** Python ≥ 3.9, NumPy, SciPy, scikit-learn, Optuna, Matplotlib
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Quickstart
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import icarus as tf
|
|
78
|
+
|
|
79
|
+
# Load your dataset (.mat, .h5, .npz supported)
|
|
80
|
+
data = tf.data.loader.load(
|
|
81
|
+
"experiment.mat",
|
|
82
|
+
temperature_key="T",
|
|
83
|
+
heatflux_key="qL2",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Or load from numpy arrays directly
|
|
87
|
+
import numpy as np
|
|
88
|
+
data = tf.data.loader.from_arrays(T, q, dt=2.5e-4)
|
|
89
|
+
|
|
90
|
+
# Run the full pipeline (POD modal strategy, best performance)
|
|
91
|
+
pipeline = tf.Pipeline(
|
|
92
|
+
strategy="modal", # "raw" | "gradient" | "modal"
|
|
93
|
+
n_pod_modes=5,
|
|
94
|
+
spatial_crop=5,
|
|
95
|
+
trim_frames=43,
|
|
96
|
+
optimise_hyperparams=True,
|
|
97
|
+
n_trials=30,
|
|
98
|
+
)
|
|
99
|
+
pipeline.fit(data)
|
|
100
|
+
|
|
101
|
+
# Evaluate
|
|
102
|
+
metrics = pipeline.evaluate()
|
|
103
|
+
# [test] R² = 0.7293 RMSE = 25,959 W/m² MAE = 20,656 W/m²
|
|
104
|
+
|
|
105
|
+
# Predict on new data
|
|
106
|
+
q_predicted = pipeline.predict(T_new) # shape [ny, nx, nt]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Three model strategies
|
|
112
|
+
|
|
113
|
+
| Strategy | Features | Notes |
|
|
114
|
+
|----------|----------|-------|
|
|
115
|
+
| `"raw"` (Model A) | Temperature only | Baseline |
|
|
116
|
+
| `"gradient"` (Model B) | T + dT/dt + dT/dx + dT/dy | Modest improvement |
|
|
117
|
+
| `"modal"` (Model C) | POD modal contributions | **Best: R² = 0.729** |
|
|
118
|
+
|
|
119
|
+
The modal strategy works by:
|
|
120
|
+
1. Decomposing the temperature field into dominant POD modes
|
|
121
|
+
2. Learning a mapping from temperature modal coefficients → heat flux modal coefficients
|
|
122
|
+
3. Reconstructing the full heat flux field from the predicted coefficients
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Individual components
|
|
127
|
+
|
|
128
|
+
You can also use the modules independently:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from icarus.decomposition.pod import POD
|
|
132
|
+
from icarus.data.preprocessor import Preprocessor
|
|
133
|
+
|
|
134
|
+
# Preprocessing
|
|
135
|
+
pre = Preprocessor()
|
|
136
|
+
out = pre.fit_transform(data)
|
|
137
|
+
X_c = Preprocessor.to_matrix(out["T_c"]) # [n_pix, nt]
|
|
138
|
+
|
|
139
|
+
# POD
|
|
140
|
+
pod = POD(n_modes=10)
|
|
141
|
+
pod.fit(X_c)
|
|
142
|
+
print(f"First 5 modes capture {pod.cumulative_energy_[4]:.1%} of variance")
|
|
143
|
+
|
|
144
|
+
# Modal contributions
|
|
145
|
+
contribs = pod.modal_contributions(X_c) # [n_pix, nt, n_modes]
|
|
146
|
+
|
|
147
|
+
# Visualisation
|
|
148
|
+
from icarus.visualisation.plots import plot_pod_modes, plot_cumulative_energy
|
|
149
|
+
ny, nx = out["T"].shape[:2]
|
|
150
|
+
plot_cumulative_energy(pod)
|
|
151
|
+
plot_pod_modes(pod, ny=ny, nx=nx, n_modes=5)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from icarus.decomposition.dmd import DMD
|
|
156
|
+
|
|
157
|
+
# DMD forecasting
|
|
158
|
+
dmd = DMD(energy_threshold=0.99, dt=2.5e-4)
|
|
159
|
+
dmd.fit(X_c_train)
|
|
160
|
+
X_forecast = dmd.forecast_from(X_c_train[:, -1], n_steps=1200)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Visualisation
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from icarus.visualisation.plots import (
|
|
169
|
+
plot_field,
|
|
170
|
+
plot_pod_modes,
|
|
171
|
+
plot_cumulative_energy,
|
|
172
|
+
plot_scatter,
|
|
173
|
+
plot_model_summary,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
# Single field
|
|
177
|
+
plot_field(q[:, :, 100], title="Heat flux at t=100")
|
|
178
|
+
|
|
179
|
+
# Full model evaluation summary (6-panel figure)
|
|
180
|
+
plot_model_summary(
|
|
181
|
+
q_true_field, q_pred_field,
|
|
182
|
+
y_true_flat, y_pred_flat,
|
|
183
|
+
metrics_train, metrics_test,
|
|
184
|
+
r2_t=r2_t, rmse_t=rmse_t,
|
|
185
|
+
model_name="Model C — POD Modal",
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Running tests
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
pytest tests/ -v
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Project structure
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
icarus/
|
|
203
|
+
├── data/
|
|
204
|
+
│ ├── loader.py # .mat, .h5, .npz, numpy array loading
|
|
205
|
+
│ └── preprocessor.py # cropping, mean-centering, reshaping
|
|
206
|
+
├── decomposition/
|
|
207
|
+
│ ├── pod.py # POD via SVD
|
|
208
|
+
│ └── dmd.py # DMD forecasting
|
|
209
|
+
├── features/
|
|
210
|
+
│ └── engineer.py # gradient and modal feature construction
|
|
211
|
+
├── models/
|
|
212
|
+
│ └── neural.py # MLP with Bayesian optimisation
|
|
213
|
+
├── metrics/
|
|
214
|
+
│ └── evaluation.py # R², RMSE, MAE
|
|
215
|
+
├── visualisation/
|
|
216
|
+
│ └── plots.py # spatial fields, modes, diagnostics
|
|
217
|
+
└── pipeline/
|
|
218
|
+
└── runner.py # end-to-end Pipeline
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Known limitations
|
|
224
|
+
|
|
225
|
+
- Experimental datasets are not included in this repository.
|
|
226
|
+
- The reported Model C R² = 0.729 is dataset-specific and should be revalidated on independent datasets before being cited as a general result.
|
|
227
|
+
- The default ANN search space (`"medium"`) is designed for moderate-sized datasets with 5 POD modes. Larger mode counts or datasets may require `hyperparam_search_space="large"` and more Optuna trials.
|
|
228
|
+
- Current models use scikit-learn MLPs. Future versions may include PyTorch models for larger-scale training and GPU acceleration.
|
|
229
|
+
- DMD forecasting accuracy degrades over longer horizons — it is suited to short-horizon prediction only.
|
|
230
|
+
|
|
231
|
+
## Contributing
|
|
232
|
+
|
|
233
|
+
Contributions welcome — particularly additional datasets, fluid-specific
|
|
234
|
+
pre-trained models, and improved DMD variants. See `CONTRIBUTING.md`.
|
|
235
|
+
|
|
236
|
+
## Licence
|
|
237
|
+
|
|
238
|
+
MIT
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# icarus
|
|
2
|
+
|
|
3
|
+
**Data-driven heat flux prediction from infrared thermography.**
|
|
4
|
+
|
|
5
|
+
`icarus` provides a full pipeline from raw IR camera data to trained
|
|
6
|
+
heat flux prediction models using Proper Orthogonal Decomposition (POD),
|
|
7
|
+
Dynamic Mode Decomposition (DMD), and artificial neural networks.
|
|
8
|
+
|
|
9
|
+
It implements the methodology from:
|
|
10
|
+
|
|
11
|
+
> *Investigating the efficacy of data-driven techniques and machine learning
|
|
12
|
+
> algorithms to predict heat transfer characteristics* (Twum-Barima, 2025)
|
|
13
|
+
|
|
14
|
+
The best-performing approach (Model C: POD modal mapping) achieved **R² = 0.729**
|
|
15
|
+
on a 17M-sample flow boiling dataset — a 69 % improvement over the linear baseline.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install icarus
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or from source:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/yourusername/icarus
|
|
29
|
+
cd icarus
|
|
30
|
+
pip install -e ".[dev]"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Requirements:** Python ≥ 3.9, NumPy, SciPy, scikit-learn, Optuna, Matplotlib
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quickstart
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import icarus as tf
|
|
41
|
+
|
|
42
|
+
# Load your dataset (.mat, .h5, .npz supported)
|
|
43
|
+
data = tf.data.loader.load(
|
|
44
|
+
"experiment.mat",
|
|
45
|
+
temperature_key="T",
|
|
46
|
+
heatflux_key="qL2",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Or load from numpy arrays directly
|
|
50
|
+
import numpy as np
|
|
51
|
+
data = tf.data.loader.from_arrays(T, q, dt=2.5e-4)
|
|
52
|
+
|
|
53
|
+
# Run the full pipeline (POD modal strategy, best performance)
|
|
54
|
+
pipeline = tf.Pipeline(
|
|
55
|
+
strategy="modal", # "raw" | "gradient" | "modal"
|
|
56
|
+
n_pod_modes=5,
|
|
57
|
+
spatial_crop=5,
|
|
58
|
+
trim_frames=43,
|
|
59
|
+
optimise_hyperparams=True,
|
|
60
|
+
n_trials=30,
|
|
61
|
+
)
|
|
62
|
+
pipeline.fit(data)
|
|
63
|
+
|
|
64
|
+
# Evaluate
|
|
65
|
+
metrics = pipeline.evaluate()
|
|
66
|
+
# [test] R² = 0.7293 RMSE = 25,959 W/m² MAE = 20,656 W/m²
|
|
67
|
+
|
|
68
|
+
# Predict on new data
|
|
69
|
+
q_predicted = pipeline.predict(T_new) # shape [ny, nx, nt]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Three model strategies
|
|
75
|
+
|
|
76
|
+
| Strategy | Features | Notes |
|
|
77
|
+
|----------|----------|-------|
|
|
78
|
+
| `"raw"` (Model A) | Temperature only | Baseline |
|
|
79
|
+
| `"gradient"` (Model B) | T + dT/dt + dT/dx + dT/dy | Modest improvement |
|
|
80
|
+
| `"modal"` (Model C) | POD modal contributions | **Best: R² = 0.729** |
|
|
81
|
+
|
|
82
|
+
The modal strategy works by:
|
|
83
|
+
1. Decomposing the temperature field into dominant POD modes
|
|
84
|
+
2. Learning a mapping from temperature modal coefficients → heat flux modal coefficients
|
|
85
|
+
3. Reconstructing the full heat flux field from the predicted coefficients
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Individual components
|
|
90
|
+
|
|
91
|
+
You can also use the modules independently:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from icarus.decomposition.pod import POD
|
|
95
|
+
from icarus.data.preprocessor import Preprocessor
|
|
96
|
+
|
|
97
|
+
# Preprocessing
|
|
98
|
+
pre = Preprocessor()
|
|
99
|
+
out = pre.fit_transform(data)
|
|
100
|
+
X_c = Preprocessor.to_matrix(out["T_c"]) # [n_pix, nt]
|
|
101
|
+
|
|
102
|
+
# POD
|
|
103
|
+
pod = POD(n_modes=10)
|
|
104
|
+
pod.fit(X_c)
|
|
105
|
+
print(f"First 5 modes capture {pod.cumulative_energy_[4]:.1%} of variance")
|
|
106
|
+
|
|
107
|
+
# Modal contributions
|
|
108
|
+
contribs = pod.modal_contributions(X_c) # [n_pix, nt, n_modes]
|
|
109
|
+
|
|
110
|
+
# Visualisation
|
|
111
|
+
from icarus.visualisation.plots import plot_pod_modes, plot_cumulative_energy
|
|
112
|
+
ny, nx = out["T"].shape[:2]
|
|
113
|
+
plot_cumulative_energy(pod)
|
|
114
|
+
plot_pod_modes(pod, ny=ny, nx=nx, n_modes=5)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from icarus.decomposition.dmd import DMD
|
|
119
|
+
|
|
120
|
+
# DMD forecasting
|
|
121
|
+
dmd = DMD(energy_threshold=0.99, dt=2.5e-4)
|
|
122
|
+
dmd.fit(X_c_train)
|
|
123
|
+
X_forecast = dmd.forecast_from(X_c_train[:, -1], n_steps=1200)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Visualisation
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from icarus.visualisation.plots import (
|
|
132
|
+
plot_field,
|
|
133
|
+
plot_pod_modes,
|
|
134
|
+
plot_cumulative_energy,
|
|
135
|
+
plot_scatter,
|
|
136
|
+
plot_model_summary,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# Single field
|
|
140
|
+
plot_field(q[:, :, 100], title="Heat flux at t=100")
|
|
141
|
+
|
|
142
|
+
# Full model evaluation summary (6-panel figure)
|
|
143
|
+
plot_model_summary(
|
|
144
|
+
q_true_field, q_pred_field,
|
|
145
|
+
y_true_flat, y_pred_flat,
|
|
146
|
+
metrics_train, metrics_test,
|
|
147
|
+
r2_t=r2_t, rmse_t=rmse_t,
|
|
148
|
+
model_name="Model C — POD Modal",
|
|
149
|
+
)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Running tests
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
pytest tests/ -v
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Project structure
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
icarus/
|
|
166
|
+
├── data/
|
|
167
|
+
│ ├── loader.py # .mat, .h5, .npz, numpy array loading
|
|
168
|
+
│ └── preprocessor.py # cropping, mean-centering, reshaping
|
|
169
|
+
├── decomposition/
|
|
170
|
+
│ ├── pod.py # POD via SVD
|
|
171
|
+
│ └── dmd.py # DMD forecasting
|
|
172
|
+
├── features/
|
|
173
|
+
│ └── engineer.py # gradient and modal feature construction
|
|
174
|
+
├── models/
|
|
175
|
+
│ └── neural.py # MLP with Bayesian optimisation
|
|
176
|
+
├── metrics/
|
|
177
|
+
│ └── evaluation.py # R², RMSE, MAE
|
|
178
|
+
├── visualisation/
|
|
179
|
+
│ └── plots.py # spatial fields, modes, diagnostics
|
|
180
|
+
└── pipeline/
|
|
181
|
+
└── runner.py # end-to-end Pipeline
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Known limitations
|
|
187
|
+
|
|
188
|
+
- Experimental datasets are not included in this repository.
|
|
189
|
+
- The reported Model C R² = 0.729 is dataset-specific and should be revalidated on independent datasets before being cited as a general result.
|
|
190
|
+
- The default ANN search space (`"medium"`) is designed for moderate-sized datasets with 5 POD modes. Larger mode counts or datasets may require `hyperparam_search_space="large"` and more Optuna trials.
|
|
191
|
+
- Current models use scikit-learn MLPs. Future versions may include PyTorch models for larger-scale training and GPU acceleration.
|
|
192
|
+
- DMD forecasting accuracy degrades over longer horizons — it is suited to short-horizon prediction only.
|
|
193
|
+
|
|
194
|
+
## Contributing
|
|
195
|
+
|
|
196
|
+
Contributions welcome — particularly additional datasets, fluid-specific
|
|
197
|
+
pre-trained models, and improved DMD variants. See `CONTRIBUTING.md`.
|
|
198
|
+
|
|
199
|
+
## Licence
|
|
200
|
+
|
|
201
|
+
MIT
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
icarus
|
|
3
|
+
=========
|
|
4
|
+
Data-driven heat flux prediction from infrared thermography.
|
|
5
|
+
|
|
6
|
+
Provides a full pipeline from raw IR data to trained heat flux prediction
|
|
7
|
+
models using Proper Orthogonal Decomposition (POD), Dynamic Mode
|
|
8
|
+
Decomposition (DMD), and artificial neural networks.
|
|
9
|
+
|
|
10
|
+
Quickstart
|
|
11
|
+
----------
|
|
12
|
+
>>> import icarus as tf
|
|
13
|
+
>>> import numpy as np
|
|
14
|
+
>>>
|
|
15
|
+
>>> # Load your IR temperature and heat flux arrays [ny, nx, nt]
|
|
16
|
+
>>> T = np.load("temperature.npy")
|
|
17
|
+
>>> q = np.load("heatflux.npy")
|
|
18
|
+
>>>
|
|
19
|
+
>>> # Run the full pipeline
|
|
20
|
+
>>> pipeline = tf.Pipeline()
|
|
21
|
+
>>> pipeline.fit(T, q)
|
|
22
|
+
>>> q_pred = pipeline.predict(T_new)
|
|
23
|
+
|
|
24
|
+
Modules
|
|
25
|
+
-------
|
|
26
|
+
data : Loading and preprocessing of IR thermography datasets
|
|
27
|
+
decomposition : POD and DMD reduced-order analysis
|
|
28
|
+
features : Feature construction (gradients, modal contributions)
|
|
29
|
+
models : ANN training with Bayesian hyperparameter optimisation
|
|
30
|
+
metrics : R², RMSE, MAE evaluation utilities
|
|
31
|
+
visualisation : Spatial field, mode, and diagnostic plots
|
|
32
|
+
pipeline : End-to-end Pipeline orchestrator
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from icarus.pipeline.runner import Pipeline
|
|
36
|
+
from icarus.decomposition.pod import POD
|
|
37
|
+
from icarus.decomposition.dmd import DMD
|
|
38
|
+
from icarus.data.preprocessor import Preprocessor
|
|
39
|
+
from icarus.models.neural import HeatFluxNet, SEARCH_SPACES
|
|
40
|
+
from icarus.metrics.evaluation import evaluate
|
|
41
|
+
|
|
42
|
+
__version__ = "0.1.0"
|
|
43
|
+
__author__ = "Raymond Twum-Barima"
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
"Pipeline",
|
|
47
|
+
"POD",
|
|
48
|
+
"DMD",
|
|
49
|
+
"Preprocessor",
|
|
50
|
+
"HeatFluxNet",
|
|
51
|
+
"SEARCH_SPACES",
|
|
52
|
+
"evaluate",
|
|
53
|
+
"__version__",
|
|
54
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import *
|