# AEP8

[![Python Package Index status](https://img.shields.io/pypi/v/aep8)](https://pypi.org/project/aep8/)
[![Powered by Astropy](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org)
[![codecov](https://codecov.io/gh/m4opt/aep8/graph/badge.svg?token=g3n8RKrekt)](https://codecov.io/gh/m4opt/aep8)
[![Documentation](https://readthedocs.org/projects/m4opt/badge/?version=latest)](https://m4opt.readthedocs.io/en/latest/)

![Map of integral min electron flux at 500 km and 1 MeV](https://github.com/m4opt/aep8/raw/main/test/baseline/test_plot_flux_integral-min-e.png)

This Python package calculates the estimated flux of electrons or protons trapped in the Earth's radiation belt. It is a Python wrapper for the [NASA AE8/AP8 model](https://prbem.github.io/IRBEM/api/radiation_models.html#ae8-and-ap8-models) in the [IRBEM](https://prbem.github.io/IRBEM/) package. It provides an [Astropy](https://www.astropy.org)-friendly interface, allowing you to specify the location using [Astropy coordinates](https://docs.astropy.org/en/stable/coordinates/index.html), the time in [Astropy time](https://docs.astropy.org/en/stable/time/index.html), and the energy using [Astropy units](https://docs.astropy.org/en/stable/units/index.html). You can pass it a single time and location, or arrays of times and locations.

## To install

```
pip install aep8
```

## Example

```pycon
>>> from astropy.coordinates import EarthLocation
>>> from astropy.time import Time
>>> from astropy import units as u
>>> import aep8
>>> loc = EarthLocation.from_geodetic(15 * u.deg, -45 * u.deg, 300 * u.km)
>>> time = Time('2025-01-01 18:37:22')
>>> energy = 10 * u.MeV
>>> aep8.model(solar='max', particle='p').integral_flux(loc, time, energy)
<Quantity 3.04495297 1 / (s cm2)>
```
