Metadata-Version: 2.1
Name: SolarNet-Lib
Version: 0.1.0
Summary: Deep Learning for Solar Physics Prediction
Home-page: https://gitlab.com/jdonzallaz/solarnet
Author: Jonathan Donzallaz
Author-email: jonathan.donzallaz@hefr.ch
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: boto3 (>=1.17.49)
Requires-Dist: colorlog (>=5.0.0)
Requires-Dist: click (<7.2.0,>=7.1.1)
Requires-Dist: lightning-bolts (>=0.3.4)
Requires-Dist: matplotlib (>=3.3.4)
Requires-Dist: numpy (>=1.17.2)
Requires-Dist: pandas (>=1.1.5)
Requires-Dist: Pillow (>=8.2.0)
Requires-Dist: pyarrow (>=4.0.0)
Requires-Dist: pytorch-lightning (>=1.3.8)
Requires-Dist: ruamel.yaml (>=0.16.1)
Requires-Dist: sunpy[net] (<3.0.0,>=2.0.0)
Requires-Dist: torch (>=1.6)
Requires-Dist: torchmetrics (>=0.4.1)
Requires-Dist: torchvision (>=0.7)
Requires-Dist: tqdm (>=4.41.0)
Requires-Dist: typer (>=0.3.2)

# SolarNet

> Deep Learning for Solar Physics Prediction

The SolarNet library permits to use the different Pytorch models, datasets, preprocessing, and others utilities
developed during the SolarNet project. It also makes straightforward the download, loading, and finetuning of the big
pretrained SSL models. With SolarNet, anyone can access the datasets (at this time, only SDO-Benchmark is available
through the library) and finetune the powerful models. The library is compatible with Pytorch-Lightning, but the models
are also pure Pytorch Module and the training loop can be written from scratch.

Find the docs on [jdonzallaz.gitlab.io/solarnet](https://jdonzallaz.gitlab.io/solarnet/).

## Installation

Use pip to install:

```
pip install solarnet-lib
```

Python 3.6+ is required.

## Data

Two datasets are supported: SDO-Dataset and SDO-Benchmark. SDO-Dataset needs to be downloaded from the Stanford's servers.
The SDO-Benchmark dataset can be downloaded using the CLI:

```
solarnet download sdo-benchmark data/
```

## Dataset

```python
path = Path("data") / "sdo-benchmark" / "train"
dataset = SDOBenchmarkDataset(path)
```

Also available as a pytorch-lightning datamodule.

```py
path = Path("data") / "sdo-benchmark"
datamodule = SDOBenchmarkDatamodule(path)
```

## Model

```py
model = ImageClassification.from_pretrained("solarnet-ssl-bz-ft-sdo-benchmark")
```

## Finetuning

```py
trainer = pl.Trainer(
    max_epochs=10,
    gpus=0,
)
trainer.fit(model, datamodule=datamodule)
```

## Deployment

```bash
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*
```

## Author

SolarNet is a deep learning research toolbox for solar physics. It was developed during a Master thesis
by [Jonathan Donzallaz](mailto:jonathan.donzallaz@hefr.ch).


