Skip to content

Begin plasmapy.distribution with MaxwellianDistribution - #3193

Draft
namurphy wants to merge 15 commits into
PlasmaPy:mainfrom
namurphy:distribution-maxwellian
Draft

namurphy wants to merge 15 commits into
PlasmaPy:mainfrom
namurphy:distribution-maxwellian

Conversation

@namurphy

@namurphy namurphy commented Jan 16, 2026 •

Copy link
Copy Markdown
Member

Important

Before this pull request can be merged, we would need to update PLEP 7 to include plasmapy.distribution (PlasmaPy/PlasmaPy-PLEPs#53).

Description

This is a prototype pull request to create the plasmapy.distribution subpackage to include particle distribution functions, starting with the Maxwellian (or Maxwell-Boltzmann) distribution.

This is included in §4.3 of the NSF CSSI proposal that we recently submitted.

Motivation

PlasmaPy currently has functions for particle distribution functions in plasmapy.formulary.distribution, including Maxwellians and kappa distributions for 1D, 2D, and 3D. However, each individual function accepts ∼5 arguments. If one wanted to calculate multiple properties of one of these distribution functions, they would have to provide all of the arguments every time that they calculate something new, unless they simplified it with functools.partial.

My goal is to create classes to represent different particle distribution functions. The API would be something like...

>>> from plasmapy.distribution import MaxwellBoltzmannDistribution
>>> maxwellian = MaxwellBoltzmannDistribution(T=..., ...)
>>> maxwellian.pdf(...)
>>> maxwellian.cdf(...)

There's more than enough functionality related to particle distribution functions to create a new subpackage. In particular, we'll eventually need functionality for discretized particle distribution functions, which are important for space plasma, and hence interoperability with the Python in Heliophysics Community.

@github-actions github-actions Bot added docs PlasmaPy Docs at http://docs.plasmapy.org python Pull requests that update Python code labels Jan 16, 2026
@codecov

codecov Bot commented Jan 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.36%. Comparing base (2d278b7) to head (e1849d8).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3193      +/-   ##
==========================================
+ Coverage   94.59%   95.36%   +0.77%     
==========================================
  Files         108      110       +2     
  Lines        9872     9879       +7     
  Branches     1501     1501              
==========================================
+ Hits         9338     9421      +83     
+ Misses        332      262      -70     
+ Partials      202      196       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added the feature For new functionality, excluding breaking changes label Jan 17, 2026
Signed-off-by: Nick Murphy <namurphy@cfa.harvard.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs PlasmaPy Docs at http://docs.plasmapy.org feature For new functionality, excluding breaking changes python Pull requests that update Python code testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant