Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Add test_plasmapy.ipynb notebook from Peter
Browse files Browse the repository at this point in the history
  • Loading branch information
namurphy committed Jun 23, 2021
1 parent dde711f commit f2710ac
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions test_plasmapy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ea6c93d3",
"metadata": {},
"source": [
"# Testing the PlasmaPy Installation"
]
},
{
"cell_type": "markdown",
"id": "addbcd4e",
"metadata": {},
"source": [
"To run this notebook in its entirety, select \"Cell > Run All\" in the toolbar\n",
"\n",
"To run a single cell, select the cell and press \"ctrl+Enter\" or press the \"Run\" button in the toolbar.\n",
"\n",
"To run a subset of the cells, look at the options under \"Cell\" in the toolbar menu."
]
},
{
"cell_type": "markdown",
"id": "3c936b1a",
"metadata": {},
"source": [
"To test the PlasmaPy is installed correctly, we will calculate the gyrofrequency of a proton in a magnetic field using a function imported from the PlasmaPy formulary."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "fe0d92e8",
"metadata": {},
"outputs": [],
"source": [
"import astropy.units as u\n",
"from plasmapy.formulary.parameters import gyrofrequency"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "472c04d7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gyrofrequency: 9.58e+08 rad / s\n"
]
}
],
"source": [
"wci = gyrofrequency(10*u.T, 'H+')\n",
"print(f\"Gyrofrequency: {wci:.2e}\")"
]
},
{
"cell_type": "markdown",
"id": "31c1e943",
"metadata": {},
"source": [
"If this code executes without errors, your PlasmaPy installation is working!"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit f2710ac

Please sign in to comment.