# chetrajpandey/fulldiskattention architecture

> Architecture diagram of the GitHub repository chetrajpandey/fulldiskattention, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chetrajpandey/fulldiskattention
- Repository: https://github.com/chetrajpandey/fulldiskattention

## Overview

This repository builds full-disk solar magnetogram classifiers to predict whether an M1.0-or-greater flare will occur in the next 24 hours. The documented workflow obtains and converts HMI images, labels timestamped images from GOES flare records, trains attention or standard-CNN models using four-fold datasets, and analyzes predictions and attention maps. The graph preserves the documented analysis branches; source excerpts establish training, labeling, model, and download behavior, while notebook wiring is based on README descriptions.

Main entry points: [`modeling/train.py`](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/train.py) (Training runner), [`modeling/trained_models`](https://github.com/chetrajpandey/fulldiskattention/tree/main/modeling/trained_models) (Trained weights), [`download_mag/download_jp2.py`](https://github.com/chetrajpandey/fulldiskattention/blob/main/download_mag/download_jp2.py) (Download and convert), [`modeling/attention_model.py`](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/attention_model.py) (CNN and attention)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Image acquisition"]
  node_magnetograms["JP2 magnetograms"]
  node_download["Download and convert<br/>[download_jp2.py]"]
  node_jpgs["JPG magnetograms"]
end

subgraph group_labels["Flare labeling"]
  node_flare_records["GOES flare records"]
  node_labeling["Label and split<br/>[labeling.py]"]
  node_folds["Four-fold labels"]
end

subgraph group_training["Model training"]
  node_train["Training runner<br/>[train.py]"]
  node_loader["Image datasets<br/>[dataloader.py]"]
  node_architecture["CNN and attention<br/>[attention_model.py]"]
  node_blocks["Attention blocks<br/>[blocks.py]"]
  node_initialization["Weight initialization<br/>[initialize.py]"]
  node_evaluation["Skill metrics<br/>[evaluation.py]"]
  node_weights["Trained weights"]
  node_fold_results["Fold results"]
end

subgraph group_analysis["Result analysis"]
  node_attention_analysis["Attention predictions"]
  node_cnn_analysis["CNN predictions"]
  node_map_analysis["Attention maps"]
  node_plot_locations["Plot locations<br/>[plots.csv]"]
end

node_helioviewer(("Helioviewer"))

node_helioviewer -.->|"provides images"| node_download
node_download -->|"downloads JP2"| node_magnetograms
node_download -->|"converts images"| node_jpgs
node_flare_records -->|"supplies flare data"| node_labeling
node_labeling -->|"writes labels"| node_folds
node_folds -->|"provides fold CSVs"| node_train
node_jpgs -->|"provides images"| node_loader
node_train -->|"constructs datasets"| node_loader
node_train -->|"runs classifier"| node_architecture
node_architecture -->|"uses attention blocks"| node_blocks
node_architecture -->|"initializes weights"| node_initialization
node_train -->|"computes skill scores"| node_evaluation
node_train -->|"saves model weights"| node_weights
node_train -->|"writes fold results"| node_fold_results
node_weights -->|"evaluates attention models"| node_attention_analysis
node_fold_results -->|"supplies results"| node_attention_analysis
node_weights -->|"evaluates CNN models"| node_cnn_analysis
node_fold_results -->|"supplies results"| node_cnn_analysis
node_weights -->|"visualizes attention"| node_map_analysis
node_plot_locations -->|"supplies instances"| node_map_analysis

click node_download "https://github.com/chetrajpandey/fulldiskattention/blob/main/download_mag/download_jp2.py"
click node_flare_records "https://github.com/chetrajpandey/fulldiskattention/blob/main/data_labeling/data_source/goes_flares_integrated.csv"
click node_labeling "https://github.com/chetrajpandey/fulldiskattention/blob/main/data_labeling/labeling.py"
click node_folds "https://github.com/chetrajpandey/fulldiskattention/tree/main/data_labeling/data_labels/simplified_data_labels"
click node_train "https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/train.py"
click node_loader "https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/dataloader.py"
click node_architecture "https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/attention_model.py"
click node_blocks "https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/blocks.py"
click node_initialization "https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/initialize.py"
click node_evaluation "https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/evaluation.py"
click node_weights "https://github.com/chetrajpandey/fulldiskattention/tree/main/modeling/trained_models"
click node_fold_results "https://github.com/chetrajpandey/fulldiskattention/tree/main/modeling/trained_models"
click node_attention_analysis "https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/Attention_Predictions.ipynb"
click node_cnn_analysis "https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/No_Attention_Predictions.ipynb"
click node_map_analysis "https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/Attention_Maps_Visualize.ipynb"
click node_plot_locations "https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/plots.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_magnetograms,node_download,node_jpgs,node_helioviewer toneBlue
class node_flare_records,node_labeling,node_folds toneAmber
class node_train,node_loader,node_architecture,node_blocks,node_initialization,node_evaluation,node_weights,node_fold_results toneMint
class node_attention_analysis,node_cnn_analysis,node_map_analysis,node_plot_locations toneRose
```

## Components

### Image acquisition

- **JP2 magnetograms**
- [Download and convert](https://github.com/chetrajpandey/fulldiskattention/blob/main/download_mag/download_jp2.py): `download_mag/download_jp2.py`
- **JPG magnetograms**

### Flare labeling

- [GOES flare records](https://github.com/chetrajpandey/fulldiskattention/blob/main/data_labeling/data_source/goes_flares_integrated.csv): `data_labeling/data_source/goes_flares_integrated.csv`
- [Label and split](https://github.com/chetrajpandey/fulldiskattention/blob/main/data_labeling/labeling.py): `data_labeling/labeling.py`
- [Four-fold labels](https://github.com/chetrajpandey/fulldiskattention/tree/main/data_labeling/data_labels/simplified_data_labels): `data_labeling/data_labels/simplified_data_labels`

### Model training

- [Training runner](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/train.py): `modeling/train.py`
- [Image datasets](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/dataloader.py): `modeling/dataloader.py`
- [CNN and attention](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/attention_model.py): `modeling/attention_model.py`
- [Attention blocks](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/blocks.py): `modeling/blocks.py`
- [Weight initialization](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/initialize.py): `modeling/initialize.py`
- [Skill metrics](https://github.com/chetrajpandey/fulldiskattention/blob/main/modeling/evaluation.py): `modeling/evaluation.py`
- [Trained weights](https://github.com/chetrajpandey/fulldiskattention/tree/main/modeling/trained_models): `modeling/trained_models`
- [Fold results](https://github.com/chetrajpandey/fulldiskattention/tree/main/modeling/trained_models): `modeling/trained_models`

### Result analysis

- [Attention predictions](https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/Attention_Predictions.ipynb): `result_analysis/Attention_Predictions.ipynb`
- [CNN predictions](https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/No_Attention_Predictions.ipynb): `result_analysis/No_Attention_Predictions.ipynb`
- [Attention maps](https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/Attention_Maps_Visualize.ipynb): `result_analysis/Attention_Maps_Visualize.ipynb`
- [Plot locations](https://github.com/chetrajpandey/fulldiskattention/blob/main/result_analysis/plots.csv): `result_analysis/plots.csv`

### Other components

- **Helioviewer**

## Connections

- Helioviewer → Download and convert: provides images
- Download and convert → JP2 magnetograms: downloads JP2
- Download and convert → JPG magnetograms: converts images
- GOES flare records → Label and split: supplies flare data
- Label and split → Four-fold labels: writes labels
- Four-fold labels → Training runner: provides fold CSVs
- JPG magnetograms → Image datasets: provides images
- Training runner → Image datasets: constructs datasets
- Training runner → CNN and attention: runs classifier
- CNN and attention → Attention blocks: uses attention blocks
- CNN and attention → Weight initialization: initializes weights
- Training runner → Skill metrics: computes skill scores
- Training runner → Trained weights: saves model weights
- Training runner → Fold results: writes fold results
- Trained weights → Attention predictions: evaluates attention models
- Fold results → Attention predictions: supplies results
- Trained weights → CNN predictions: evaluates CNN models
- Fold results → CNN predictions: supplies results
- Trained weights → Attention maps: visualizes attention
- Plot locations → Attention maps: supplies instances
