-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a radbelt_type with a get_flux method
test updates and added a python test
- Loading branch information
1 parent
9104eb0
commit 1967ae2
Showing
5 changed files
with
134 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Test of the Python version from: https://github.com/nasa/radbelt | ||
# | ||
|
||
from radbelt import get_flux | ||
from astropy import units as u | ||
from astropy.coordinates import EarthLocation | ||
from astropy.time import Time | ||
import time | ||
|
||
t = Time('2021-03-01') | ||
energy = 20 * u.MeV | ||
|
||
tstart = time.time() | ||
n_cases = 0 | ||
|
||
# fortran loop indices: | ||
# do ilat = -90, 90, 5 | ||
# do ilon = -180, 180, 45 | ||
# do ialt = 500, 1000, 100 | ||
|
||
for lat in range(-90, 91, 5): | ||
for lon in range(-180, 181, 45): | ||
for alt in range(500, 1001, 100): | ||
n_cases = n_cases + 1 | ||
coords = EarthLocation(lon * u.deg, lat * u.deg, alt * u.km) | ||
f = get_flux(coords, t, energy, 'p', 'max') # doctest: +FLOAT_CMP | ||
#print(t.utc.decimalyear, lat, lon, alt, f.value) | ||
tend = time.time() | ||
print(f'Python version runtime: {tend-tstart} sec. {int(n_cases/(tend-tstart))} (cases/sec)') |