Commit ·
599606f
1
Parent(s): ec2b4e7
Add evaluation configuration and update inference pipeline
Browse files- forecasting/inference/auto_evaluate.py +0 -451
- forecasting/inference/evaluation.py +1 -1
- forecasting/inference/evaluation_config.yaml +27 -0
- forecasting/inference/inference.py +6 -7
- forecasting/inference/local_config.yaml +38 -10
- forecasting/models/vit_patch_model_local.py +2 -1
- pipeline_config.yaml +27 -2
- run_pipeline.py +14 -0
forecasting/inference/auto_evaluate.py
DELETED
|
@@ -1,451 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Automated Evaluation Script for Solar Flare Models
|
| 4 |
-
|
| 5 |
-
This script automates the generation of inference and evaluation configurations,
|
| 6 |
-
and runs the complete end-to-end evaluation pipeline for trained solar flare models.
|
| 7 |
-
|
| 8 |
-
It supports both directory-based checkpoint discovery and direct checkpoint paths,
|
| 9 |
-
automatically detecting the model type and setting up inference/evaluation YAMLs.
|
| 10 |
-
|
| 11 |
-
Usage
|
| 12 |
-
-----
|
| 13 |
-
Example commands:
|
| 14 |
-
python auto_evaluate.py -checkpoint_dir /path/to/checkpoint/dir -model_name my_model
|
| 15 |
-
python auto_evaluate.py -checkpoint_path /path/to/checkpoint.pth -model_name my_model
|
| 16 |
-
"""
|
| 17 |
-
|
| 18 |
-
import argparse
|
| 19 |
-
from operator import truediv
|
| 20 |
-
import os
|
| 21 |
-
import subprocess
|
| 22 |
-
import sys
|
| 23 |
-
import yaml
|
| 24 |
-
from pathlib import Path
|
| 25 |
-
from datetime import datetime
|
| 26 |
-
import glob
|
| 27 |
-
|
| 28 |
-
# Add project root to Python path
|
| 29 |
-
PROJECT_ROOT = Path(__file__).parent.parent.parent.absolute()
|
| 30 |
-
sys.path.insert(0, str(PROJECT_ROOT))
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
def find_checkpoint_files(checkpoint_dir):
|
| 34 |
-
"""
|
| 35 |
-
Find all checkpoint files (.pth, .ckpt, .pt) within a directory.
|
| 36 |
-
|
| 37 |
-
Parameters
|
| 38 |
-
----------
|
| 39 |
-
checkpoint_dir : str or Path
|
| 40 |
-
Path to the directory containing model checkpoint files.
|
| 41 |
-
|
| 42 |
-
Returns
|
| 43 |
-
-------
|
| 44 |
-
list of str
|
| 45 |
-
Sorted list of checkpoint file paths discovered within the directory.
|
| 46 |
-
"""
|
| 47 |
-
patterns = ['*.pth', '*.ckpt', '*.pt']
|
| 48 |
-
checkpoints = []
|
| 49 |
-
|
| 50 |
-
for pattern in patterns:
|
| 51 |
-
checkpoints.extend(glob.glob(str(Path(checkpoint_dir) / pattern)))
|
| 52 |
-
checkpoints.extend(glob.glob(str(Path(checkpoint_dir) / '**' / pattern), recursive=True))
|
| 53 |
-
|
| 54 |
-
return sorted(checkpoints)
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
def detect_model_type(checkpoint_path):
|
| 58 |
-
"""
|
| 59 |
-
Infer the model type from a checkpoint filename.
|
| 60 |
-
|
| 61 |
-
Parameters
|
| 62 |
-
----------
|
| 63 |
-
checkpoint_path : str
|
| 64 |
-
Path to the checkpoint file.
|
| 65 |
-
|
| 66 |
-
Returns
|
| 67 |
-
-------
|
| 68 |
-
str
|
| 69 |
-
Model type inferred from filename (e.g., 'vitlocal', 'vitpatch', 'fusion', etc.).
|
| 70 |
-
"""
|
| 71 |
-
filename = Path(checkpoint_path).name.lower()
|
| 72 |
-
|
| 73 |
-
return 'vitlocal'
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
def check_sxr_data_availability(base_data_dir):
|
| 77 |
-
"""
|
| 78 |
-
Check if SXR data is available in the specified directory.
|
| 79 |
-
|
| 80 |
-
Parameters
|
| 81 |
-
----------
|
| 82 |
-
base_data_dir : str
|
| 83 |
-
Base directory containing the SXR data.
|
| 84 |
-
|
| 85 |
-
Returns
|
| 86 |
-
-------
|
| 87 |
-
bool
|
| 88 |
-
True if SXR data is available, False otherwise.
|
| 89 |
-
"""
|
| 90 |
-
sxr_dir = Path(base_data_dir) / "SXR"
|
| 91 |
-
sxr_norm_path = Path(base_data_dir) / "SXR" / "normalized_sxr.npy"
|
| 92 |
-
|
| 93 |
-
# Check if SXR directory exists and has files
|
| 94 |
-
if not sxr_dir.exists():
|
| 95 |
-
print(f"SXR directory not found: {sxr_dir}")
|
| 96 |
-
return False
|
| 97 |
-
|
| 98 |
-
# Check if normalized SXR file exists
|
| 99 |
-
if not sxr_norm_path.exists():
|
| 100 |
-
print(f"Normalized SXR file not found: {sxr_norm_path}")
|
| 101 |
-
return False
|
| 102 |
-
|
| 103 |
-
# Check if there are any .npy files in the SXR directory
|
| 104 |
-
sxr_files = list(sxr_dir.glob("*.npy"))
|
| 105 |
-
if not sxr_files:
|
| 106 |
-
print(f"No SXR data files found in: {sxr_dir}")
|
| 107 |
-
return False
|
| 108 |
-
|
| 109 |
-
print(f"Found {len(sxr_files)} SXR data files in {sxr_dir}")
|
| 110 |
-
return True
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
def create_inference_config(checkpoint_path, model_name, base_data_dir="/mnt/data/NO-OVERLAP", prediction_only=False):
|
| 114 |
-
"""
|
| 115 |
-
Dynamically create an inference configuration dictionary for a given checkpoint.
|
| 116 |
-
|
| 117 |
-
Parameters
|
| 118 |
-
----------
|
| 119 |
-
checkpoint_path : str
|
| 120 |
-
Path to the checkpoint file.
|
| 121 |
-
model_name : str
|
| 122 |
-
Name for the model (used for output folder and file naming).
|
| 123 |
-
base_data_dir : str, optional
|
| 124 |
-
Root directory of dataset and normalization files.
|
| 125 |
-
prediction_only : bool, optional
|
| 126 |
-
If True, run in prediction-only mode (no SXR ground truth required).
|
| 127 |
-
Returns
|
| 128 |
-
-------
|
| 129 |
-
tuple(dict, str)
|
| 130 |
-
- Inference configuration dictionary.
|
| 131 |
-
- Path to the output directory where results will be saved.
|
| 132 |
-
"""
|
| 133 |
-
# Detect model type
|
| 134 |
-
model_type = detect_model_type(checkpoint_path)
|
| 135 |
-
|
| 136 |
-
# Create output directory
|
| 137 |
-
output_dir = f"/Volumes/T9/FOXES_Data/paper_res/{model_name}"
|
| 138 |
-
os.makedirs(output_dir, exist_ok=True)
|
| 139 |
-
os.makedirs(f"{output_dir}/weights", exist_ok=True)
|
| 140 |
-
|
| 141 |
-
# Create flux directory for patch-based models
|
| 142 |
-
if model_type == 'vitlocal':
|
| 143 |
-
os.makedirs(f"{output_dir}/flux", exist_ok=True)
|
| 144 |
-
|
| 145 |
-
# Generate config
|
| 146 |
-
config = {
|
| 147 |
-
'SolO': 'false',
|
| 148 |
-
'Stereo': 'false',
|
| 149 |
-
'prediction_only': 'true' if prediction_only else 'false',
|
| 150 |
-
'base_data_dir': base_data_dir,
|
| 151 |
-
'data': {
|
| 152 |
-
'aia_dir': f"{base_data_dir}/AIA/",
|
| 153 |
-
'checkpoint_path': checkpoint_path,
|
| 154 |
-
'sxr_dir': f"{base_data_dir}/SXR/" if not prediction_only else "",
|
| 155 |
-
'sxr_norm_path': f"{base_data_dir}/SXR/normalized_sxr.npy" if not prediction_only else ""
|
| 156 |
-
},
|
| 157 |
-
'model': model_type,
|
| 158 |
-
'wavelengths': [94, 131, 171, 193, 211, 304, 335],
|
| 159 |
-
'mc': {
|
| 160 |
-
'active': 'false',
|
| 161 |
-
'runs': 5
|
| 162 |
-
},
|
| 163 |
-
'model_params': {
|
| 164 |
-
'batch_size': 8, # Match training batch size. If you get OOM errors, reduce this.
|
| 165 |
-
# Note: Inference with attention weights uses more memory than training
|
| 166 |
-
'input_size': 512,
|
| 167 |
-
'no_weights': True, # Set to False to save attention weights (uses more memory)
|
| 168 |
-
'no_flux': False, # Set to False to save flux contributions (uses more memory)
|
| 169 |
-
'patch_size': 8
|
| 170 |
-
},
|
| 171 |
-
'vit_architecture': {
|
| 172 |
-
'embed_dim': 256,
|
| 173 |
-
'hidden_dim': 1024,
|
| 174 |
-
'num_channels': 7,
|
| 175 |
-
'num_classes': 1,
|
| 176 |
-
'patch_size': 16,
|
| 177 |
-
'num_patches': 1024,
|
| 178 |
-
'num_heads': 8,
|
| 179 |
-
'num_layers': 8,
|
| 180 |
-
'dropout': 0.1
|
| 181 |
-
},
|
| 182 |
-
'output_path': f"{output_dir}/{model_name}_predictions.csv",
|
| 183 |
-
'weight_path': f"{output_dir}/weights"
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
# Add flux_path for patch-based models
|
| 187 |
-
if model_type in ['vitpatch', 'vitlocal']:
|
| 188 |
-
config['flux_path'] = f"{output_dir}/flux/"
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
return config, output_dir
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
def create_evaluation_config(model_name, output_dir, base_data_dir="/mnt/data/NO-OVERLAP",
|
| 195 |
-
prediction_only=False, regression_background='black'):
|
| 196 |
-
"""
|
| 197 |
-
Create evaluation configuration for computing metrics and visualizations.
|
| 198 |
-
|
| 199 |
-
Parameters
|
| 200 |
-
----------
|
| 201 |
-
model_name : str
|
| 202 |
-
Name of the model under evaluation.
|
| 203 |
-
output_dir : str
|
| 204 |
-
Path to output directory containing prediction results.
|
| 205 |
-
base_data_dir : str, optional
|
| 206 |
-
Base dataset directory containing AIA and SXR test data.
|
| 207 |
-
prediction_only : bool, optional
|
| 208 |
-
If True, create config for prediction-only mode (no ground truth evaluation).
|
| 209 |
-
|
| 210 |
-
Returns
|
| 211 |
-
-------
|
| 212 |
-
dict
|
| 213 |
-
Evaluation configuration dictionary with metrics, time range, and plotting settings.
|
| 214 |
-
"""
|
| 215 |
-
config = {
|
| 216 |
-
'base_data_dir': base_data_dir,
|
| 217 |
-
'output_base_dir': f"{base_data_dir}/solar_flare_comparison_results",
|
| 218 |
-
'prediction_only': prediction_only,
|
| 219 |
-
'data': {
|
| 220 |
-
'aia_dir': f"{base_data_dir}/AIA/test/",
|
| 221 |
-
'weight_path': f"{output_dir}/weights"
|
| 222 |
-
},
|
| 223 |
-
'model_predictions': {
|
| 224 |
-
'main_model_csv': f"{output_dir}/{model_name}_predictions.csv",
|
| 225 |
-
'baseline_csv': ''
|
| 226 |
-
},
|
| 227 |
-
'evaluation': {
|
| 228 |
-
'output_dir': output_dir,
|
| 229 |
-
'sxr_cutoff': 1e-10 if not prediction_only else None
|
| 230 |
-
},
|
| 231 |
-
'time_range': {
|
| 232 |
-
'start_time': '2023-08-05T21:00:00',
|
| 233 |
-
'end_time': '2023-08-05T23:59:00',
|
| 234 |
-
'interval_minutes': 5
|
| 235 |
-
},
|
| 236 |
-
'plotting': {
|
| 237 |
-
'figure_size': [12, 8],
|
| 238 |
-
'dpi': 300,
|
| 239 |
-
'colormap': 'sdoaia171',
|
| 240 |
-
'regression_background': regression_background
|
| 241 |
-
},
|
| 242 |
-
'metrics': {
|
| 243 |
-
'include_rmse': True,
|
| 244 |
-
'include_mae': True,
|
| 245 |
-
'include_r2': True,
|
| 246 |
-
'include_correlation': True
|
| 247 |
-
}
|
| 248 |
-
}
|
| 249 |
-
return config
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
def run_inference(inference_config_path):
|
| 253 |
-
"""
|
| 254 |
-
Execute model inference using the generated YAML configuration.
|
| 255 |
-
|
| 256 |
-
Parameters
|
| 257 |
-
----------
|
| 258 |
-
inference_config_path : str
|
| 259 |
-
Path to the inference configuration YAML file.
|
| 260 |
-
|
| 261 |
-
Returns
|
| 262 |
-
-------
|
| 263 |
-
bool
|
| 264 |
-
True if inference completes successfully, False if an error occurs.
|
| 265 |
-
"""
|
| 266 |
-
print(f"Running inference with config: {inference_config_path}")
|
| 267 |
-
|
| 268 |
-
cmd = [
|
| 269 |
-
sys.executable,
|
| 270 |
-
str(PROJECT_ROOT / "forecasting/inference/inference.py"),
|
| 271 |
-
"-config", inference_config_path
|
| 272 |
-
]
|
| 273 |
-
|
| 274 |
-
# Use Popen with real-time output streaming to show progress bar
|
| 275 |
-
# Both stdout and stderr go to terminal so tqdm progress bar (which writes to stderr) is visible
|
| 276 |
-
process = subprocess.Popen(
|
| 277 |
-
cmd,
|
| 278 |
-
stdout=None, # Let stdout go directly to terminal
|
| 279 |
-
stderr=subprocess.STDOUT, # Merge stderr into stdout so progress bar is visible
|
| 280 |
-
text=True,
|
| 281 |
-
bufsize=1 # Line buffered for real-time output
|
| 282 |
-
)
|
| 283 |
-
|
| 284 |
-
# Wait for process to complete
|
| 285 |
-
process.wait()
|
| 286 |
-
|
| 287 |
-
if process.returncode != 0:
|
| 288 |
-
print(f"Error: Inference process exited with code {process.returncode}")
|
| 289 |
-
return False
|
| 290 |
-
|
| 291 |
-
print("Inference completed successfully!")
|
| 292 |
-
return True
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
def run_evaluation(evaluation_config_path):
|
| 296 |
-
"""
|
| 297 |
-
Execute evaluation of inference outputs using the generated YAML configuration.
|
| 298 |
-
|
| 299 |
-
Parameters
|
| 300 |
-
----------
|
| 301 |
-
evaluation_config_path : str
|
| 302 |
-
Path to the evaluation configuration YAML file.
|
| 303 |
-
|
| 304 |
-
Returns
|
| 305 |
-
-------
|
| 306 |
-
bool
|
| 307 |
-
True if evaluation completes successfully, False otherwise.
|
| 308 |
-
"""
|
| 309 |
-
print(f"Running evaluation with config: {evaluation_config_path}")
|
| 310 |
-
|
| 311 |
-
cmd = [
|
| 312 |
-
sys.executable,
|
| 313 |
-
str(PROJECT_ROOT / "forecasting/inference/evaluation.py"),
|
| 314 |
-
"-config", evaluation_config_path
|
| 315 |
-
]
|
| 316 |
-
|
| 317 |
-
# Use Popen with real-time output streaming
|
| 318 |
-
# Both stdout and stderr go to terminal for real-time output
|
| 319 |
-
process = subprocess.Popen(
|
| 320 |
-
cmd,
|
| 321 |
-
stdout=None, # Let stdout go directly to terminal
|
| 322 |
-
stderr=subprocess.STDOUT, # Merge stderr into stdout
|
| 323 |
-
text=True,
|
| 324 |
-
bufsize=1 # Line buffered for real-time output
|
| 325 |
-
)
|
| 326 |
-
|
| 327 |
-
# Wait for process to complete
|
| 328 |
-
process.wait()
|
| 329 |
-
|
| 330 |
-
if process.returncode != 0:
|
| 331 |
-
print(f"Error: Evaluation process exited with code {process.returncode}")
|
| 332 |
-
return False
|
| 333 |
-
|
| 334 |
-
print("Evaluation completed successfully!")
|
| 335 |
-
return True
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
def main():
|
| 339 |
-
"""
|
| 340 |
-
Main function for automating inference and evaluation.
|
| 341 |
-
|
| 342 |
-
Steps:
|
| 343 |
-
1. Parse command-line arguments.
|
| 344 |
-
2. Locate checkpoint file or directory.
|
| 345 |
-
3. Generate inference and evaluation YAML configs.
|
| 346 |
-
4. Optionally run inference and/or evaluation scripts.
|
| 347 |
-
5. Output results and metrics to specified directory.
|
| 348 |
-
"""
|
| 349 |
-
parser = argparse.ArgumentParser(description='Automated evaluation for solar flare models')
|
| 350 |
-
parser.add_argument('-checkpoint_dir', type=str, help='Directory containing checkpoint files')
|
| 351 |
-
parser.add_argument('-checkpoint_path', type=str, help='Specific checkpoint file path')
|
| 352 |
-
parser.add_argument('-model_name', type=str, required=True, help='Name for the model (used for output naming)')
|
| 353 |
-
parser.add_argument('-base_data_dir', type=str, default='/data/FOXES_Data/', help='Base data directory')
|
| 354 |
-
parser.add_argument('-skip_inference', action='store_true', help='Skip inference and only run evaluation')
|
| 355 |
-
parser.add_argument('-skip_evaluation', action='store_true', help='Skip evaluation and only run inference')
|
| 356 |
-
parser.add_argument('-prediction_only', action='store_true', help='Force prediction-only mode (no SXR ground truth)')
|
| 357 |
-
parser.add_argument('-regression_background', type=str, choices=['black', 'white'], default='black',
|
| 358 |
-
help='Background color for regression plots (default: black)')
|
| 359 |
-
|
| 360 |
-
args = parser.parse_args()
|
| 361 |
-
|
| 362 |
-
# Determine checkpoint path
|
| 363 |
-
if args.checkpoint_path:
|
| 364 |
-
checkpoint_path = args.checkpoint_path
|
| 365 |
-
if not os.path.exists(checkpoint_path):
|
| 366 |
-
print(f"Error: Checkpoint file not found: {checkpoint_path}")
|
| 367 |
-
sys.exit(1)
|
| 368 |
-
elif args.checkpoint_dir:
|
| 369 |
-
checkpoints = find_checkpoint_files(args.checkpoint_dir)
|
| 370 |
-
if not checkpoints:
|
| 371 |
-
print(f"Error: No checkpoint files found in {args.checkpoint_dir}")
|
| 372 |
-
sys.exit(1)
|
| 373 |
-
elif len(checkpoints) > 1:
|
| 374 |
-
print(f"Found multiple checkpoints: {checkpoints}")
|
| 375 |
-
print("Using the first one. Use -checkpoint_path to specify a specific file.")
|
| 376 |
-
checkpoint_path = checkpoints[0]
|
| 377 |
-
else:
|
| 378 |
-
print("Error: Must specify either -checkpoint_dir or -checkpoint_path")
|
| 379 |
-
sys.exit(1)
|
| 380 |
-
|
| 381 |
-
print(f"Using checkpoint: {checkpoint_path}")
|
| 382 |
-
print(f"Model name: {args.model_name}")
|
| 383 |
-
|
| 384 |
-
# Check SXR data availability and determine if we should use prediction-only mode
|
| 385 |
-
prediction_only_mode = args.prediction_only
|
| 386 |
-
|
| 387 |
-
if not prediction_only_mode:
|
| 388 |
-
print("Checking SXR data availability...")
|
| 389 |
-
sxr_available = check_sxr_data_availability(args.base_data_dir)
|
| 390 |
-
if not sxr_available:
|
| 391 |
-
print("⚠️ SXR data not available. Switching to prediction-only mode.")
|
| 392 |
-
prediction_only_mode = True
|
| 393 |
-
else:
|
| 394 |
-
print("✅ SXR data found. Running with ground truth evaluation.")
|
| 395 |
-
else:
|
| 396 |
-
print("🔮 Running in prediction-only mode (as requested).")
|
| 397 |
-
|
| 398 |
-
# Create configs
|
| 399 |
-
inference_config, output_dir = create_inference_config(checkpoint_path, args.model_name, args.base_data_dir, prediction_only_mode)
|
| 400 |
-
evaluation_config = create_evaluation_config(
|
| 401 |
-
args.model_name,
|
| 402 |
-
output_dir,
|
| 403 |
-
args.base_data_dir,
|
| 404 |
-
prediction_only_mode,
|
| 405 |
-
regression_background=args.regression_background
|
| 406 |
-
)
|
| 407 |
-
|
| 408 |
-
# Save configs
|
| 409 |
-
inference_config_path = f"/tmp/inference_config_{args.model_name}.yaml"
|
| 410 |
-
evaluation_config_path = f"/tmp/evaluation_config_{args.model_name}.yaml"
|
| 411 |
-
|
| 412 |
-
with open(inference_config_path, 'w') as f:
|
| 413 |
-
yaml.dump(inference_config, f, default_flow_style=False)
|
| 414 |
-
|
| 415 |
-
with open(evaluation_config_path, 'w') as f:
|
| 416 |
-
yaml.dump(evaluation_config, f, default_flow_style=False)
|
| 417 |
-
|
| 418 |
-
print(f"Configs saved to:")
|
| 419 |
-
print(f" Inference: {inference_config_path}")
|
| 420 |
-
print(f" Evaluation: {evaluation_config_path}")
|
| 421 |
-
print(f" Output directory: {output_dir}")
|
| 422 |
-
|
| 423 |
-
# Run inference
|
| 424 |
-
if not args.skip_inference:
|
| 425 |
-
if not run_inference(inference_config_path):
|
| 426 |
-
print("Inference failed. Stopping.")
|
| 427 |
-
sys.exit(1)
|
| 428 |
-
else:
|
| 429 |
-
print("Skipping inference...")
|
| 430 |
-
|
| 431 |
-
# Run evaluation
|
| 432 |
-
if not args.skip_evaluation:
|
| 433 |
-
if prediction_only_mode:
|
| 434 |
-
print("Skipping evaluation (prediction-only mode - no ground truth available)")
|
| 435 |
-
else:
|
| 436 |
-
if not run_evaluation(evaluation_config_path):
|
| 437 |
-
print("Evaluation failed. Stopping.")
|
| 438 |
-
sys.exit(1)
|
| 439 |
-
else:
|
| 440 |
-
print("Skipping evaluation...")
|
| 441 |
-
|
| 442 |
-
print(f"\n✅ Complete! Results saved to: {output_dir}")
|
| 443 |
-
if prediction_only_mode:
|
| 444 |
-
print(f"🔮 Prediction-only mode: No ground truth evaluation performed")
|
| 445 |
-
print(f"📊 Check the prediction results in: {output_dir}")
|
| 446 |
-
else:
|
| 447 |
-
print(f"📊 Check the plots and metrics in: {output_dir}")
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
if __name__ == '__main__':
|
| 451 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forecasting/inference/evaluation.py
CHANGED
|
@@ -900,7 +900,7 @@ class SolarFlareEvaluator:
|
|
| 900 |
|
| 901 |
sxr_ax.set_xlim([pd.to_datetime(timestamp) - pd.Timedelta(hours=4),
|
| 902 |
pd.to_datetime(timestamp) + pd.Timedelta(hours=4)])
|
| 903 |
-
sxr_ax.set_ylim([5e-7, 5e-4]) # Set y-limits for SXR data
|
| 904 |
sxr_ax.set_ylabel(r'SXR Flux (W/m$^2$)', fontsize=12, fontfamily='Barlow',
|
| 905 |
color=('white' if is_dark else 'black'))
|
| 906 |
sxr_ax.set_xlabel('Time', fontsize=12, fontfamily='Barlow', color=('white' if is_dark else 'black'))
|
|
|
|
| 900 |
|
| 901 |
sxr_ax.set_xlim([pd.to_datetime(timestamp) - pd.Timedelta(hours=4),
|
| 902 |
pd.to_datetime(timestamp) + pd.Timedelta(hours=4)])
|
| 903 |
+
#sxr_ax.set_ylim([5e-7, 5e-4]) # Set y-limits for SXR data
|
| 904 |
sxr_ax.set_ylabel(r'SXR Flux (W/m$^2$)', fontsize=12, fontfamily='Barlow',
|
| 905 |
color=('white' if is_dark else 'black'))
|
| 906 |
sxr_ax.set_xlabel('Time', fontsize=12, fontfamily='Barlow', color=('white' if is_dark else 'black'))
|
forecasting/inference/evaluation_config.yaml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# =============================================================================
|
| 2 |
+
# FOXES Evaluation Configuration
|
| 3 |
+
# =============================================================================
|
| 4 |
+
# Used by evaluation.py to compute metrics and generate plots.
|
| 5 |
+
#
|
| 6 |
+
# Usage: python evaluation.py -config evaluation_config.yaml
|
| 7 |
+
# =============================================================================
|
| 8 |
+
|
| 9 |
+
model_predictions:
|
| 10 |
+
main_model_csv: "/Volumes/T9/Data_FOXES/inference/predictions.csv"
|
| 11 |
+
baseline_csv: null # path to baseline predictions CSV, or null to skip comparison
|
| 12 |
+
|
| 13 |
+
data:
|
| 14 |
+
aia_dir: "/Volumes/T9/Data_FOXES/AIA_processed/val"
|
| 15 |
+
weight_path: "/Volumes/T9/Data_FOXES/inference/weights"
|
| 16 |
+
|
| 17 |
+
evaluation:
|
| 18 |
+
output_dir: "/Volumes/T9/Data_FOXES/inference/evaluation"
|
| 19 |
+
sxr_cutoff: null # minimum ground-truth SXR value to include; null = no filter
|
| 20 |
+
|
| 21 |
+
time_range:
|
| 22 |
+
start_time: "2023-01-01T00:00:00"
|
| 23 |
+
end_time: "2023-12-31T23:59:59"
|
| 24 |
+
interval_minutes: 60
|
| 25 |
+
|
| 26 |
+
plotting:
|
| 27 |
+
regression_background: "black"
|
forecasting/inference/inference.py
CHANGED
|
@@ -209,11 +209,10 @@ def evaluate_model_on_dataset(model, dataset, batch_size=16, times=None, config_
|
|
| 209 |
del flux_contributions
|
| 210 |
flux_contributions = None
|
| 211 |
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
torch.cuda.synchronize() # Wait for all operations to complete before clearing
|
| 217 |
|
| 218 |
|
| 219 |
def save_batch_flux_contributions(batch_flux_contributions, batch_idx, batch_size, times, flux_path, sxr_norm=None):
|
|
@@ -335,7 +334,7 @@ def load_model_from_config(config_data):
|
|
| 335 |
if ".ckpt" in checkpoint_path:
|
| 336 |
# Lightning checkpoint format
|
| 337 |
if model_type.lower() == 'vitlocal':
|
| 338 |
-
model = ViTLocal.load_from_checkpoint(checkpoint_path, map_location=load_device)
|
| 339 |
else:
|
| 340 |
try:
|
| 341 |
model_class = getattr(models, model_type)
|
|
@@ -418,7 +417,7 @@ def main():
|
|
| 418 |
print(" Note: This saves ~3GB per batch by not computing attention weights.")
|
| 419 |
else:
|
| 420 |
print("Will save attention weights during inference.")
|
| 421 |
-
print("\n
|
| 422 |
print(" - Attention weights from all layers use significant GPU memory")
|
| 423 |
print(" - For ViT with 8 layers, 8 heads, 4096 patches: ~3GB+ per batch with attention!")
|
| 424 |
print(" - If you get OOM errors, set no_weights=true to skip attention saving\n")
|
|
|
|
| 209 |
del flux_contributions
|
| 210 |
flux_contributions = None
|
| 211 |
|
| 212 |
+
gc.collect()
|
| 213 |
+
if torch.cuda.is_available():
|
| 214 |
+
torch.cuda.empty_cache()
|
| 215 |
+
torch.cuda.synchronize()
|
|
|
|
| 216 |
|
| 217 |
|
| 218 |
def save_batch_flux_contributions(batch_flux_contributions, batch_idx, batch_size, times, flux_path, sxr_norm=None):
|
|
|
|
| 334 |
if ".ckpt" in checkpoint_path:
|
| 335 |
# Lightning checkpoint format
|
| 336 |
if model_type.lower() == 'vitlocal':
|
| 337 |
+
model = ViTLocal.load_from_checkpoint(checkpoint_path, map_location=load_device, weights_only=False)
|
| 338 |
else:
|
| 339 |
try:
|
| 340 |
model_class = getattr(models, model_type)
|
|
|
|
| 417 |
print(" Note: This saves ~3GB per batch by not computing attention weights.")
|
| 418 |
else:
|
| 419 |
print("Will save attention weights during inference.")
|
| 420 |
+
print("\n Memory note:")
|
| 421 |
print(" - Attention weights from all layers use significant GPU memory")
|
| 422 |
print(" - For ViT with 8 layers, 8 heads, 4096 patches: ~3GB+ per batch with attention!")
|
| 423 |
print(" - If you get OOM errors, set no_weights=true to skip attention saving\n")
|
forecasting/inference/local_config.yaml
CHANGED
|
@@ -1,21 +1,49 @@
|
|
| 1 |
# =============================================================================
|
| 2 |
-
# Flare Analysis Configuration
|
| 3 |
# =============================================================================
|
| 4 |
-
#
|
| 5 |
#
|
| 6 |
-
# Usage:
|
|
|
|
|
|
|
| 7 |
# =============================================================================
|
| 8 |
|
| 9 |
# -----------------------------------------------------------------------------
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# -----------------------------------------------------------------------------
|
| 12 |
paths:
|
| 13 |
-
data_dir:
|
| 14 |
-
flux_path:
|
| 15 |
-
aia_path:
|
| 16 |
-
predictions_csv: "/Volumes/T9/
|
| 17 |
-
hek_catalog: null
|
| 18 |
-
output_dir:
|
| 19 |
|
| 20 |
# -----------------------------------------------------------------------------
|
| 21 |
# Time Range
|
|
|
|
| 1 |
# =============================================================================
|
| 2 |
+
# FOXES Inference + Flare Analysis Configuration
|
| 3 |
# =============================================================================
|
| 4 |
+
# Shared config for inference.py and flare_analysis.py
|
| 5 |
#
|
| 6 |
+
# Usage:
|
| 7 |
+
# python inference.py -config local_config.yaml
|
| 8 |
+
# python flare_analysis.py --config local_config.yaml
|
| 9 |
# =============================================================================
|
| 10 |
|
| 11 |
# -----------------------------------------------------------------------------
|
| 12 |
+
# Inference (inference.py)
|
| 13 |
+
# -----------------------------------------------------------------------------
|
| 14 |
+
model: "ViTLocal"
|
| 15 |
+
wavelengths: [94, 131, 171, 193, 211, 304, 335]
|
| 16 |
+
SolO: "false"
|
| 17 |
+
Stereo: "false"
|
| 18 |
+
prediction_only: "false"
|
| 19 |
+
|
| 20 |
+
data:
|
| 21 |
+
aia_dir: "/Volumes/T9/Data_FOXES/AIA_processed"
|
| 22 |
+
sxr_dir: "/Volumes/T9/Data_FOXES/SXR_processed"
|
| 23 |
+
sxr_norm_path: "/Volumes/T9/Data_FOXES/SXR_processed/normalized_sxr.npy"
|
| 24 |
+
checkpoint_path: "/Volumes/T9/Data_FOXES/checkpoints/best.ckpt" # update to actual checkpoint
|
| 25 |
+
|
| 26 |
+
output_path: "/Volumes/T9/Data_FOXES/inference/predictions.csv"
|
| 27 |
+
weight_path: "/Volumes/T9/Data_FOXES/inference/weights/"
|
| 28 |
+
flux_path: "/Volumes/T9/Data_FOXES/inference/flux/"
|
| 29 |
+
|
| 30 |
+
model_params:
|
| 31 |
+
input_size: 512
|
| 32 |
+
patch_size: 8
|
| 33 |
+
batch_size: 10
|
| 34 |
+
no_weights: false
|
| 35 |
+
no_flux: false
|
| 36 |
+
|
| 37 |
+
# -----------------------------------------------------------------------------
|
| 38 |
+
# Flare Analysis (flare_analysis.py)
|
| 39 |
# -----------------------------------------------------------------------------
|
| 40 |
paths:
|
| 41 |
+
data_dir: "/Volumes/T9/Data_FOXES"
|
| 42 |
+
flux_path: "/Volumes/T9/Data_FOXES/inference/flux"
|
| 43 |
+
aia_path: "/Volumes/T9/Data_FOXES/AIA_processed/val"
|
| 44 |
+
predictions_csv: "/Volumes/T9/Data_FOXES/inference/predictions.csv"
|
| 45 |
+
hek_catalog: null
|
| 46 |
+
output_dir: "/Volumes/T9/Data_FOXES/inference/output"
|
| 47 |
|
| 48 |
# -----------------------------------------------------------------------------
|
| 49 |
# Time Range
|
forecasting/models/vit_patch_model_local.py
CHANGED
|
@@ -23,10 +23,11 @@ class ViTLocal(pl.LightningModule):
|
|
| 23 |
def __init__(self, model_kwargs, sxr_norm, base_weights=None):
|
| 24 |
super().__init__()
|
| 25 |
self.model_kwargs = model_kwargs
|
| 26 |
-
self.lr = model_kwargs
|
| 27 |
self.save_hyperparameters()
|
| 28 |
filtered_kwargs = dict(model_kwargs)
|
| 29 |
filtered_kwargs.pop('learning_rate', None)
|
|
|
|
| 30 |
filtered_kwargs.pop('num_classes', None)
|
| 31 |
self.model = VisionTransformerLocal(**filtered_kwargs)
|
| 32 |
self.base_weights = base_weights
|
|
|
|
| 23 |
def __init__(self, model_kwargs, sxr_norm, base_weights=None):
|
| 24 |
super().__init__()
|
| 25 |
self.model_kwargs = model_kwargs
|
| 26 |
+
self.lr = model_kwargs.get('learning_rate', model_kwargs.get('lr', 1e-4))
|
| 27 |
self.save_hyperparameters()
|
| 28 |
filtered_kwargs = dict(model_kwargs)
|
| 29 |
filtered_kwargs.pop('learning_rate', None)
|
| 30 |
+
filtered_kwargs.pop('lr', None)
|
| 31 |
filtered_kwargs.pop('num_classes', None)
|
| 32 |
self.model = VisionTransformerLocal(**filtered_kwargs)
|
| 33 |
self.base_weights = base_weights
|
pipeline_config.yaml
CHANGED
|
@@ -74,7 +74,6 @@ train:
|
|
| 74 |
- aia
|
| 75 |
- sxr
|
| 76 |
- regression
|
| 77 |
-
run_name: paper-8-patch-4ch
|
| 78 |
notes: Regression from AIA images to SXR images using ViTLocal model with 8x8 patches
|
| 79 |
|
| 80 |
# -----------------------------------------------------------------------------
|
|
@@ -83,5 +82,31 @@ train:
|
|
| 83 |
inference:
|
| 84 |
config: "forecasting/inference/local_config.yaml"
|
| 85 |
overrides: # Any key from local_config.yaml can go here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
paths:
|
| 87 |
-
data_dir:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
- aia
|
| 75 |
- sxr
|
| 76 |
- regression
|
|
|
|
| 77 |
notes: Regression from AIA images to SXR images using ViTLocal model with 8x8 patches
|
| 78 |
|
| 79 |
# -----------------------------------------------------------------------------
|
|
|
|
| 82 |
inference:
|
| 83 |
config: "forecasting/inference/local_config.yaml"
|
| 84 |
overrides: # Any key from local_config.yaml can go here
|
| 85 |
+
data:
|
| 86 |
+
aia_dir: "/Volumes/T9/Data_FOXES/AIA_processed"
|
| 87 |
+
sxr_dir: "/Volumes/T9/Data_FOXES/SXR_processed"
|
| 88 |
+
sxr_norm_path: "/Volumes/T9/Data_FOXES/SXR_processed/normalized_sxr.npy"
|
| 89 |
+
checkpoint_path: "/Volumes/T9/FOXES_Misc/final_checkpoint/paper-8-patch-weights-epoch=100-val_total_loss=0.0048.ckpt" # update to actual checkpoint
|
| 90 |
+
output_path: "/Volumes/T9/Data_FOXES/inference/predictions.csv"
|
| 91 |
paths:
|
| 92 |
+
data_dir: "/Volumes/T9/Data_FOXES"
|
| 93 |
+
predictions_csv: "/Volumes/T9/Data_FOXES/inference/predictions.csv"
|
| 94 |
+
aia_path: "/Volumes/T9/Data_FOXES/AIA_processed/val"
|
| 95 |
+
|
| 96 |
+
# -----------------------------------------------------------------------------
|
| 97 |
+
# Evaluation (step: evaluate)
|
| 98 |
+
# -----------------------------------------------------------------------------
|
| 99 |
+
evaluate:
|
| 100 |
+
config: "forecasting/inference/evaluation_config.yaml"
|
| 101 |
+
overrides: # Any key from evaluation_config.yaml can go here
|
| 102 |
+
model_predictions:
|
| 103 |
+
main_model_csv: "/Volumes/T9/Data_FOXES/inference/predictions.csv"
|
| 104 |
+
data:
|
| 105 |
+
aia_dir: "/Volumes/T9/Data_FOXES/AIA_processed/val"
|
| 106 |
+
weight_path: "/Volumes/T9/Data_FOXES/inference/weights"
|
| 107 |
+
evaluation:
|
| 108 |
+
output_dir: "/Volumes/T9/Data_FOXES/inference/evaluation"
|
| 109 |
+
time_range:
|
| 110 |
+
start_time: "2023-01-01T00:00:00"
|
| 111 |
+
end_time: "2023-12-31T23:59:59"
|
| 112 |
+
interval_minutes: 60
|
run_pipeline.py
CHANGED
|
@@ -84,6 +84,7 @@ STEP_ORDER = [
|
|
| 84 |
"normalize",
|
| 85 |
"train",
|
| 86 |
"inference",
|
|
|
|
| 87 |
"flare_analysis",
|
| 88 |
]
|
| 89 |
|
|
@@ -120,6 +121,10 @@ STEP_INFO = {
|
|
| 120 |
"description": "Run batch inference and save predictions CSV",
|
| 121 |
"script": ROOT / "forecasting" / "inference" / "inference.py",
|
| 122 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
"flare_analysis": {
|
| 124 |
"description": "Detect, track, and match flares; generate plots/movies",
|
| 125 |
"script": ROOT / "forecasting" / "inference" / "flare_analysis.py",
|
|
@@ -234,6 +239,15 @@ def build_commands(step: str, cfg: dict, force: bool) -> list[list[str]] | None:
|
|
| 234 |
config_path = str(write_merged_config(config_path, inf["overrides"], "inference_config"))
|
| 235 |
return [base + ["-config", config_path]]
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
if step == "flare_analysis":
|
| 238 |
if not require(["config"], "inference"):
|
| 239 |
return None
|
|
|
|
| 84 |
"normalize",
|
| 85 |
"train",
|
| 86 |
"inference",
|
| 87 |
+
"evaluate",
|
| 88 |
"flare_analysis",
|
| 89 |
]
|
| 90 |
|
|
|
|
| 121 |
"description": "Run batch inference and save predictions CSV",
|
| 122 |
"script": ROOT / "forecasting" / "inference" / "inference.py",
|
| 123 |
},
|
| 124 |
+
"evaluate": {
|
| 125 |
+
"description": "Compute metrics and generate evaluation plots from predictions CSV",
|
| 126 |
+
"script": ROOT / "forecasting" / "inference" / "evaluation.py",
|
| 127 |
+
},
|
| 128 |
"flare_analysis": {
|
| 129 |
"description": "Detect, track, and match flares; generate plots/movies",
|
| 130 |
"script": ROOT / "forecasting" / "inference" / "flare_analysis.py",
|
|
|
|
| 239 |
config_path = str(write_merged_config(config_path, inf["overrides"], "inference_config"))
|
| 240 |
return [base + ["-config", config_path]]
|
| 241 |
|
| 242 |
+
if step == "evaluate":
|
| 243 |
+
if not require(["config"], "evaluate"):
|
| 244 |
+
return None
|
| 245 |
+
ev = cfg["evaluate"]
|
| 246 |
+
config_path = ev["config"]
|
| 247 |
+
if ev.get("overrides"):
|
| 248 |
+
config_path = str(write_merged_config(config_path, ev["overrides"], "evaluate_config"))
|
| 249 |
+
return [base + ["-config", config_path]]
|
| 250 |
+
|
| 251 |
if step == "flare_analysis":
|
| 252 |
if not require(["config"], "inference"):
|
| 253 |
return None
|