# Outline of PlasmaPy workshop ## Introduction * Code of Conduct * Why open science? * Goals of PlasmaPy - Open source software ecosystem for plasma research and education * PlasmaPy in context - Astropy - Python in Heliophysics Community (SunPy, SpacePy, PySPEDAS, pysat) * PlasmaPy website * PlasmaPy documentation - Contributor guide * PlasmaPy * Plasma Hack Week * Terminology - Subpackage vs. module ## Using PlasmaPy * `astropy.units` - Creating a `Quantity` - Unit operations - Unit conversions - Detaching units from values - Equivalencies - eV ↔ K with `u.temperature_energy()` - `astropy.constants` - Units in PlasmaPy - Optimizing unit operations - `PhysicalType` objects - PlasmaPy convention: code within PlasmaPy should use SI units * `plasmapy.particles` - Getting particle properties - `Particle` objects - `CustomParticle` objects and `molecule` - `ParticleList` objects - `DimensionlessParticle` objects - Nuclear reactions * `plasmapy.formulary` - How the subpackage is structured * `plasmapy.dispersion` - Plasma dispersion function - Two-fluid dispesion solvers * `plasmapy.analysis` * `plasmapy.diagnostics` - Langmuir - Charged particle radiography * `plasmapy.simulation` - Particle pusher * Lite-functions * Aliases ## `git` and GitHub * Software carpentry lesson * Using GitHub ## Getting set up to contribute (command line approach) * Installing Python * * Cloning your fork of PlasmaPy's repository * Setting up remotes - Differences between `upstream` and `origin` * Installing PlasmaPy for development (`pip install -e .`) * Installing `pre-commit` ## Code contribution workflow * `git fetch --all` * `git checkout -b new-branch-name upstream/main` * `git push --set-upstream origin new-branch-name` * Cycle - Edit file(s) - `git commit -m "Edit file"` - Best practices for a commit message - `git push` * Creating a pull request on GitHub - * Pulling changes from `upstream/main` - `git fetch --all` - `git pull upstream main` * Edit file(s) * `git add file.py` * `git commit -m "Edited file..."` * Best practices - Writing a commit message - Describing changes in a pull request ## Anatomy of a PlasmaPy function * Function definition * Docstring * Tests * Decorators - `particle_input` - `validate_quantities` * Type hint annotations ## Testing PlasmaPy * pytest * `tox` (or `nox`?) * Running PlasmaPy's tests * Adding a test * Testing exceptions and warnings * Parametrizing tests * Fixtures (?) * Test-driven development * GitHub Actions * How to know which tests to write ## Linters and autoformatters * Purpose * `pre-commit` * `black` * `isort` * `flake8` and its extensions * `codespell` * `nbqa` * `pyupgrade` ## reStructuredText * Inline markup (`*italic*` for *italic* and `**bold**` for **bold**) - Bold & italic - Backquotes for code samples * Lists * Title and section headers * Links * Roles - `:math:` - `:sup:` and `:sub:` * Directives - Code blocks (with pygments highlighting) - Admonitions * Tables * Comments * No nested inline markup 😿 ## Documentation * Building documentation locally * Adding a docstring to a class or function * numpydoc standard * Writing narrative documentation in `docs/` * Sphinx * `docs/conf.py` * `numpydoc` standard * Bibliography and `:cite:` * Glossary and `:term:` * Adding a changelog entry * `docs/conf.py` * `docs/common_links.rst` * `docs/api_static` * Adding example notebooks ## Code review * Code review mechanics on GitHub * Best practices ## Additional stuff * Lite-functions - Numba and/or Cython * Aliases ## Writing clean scientific software * Variable names * Extract function refactoring pattern *
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up