Python wrapper for the Scalable Plasma Ion Composition and Electron Density (SPICED) model
Project description
spicedmodel
Python wrapper for the Scalable Plasma Ion Composition and Electron Density (SPICED) model.
A link to the paper describing this model will be provided here once published.
James, M. K., Yeoman, T.K., Jones, P., Sandhu, J. K., Goldstein, J. (2021), The Scalable Plasma Ion Composition and Electron Density (SPICED) model for Earth's inner magnetosphere, J. Geophys. Res. Space Physics
Installation
Using pip
This will download the package from PyPI:
pip3 install spicedmodel --user
From Source
Obtain the latest release from https://github.com/mattkjames7/spicedmodel
git clone https://github.com/mattkjames7/spicedmodel
cd spicedmodel
Either install using setup.py
:
python3 setup.py install --user
or by building a wheel:
python3 setup.py bdist_wheel
pip3 install dist/spicedmodel-XXX.whl --user
where "XXX"
is the rest of the file name, which will vary depending upon the current version.
Usage
Load python3
or ipython3
, and import
import spicedmodel
Accessing the models
There are four models, plus two additional combinations of these models:
- Plasmasphere average ion mass, mav,ps:
spicedmodel.MavPS
- Plasmatrough average ion mass, mav,pt: `spicedmodel.MavPT
- Combined average ion mass, mav:
spicedmodel.Mav
- Hot average ion mass, mav:
spicedmodel.MavHot
- Probability of being within the plasmasphere, P:
spicedmodel.Prob
- Plasmasphere electron density, ne,ps:
spicedmodel.PS
- Plasmatrough electron density, ne,pt:
spicedmodel.PT
- Combined electron density, ne (a combination of plasmasphere, plasmatrough and probability models):
spicedmodel.Density
- Combined plasma mass density, ρ:
spicedmodel.PMD
The average versions of each model can be accessed simply by providing the positions in the equatorial plane where you would like them, e.g.:
#either using SM x and y coordinates
P = spicedmodel.Prob(x,y)
#or using MLT (M) and L-Shell (L)
P = spicedmodel.Prob(M,L,Coord='ml')
The scaled models can be accessed using the same functions, this time including the SMR
keyword (for Mav
, MavPS
, MavPT
, Prob
, PS
, PT
, Density
or PMD
) or F107
(for MavHot
), e.g.:
#electron density
ne = spicedmodel.Density(x,y,SMR=-75.0)
#average ion mass
mav = spicedmodel.Mav(x,y,SMR=-75.0)
#plasma mass density, effectively ne*mav
pmd = spicedmodel.PMD(x,y,SMR=-75.0)
Plotting the models
A simple function is included, PlotEq
, which allows the plotting of any of the models in the equatorial plane. e.g.:
ax = spicedmodel.PlotEq(ptype,SMR=-75.0)
where ptype
is used to tell the function which model to plot, available options are: 'mav'|'mavps'|'mavpt'|'mavhot'|'prob'|'ps'|'pt'|'density'|'pmd'
.
The following code produces a plot with all 6 models when SMR = -75 nT
import matplotlib.pyplot as plt
import spicedmodel
#create the plot window
plt.figure(figsize=(8,7))
#set the parameters of the models
smr = -70.0
#plot the average ion mass
ax0 = spicedmodel.PlotEq('mav',SMR=smr,fig=plt,maps=[2,2,0,0])
#plot probability
ax1 = spicedmodel.PlotEq('prob',SMR=smr,fig=plt,maps=[2,2,1,0])
#plot electron density
ax4 = spicedmodel.PlotEq('density',SMR=smr,fig=plt,maps=[2,2,0,1])
#plot plasma mass density
ax5 = spicedmodel.PlotEq('pmd',SMR=smr,fig=plt,maps=[2,2,1,1])
#adjust everything to fit
plt.tight_layout()
For more information and options, see the docstring
: spicedmodel.PlotEq?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file spicedmodel-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: spicedmodel-1.0.0-py3-none-any.whl
- Upload date:
- Size: 537.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84709d7e4d6d617e460c45c97e9c4fc706b5ed041258f559cb70bb4b43f78647 |
|
MD5 | 25789400a656511f0ad8f6eb0b17cdda |
|
BLAKE2b-256 | e92bbf5c1095590aa226b4ca10a571bb06ff55d1e0608852df04842becb7a5ea |