pyrfu is an open-source Python package for in-situ space plasma data analysis, particularly of the Magnetospheric Multiscale (MMS) mission.
It is distributed under the open-source MIT license.
Installing pyrfu with pip (more details here):
$ python -m pip install pyrfu
# or
$ python -m pip install --user pyrfuImport pyrfu.mms package with routines specific to work with the Magnetospheric Multiscale mission (MMS)
from pyrfu import mmsSetup path to MMS data
mms.db_init(default="local", local="/Volumes/mms")Load magnetic field and ion bulk velocity data
tint = ["2019-09-14T07:54:00.000", "2019-09-14T08:11:00.000"]
b_gsm = mms.get_data("b_gsm_fgm_srvy_l2", tint, 1)
v_gse_i = mms.get_data("vi_gse_fpi_fast_l2", tint, 1)Import pyrfu.pyrf package with generic routines
from pyrfu import pyrfTransform ion bulk velocity to geocentric solar magnetospheric (GSM) coordinates
v_gsm_i = pyrf.cotrans(v_gse_i, "gse>gsm")Import pyrfu.plot package with plotting routines
from pyrfu.plot import plot_linePlot time series of magnetic field and ion bulk velocity
import matplotlib.pyplot as plt
f, axs = plt.subplots(2, sharex="all")
plot_line(axs[0], b_gsm)
axs[0].set_ylabel("$B~[\\mathrm{nT}]$")
axs[0].legend(["$B_{x}$", "$B_{y}$", "$B_{z}$"], ncol=4)
plot_line(axs[1], v_gsm_i)
axs[1].set_ylabel("$V_i~[\\mathrm{km}~\\mathrm{s}^{-1}]$")
axs[1].legend(["$V_{ix}$", "$V_{iy}$", "$V_{iz}$"], ncol=4)Full documentation can be found on pyrfu.readthedocs.io
A list of examples is available here
This software was developed by Louis RICHARD at the Swedish Institute of Space Physics (IRF) in Uppsala, where it started from the IRFU-MATLAB library, and is now maintained by Louis RICHARD at the Rudolf Peierls Centre for Theoretical Physics, University of Oxford (louis.richard@physics.ox.ac.uk).
If pyrfu contributes to work leading to a publication, please cite it and give
the version you used (pyrfu.__version__), for example in the acknowledgements
or the methods section:
Data analysis was performed using the open-source pyrfu package (Richard et al., 2024), version X.Y.Z.
Reference:
Richard, L., Khotyaintsev, Y. V., Vaivads, A., Graham, D. B., Norgren, C., & Johlander, A. (2024). Python RymdFysik Utilities (PyRFU): An open-source Python package for advanced in-situ space plasma analysis [Software]. Zenodo. https://doi.org/10.5281/zenodo.10678695
BibTeX:
@software{richard2024pyrfu,
author = {Richard, Louis and Khotyaintsev, Yuri V. and Vaivads, Andris and
Graham, Daniel B. and Norgren, Cecilia and Johlander, Andreas},
title = {Python RymdFysik Utilities (PyRFU): An Open-Source Python Package
for Advanced In-Situ Space Plasma Analysis},
year = {2024},
publisher = {Zenodo},
doi = {10.5281/zenodo.10678695},
url = {https://doi.org/10.5281/zenodo.10678695}
}The same metadata is in CITATION.cff (GitHub's "Cite this repository").
Many routines implement published methods, given in the References section of
their documentation: please cite those as well, and acknowledge the data you use
following the policy of each mission (for MMS, the instrument teams and the MMS
Science Data Center).