pyrfu#
Space plasma physics in Python
pyrfu is an open-source package for in-situ space plasma data
analysis, based on the IRFU-MATLAB library. It covers the
Magnetospheric Multiscale (MMS) mission from data access to particle
distributions and wave analysis, and general plasma physics tools.
$ python -m pip install pyrfu
What you can do with pyrfu#
Find, download and load MMS data from a local archive, the SDC or AWS
in one call, as xarray time series.
FPI skymaps: omni-directional and pitch-angle distributions, projections, reduced 1D and 2D distributions and moments.
Wavelet and Fourier spectra, polarization analysis, Poynting flux and four-spacecraft dispersion relations.
Curlometer current density, gradients, timing velocities and four-spacecraft averages.
Geophysical coordinate transformations, field-aligned and minimum variance frames, filtering and resampling.
Publication-ready time series, spectrograms and particle distribution plots with matplotlib.
Quickstart#
import matplotlib.pyplot as plt
from pyrfu import mms, pyrf
from pyrfu.plot import plot_line
# Path to the MMS data
mms.db_init(default="local", local="/Volumes/mms")
# Load the magnetic field and the ion bulk velocity
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)
# Transform the ion bulk velocity to GSM coordinates
v_gsm_i = pyrf.cotrans(v_gse_i, "gse>gsm")
f, axs = plt.subplots(2, sharex="all")
plot_line(axs[0], b_gsm)
plot_line(axs[1], v_gsm_i)
More in the examples gallery.
Documentation#
Install from PyPI or from the sources.
Notebooks for MMS, dispersion relations and more.
Every function, grouped by topic.
Code style, tests and how to contribute.
Citing pyrfu#
If you use pyrfu in your research, please cite it using its Zenodo DOI
10.5281/zenodo.10678695 (the
Zenodo page also lists the DOI of each release):
@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}
}
pyrfu was developed at the Swedish Institute of Space Physics (IRF) in
Uppsala, building on the IRFU-MATLAB library, and is now maintained at the
Rudolf Peierls Centre for Theoretical Physics, University of Oxford. It is
distributed under the MIT license.
