Skip to main content

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()

example.png

For more information and options, see the docstring: spicedmodel.PlotEq?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

spicedmodel-1.0.0-py3-none-any.whl (537.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page