Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.11.13"
rev: "v0.16.0"
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand All @@ -17,7 +17,7 @@ repos:
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
exclude: '.*\.fits$'
Expand All @@ -31,7 +31,7 @@ repos:
args: ["--maxkb=10000"]

- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
rev: 0.9.1
hooks:
- id: nbstripout
args: ["--extra-keys=metadata.kernelspec metadata.language_info.version metadata.toc"]
42 changes: 21 additions & 21 deletions quantities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"# You shouldn't use the `seed` function in real science code, but we use it here for example purposes.\n",
"# It makes the \"random\" number generator always give the same numbers wherever you run it.\n",
Expand Down Expand Up @@ -161,9 +161,9 @@
"outputs": [],
"source": [
"print(\n",
" \"\"\"Half light radius\n",
"value: {0}\n",
"unit: {1}\"\"\".format(Reff.value, Reff.unit)\n",
" f\"\"\"Half light radius\n",
"value: {Reff.value}\n",
"unit: {Reff.unit}\"\"\"\n",
")"
]
},
Expand All @@ -181,9 +181,9 @@
"outputs": [],
"source": [
"print(\n",
" \"\"\"Half light radius\n",
"value: {0.value}\n",
"unit: {0.unit}\"\"\".format(Reff)\n",
" f\"\"\"Half light radius\n",
"value: {Reff.value}\n",
"unit: {Reff.unit}\"\"\"\n",
")"
]
},
Expand All @@ -200,7 +200,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"{0:.3g}\".format(Reff.to(u.m)))"
"print(f\"{Reff.to(u.m):.3g}\")"
]
},
{
Expand Down Expand Up @@ -228,9 +228,9 @@
"outputs": [],
"source": [
"print(\n",
" \"\"\"First 10 radial velocity measurements: \n",
"{0}\n",
"{1}\"\"\".format(v[:10], v.to(u.m / u.s)[:10])\n",
" f\"\"\"First 10 radial velocity measurements: \n",
"{v[:10]}\n",
"{v.to(u.m / u.s)[:10]}\"\"\"\n",
")"
]
},
Expand Down Expand Up @@ -282,7 +282,7 @@
"outputs": [],
"source": [
"sigma = np.sqrt(np.sum((v - np.mean(v)) ** 2) / np.size(v))\n",
"print(\"Velocity dispersion: {0:.2f}\".format(sigma))"
"print(f\"Velocity dispersion: {sigma:.2f}\")"
]
},
{
Expand Down Expand Up @@ -355,10 +355,10 @@
"outputs": [],
"source": [
"print(\n",
" \"\"\"Galaxy mass\n",
"in solar units: {0:.3g}\n",
"SI units: {1:.3g}\n",
"CGS units: {2:.3g}\"\"\".format(M.to(u.Msun), M.si, M.cgs)\n",
" f\"\"\"Galaxy mass\n",
"in solar units: {M.to(u.Msun):.3g}\n",
"SI units: {M.si:.3g}\n",
"CGS units: {M.cgs:.3g}\"\"\"\n",
")"
]
},
Expand Down Expand Up @@ -562,9 +562,9 @@
"# Average velocity bin width\n",
"dv = (v.max() - v.min()) / len(v)\n",
"print(\n",
" \"\"\"dra = {0}\n",
"ddec = {1}\n",
"dv = {2}\"\"\".format(dra.to(u.arcsec), ddec.to(u.arcsec), dv)\n",
" f\"\"\"dra = {dra.to(u.arcsec)}\n",
"ddec = {ddec.to(u.arcsec)}\n",
"dv = {dv}\"\"\"\n",
")"
]
},
Expand Down Expand Up @@ -607,7 +607,7 @@
" interpolation=\"nearest\",\n",
" aspect=\"equal\",\n",
")\n",
"plt.colorbar().set_label(\"Intensity ({})\".format(intcloud.unit))\n",
"plt.colorbar().set_label(f\"Intensity ({intcloud.unit})\")\n",
"plt.xlabel(\"RA (deg)\")\n",
"plt.ylabel(\"Dec (deg)\");"
]
Expand Down Expand Up @@ -746,7 +746,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"{0}\\n{1}\".format(B, B.decompose()))"
"print(f\"{B}\\n{B.decompose()}\")"
]
},
{
Expand Down