Skip to content

Commit 00f6cd2

Browse files
style: pre-commit fixes
1 parent eebbeaa commit 00f6cd2

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

quantities.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
"metadata": {},
5656
"outputs": [],
5757
"source": [
58-
"import numpy as np\n",
5958
"import matplotlib.pyplot as plt\n",
59+
"import numpy as np\n",
6060
"\n",
6161
"# You shouldn't use the `seed` function in real science code, but we use it here for example purposes.\n",
6262
"# It makes the \"random\" number generator always give the same numbers wherever you run it.\n",
@@ -161,9 +161,9 @@
161161
"outputs": [],
162162
"source": [
163163
"print(\n",
164-
" \"\"\"Half light radius\n",
165-
"value: {0}\n",
166-
"unit: {1}\"\"\".format(Reff.value, Reff.unit)\n",
164+
" f\"\"\"Half light radius\n",
165+
"value: {Reff.value}\n",
166+
"unit: {Reff.unit}\"\"\"\n",
167167
")"
168168
]
169169
},
@@ -181,9 +181,9 @@
181181
"outputs": [],
182182
"source": [
183183
"print(\n",
184-
" \"\"\"Half light radius\n",
185-
"value: {0.value}\n",
186-
"unit: {0.unit}\"\"\".format(Reff)\n",
184+
" f\"\"\"Half light radius\n",
185+
"value: {Reff.value}\n",
186+
"unit: {Reff.unit}\"\"\"\n",
187187
")"
188188
]
189189
},
@@ -200,7 +200,7 @@
200200
"metadata": {},
201201
"outputs": [],
202202
"source": [
203-
"print(\"{0:.3g}\".format(Reff.to(u.m)))"
203+
"print(f\"{Reff.to(u.m):.3g}\")"
204204
]
205205
},
206206
{
@@ -228,9 +228,9 @@
228228
"outputs": [],
229229
"source": [
230230
"print(\n",
231-
" \"\"\"First 10 radial velocity measurements: \n",
232-
"{0}\n",
233-
"{1}\"\"\".format(v[:10], v.to(u.m / u.s)[:10])\n",
231+
" f\"\"\"First 10 radial velocity measurements: \n",
232+
"{v[:10]}\n",
233+
"{v.to(u.m / u.s)[:10]}\"\"\"\n",
234234
")"
235235
]
236236
},
@@ -282,7 +282,7 @@
282282
"outputs": [],
283283
"source": [
284284
"sigma = np.sqrt(np.sum((v - np.mean(v)) ** 2) / np.size(v))\n",
285-
"print(\"Velocity dispersion: {0:.2f}\".format(sigma))"
285+
"print(f\"Velocity dispersion: {sigma:.2f}\")"
286286
]
287287
},
288288
{
@@ -355,10 +355,10 @@
355355
"outputs": [],
356356
"source": [
357357
"print(\n",
358-
" \"\"\"Galaxy mass\n",
359-
"in solar units: {0:.3g}\n",
360-
"SI units: {1:.3g}\n",
361-
"CGS units: {2:.3g}\"\"\".format(M.to(u.Msun), M.si, M.cgs)\n",
358+
" f\"\"\"Galaxy mass\n",
359+
"in solar units: {M.to(u.Msun):.3g}\n",
360+
"SI units: {M.si:.3g}\n",
361+
"CGS units: {M.cgs:.3g}\"\"\"\n",
362362
")"
363363
]
364364
},
@@ -562,9 +562,9 @@
562562
"# Average velocity bin width\n",
563563
"dv = (v.max() - v.min()) / len(v)\n",
564564
"print(\n",
565-
" \"\"\"dra = {0}\n",
566-
"ddec = {1}\n",
567-
"dv = {2}\"\"\".format(dra.to(u.arcsec), ddec.to(u.arcsec), dv)\n",
565+
" f\"\"\"dra = {dra.to(u.arcsec)}\n",
566+
"ddec = {ddec.to(u.arcsec)}\n",
567+
"dv = {dv}\"\"\"\n",
568568
")"
569569
]
570570
},
@@ -607,7 +607,7 @@
607607
" interpolation=\"nearest\",\n",
608608
" aspect=\"equal\",\n",
609609
")\n",
610-
"plt.colorbar().set_label(\"Intensity ({})\".format(intcloud.unit))\n",
610+
"plt.colorbar().set_label(f\"Intensity ({intcloud.unit})\")\n",
611611
"plt.xlabel(\"RA (deg)\")\n",
612612
"plt.ylabel(\"Dec (deg)\");"
613613
]
@@ -746,7 +746,7 @@
746746
"metadata": {},
747747
"outputs": [],
748748
"source": [
749-
"print(\"{0}\\n{1}\".format(B, B.decompose()))"
749+
"print(f\"{B}\\n{B.decompose()}\")"
750750
]
751751
},
752752
{

0 commit comments

Comments
 (0)