Skip to content

Commit 2be1b7e

Browse files
George Bisbasgeorgebisbas
authored andcommitted
examples: Update by comments
1 parent d6735ea commit 2be1b7e

2 files changed

Lines changed: 15 additions & 28 deletions

File tree

examples/finance/bs_ivbp.ipynb

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
"name": "stdout",
2828
"output_type": "stream",
2929
"text": [
30-
"dt,tmax,nt; 0.0005 1.0 2001\n",
31-
"shape; (81,)\n",
32-
"origin; (60,)\n",
33-
"spacing; (1.0,)\n",
34-
"extent; 80\n"
30+
"dt,tmax,nt: 0.0005, 1.0, 2001\n",
31+
"shape: (81,)\n",
32+
"origin: (60,)\n",
33+
"spacing: (1.0,)\n",
34+
"extent: 80\n"
3535
]
3636
}
3737
],
@@ -100,11 +100,11 @@
100100
"spacing = (ds0, )\n",
101101
"extent = int(ds0 * (ns - 1))\n",
102102
"\n",
103-
"print(\"dt,tmax,nt;\", dt0,tmax,nt)\n",
104-
"print(\"shape; \", shape)\n",
105-
"print(\"origin; \", origin)\n",
106-
"print(\"spacing; \", spacing)\n",
107-
"print(\"extent; \", extent)"
103+
"print(f\"dt,tmax,nt: {dt0}, {tmax}, {nt}\")\n",
104+
"print(f\"shape: {shape}\")\n",
105+
"print(f\"origin: {origin}\")\n",
106+
"print(f\"spacing: {spacing}\")\n",
107+
"print(f\"extent: {extent}\")"
108108
]
109109
},
110110
{
@@ -608,22 +608,11 @@
608608
"cell_type": "code",
609609
"execution_count": 10,
610610
"metadata": {},
611-
"outputs": [
612-
{
613-
"data": {
614-
"text/plain": [
615-
"np.float64(0.005885208362743295)"
616-
]
617-
},
618-
"execution_count": 10,
619-
"metadata": {},
620-
"output_type": "execute_result"
621-
}
622-
],
611+
"outputs": [],
623612
"source": [
624613
"#NBVAL_IGNORE_OUTPUT\n",
625614
"\n",
626-
"np.mean(vals)"
615+
"assert np.isclose(np.mean(vals), 0.005885, rtol=1e-4)\n"
627616
]
628617
},
629618
{

examples/seismic/tutorials/08_snapshotting.ipynb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@
9191
"\n",
9292
"#NBVAL_IGNORE_OUTPUT\n",
9393
"#%%flake8\n",
94-
"from devito import TimeFunction\n",
95-
"from devito import Eq, solve\n",
96-
"from devito import Operator\n",
94+
"from devito import TimeFunction, Eq, solve, Operator\n",
9795
"\n",
9896
"from examples.seismic import Receiver\n",
9997
"from examples.seismic import RickerSource\n",
@@ -194,7 +192,7 @@
194192
"cell_type": "markdown",
195193
"metadata": {},
196194
"source": [
197-
"Checking `u.data` spaced by `factor` using matplotlib,"
195+
"Checking `u.data` spaced by `factor` using matplotlib."
198196
]
199197
},
200198
{
@@ -255,7 +253,7 @@
255253
"#NBVAL_IGNORE_OUTPUT\n",
256254
"fobj = open(\"naivesnaps.bin\", \"rb\") \n",
257255
"snaps = np.fromfile(fobj, dtype = np.float32) \n",
258-
"snaps = np.reshape(snaps, (nsnaps, vnx, vnz)) #reshape vec2mtx, devito format. nx first\n",
256+
"snaps = np.reshape(snaps, (nsnaps, vnx, vnz)) # reshape vec2mtx, devito format. nx first\n",
259257
"fobj.close()\n",
260258
"\n",
261259
"plt.figure(figsize=(20, 20)) # Increases figure size\n",

0 commit comments

Comments
 (0)