Skip to content

Commit d1c582a

Browse files
committed
Restore proper axes limits
1 parent fe87395 commit d1c582a

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

docs/user-guide/sns-instruments/vanadium_processing.ipynb

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "fb973780-910e-48c0-9055-672182f300f9",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Vanadium processing\n",
@@ -21,7 +21,7 @@
2121
{
2222
"cell_type": "code",
2323
"execution_count": null,
24-
"id": "b38ce909-c9ec-4d75-8060-3b9e3094ef78",
24+
"id": "1",
2525
"metadata": {},
2626
"outputs": [],
2727
"source": [
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"cell_type": "markdown",
39-
"id": "bf03dd14-a096-4cf0-8f0b-c318eb507391",
39+
"id": "2",
4040
"metadata": {},
4141
"source": [
4242
"Use the same parameters as in the main workflow except with more d-spacing bins.\n",
@@ -46,7 +46,7 @@
4646
{
4747
"cell_type": "code",
4848
"execution_count": null,
49-
"id": "01153a77-1710-41fc-a78c-20a8bae40831",
49+
"id": "3",
5050
"metadata": {},
5151
"outputs": [],
5252
"source": [
@@ -70,7 +70,7 @@
7070
},
7171
{
7272
"cell_type": "markdown",
73-
"id": "12ac6517-a73c-493b-b2ce-f7ffe13a2060",
73+
"id": "4",
7474
"metadata": {},
7575
"source": [
7676
"Compute a single vanadium spectrum in d-spacing:"
@@ -79,7 +79,7 @@
7979
{
8080
"cell_type": "code",
8181
"execution_count": null,
82-
"id": "646a1117-3a71-4893-b2a2-13675cf749c7",
82+
"id": "5",
8383
"metadata": {},
8484
"outputs": [],
8585
"source": [
@@ -89,7 +89,7 @@
8989
{
9090
"cell_type": "code",
9191
"execution_count": null,
92-
"id": "8de3d6e0-b8ec-4a25-bcb0-b0d2b19b8a61",
92+
"id": "6",
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
@@ -99,7 +99,7 @@
9999
{
100100
"cell_type": "code",
101101
"execution_count": null,
102-
"id": "04f7f83c-8608-458d-b4a9-2f9853c09cd7",
102+
"id": "7",
103103
"metadata": {},
104104
"outputs": [],
105105
"source": [
@@ -108,7 +108,7 @@
108108
},
109109
{
110110
"cell_type": "markdown",
111-
"id": "84f8b41c-e3f3-4282-83c6-e0e424bc5632",
111+
"id": "8",
112112
"metadata": {},
113113
"source": [
114114
"## Removing coherent scattering peaks\n",
@@ -126,7 +126,7 @@
126126
{
127127
"cell_type": "code",
128128
"execution_count": null,
129-
"id": "7140935e-8b32-403f-a0d8-e66293819b40",
129+
"id": "9",
130130
"metadata": {},
131131
"outputs": [],
132132
"source": [
@@ -137,7 +137,7 @@
137137
},
138138
{
139139
"cell_type": "markdown",
140-
"id": "6e530963-258e-475f-9128-2417bc8d7e24",
140+
"id": "10",
141141
"metadata": {},
142142
"source": [
143143
"We need to histogram the data to perform fits:"
@@ -146,7 +146,7 @@
146146
{
147147
"cell_type": "code",
148148
"execution_count": null,
149-
"id": "d6bcd10f-130e-43e0-8231-1f0b70e8bc53",
149+
"id": "11",
150150
"metadata": {},
151151
"outputs": [],
152152
"source": [
@@ -155,7 +155,7 @@
155155
},
156156
{
157157
"cell_type": "markdown",
158-
"id": "1c4ff398-80d4-4452-92d7-3d3c8d1359dc",
158+
"id": "12",
159159
"metadata": {},
160160
"source": [
161161
"The fits require a bin-center coordinate, so convert from bin-edges:"
@@ -164,7 +164,7 @@
164164
{
165165
"cell_type": "code",
166166
"execution_count": null,
167-
"id": "e661fda9-1de4-4d26-a8d7-c84cec10decd",
167+
"id": "13",
168168
"metadata": {},
169169
"outputs": [],
170170
"source": [
@@ -174,7 +174,7 @@
174174
},
175175
{
176176
"cell_type": "markdown",
177-
"id": "b0bbf51f-307f-43c5-8093-ff6606049a1f",
177+
"id": "14",
178178
"metadata": {},
179179
"source": [
180180
"Perform the fits:"
@@ -183,7 +183,7 @@
183183
{
184184
"cell_type": "code",
185185
"execution_count": null,
186-
"id": "49f574d8-de6f-4c69-9704-6ce4acb9bdb3",
186+
"id": "15",
187187
"metadata": {},
188188
"outputs": [],
189189
"source": [
@@ -192,7 +192,7 @@
192192
},
193193
{
194194
"cell_type": "markdown",
195-
"id": "19251c69-75eb-4dd0-be97-d2272946bacd",
195+
"id": "16",
196196
"metadata": {},
197197
"source": [
198198
"Remove the fitted peaks to obtain the incoherent scattering.\n",
@@ -207,7 +207,7 @@
207207
{
208208
"cell_type": "code",
209209
"execution_count": null,
210-
"id": "fbcde35f-8608-4ecb-9b6d-67f686d7839a",
210+
"id": "17",
211211
"metadata": {},
212212
"outputs": [],
213213
"source": [
@@ -218,7 +218,7 @@
218218
},
219219
{
220220
"cell_type": "markdown",
221-
"id": "6f19a754-c41a-4507-9ac5-a9f68dbab60f",
221+
"id": "18",
222222
"metadata": {},
223223
"source": [
224224
"We can further inspect the results.\n",
@@ -251,7 +251,7 @@
251251
{
252252
"cell_type": "code",
253253
"execution_count": null,
254-
"id": "0fd4e65a-35b3-4c12-a4ee-24649bda2551",
254+
"id": "19",
255255
"metadata": {},
256256
"outputs": [],
257257
"source": [
@@ -277,6 +277,8 @@
277277
" # The actual data\n",
278278
" fig = data.plot(c=\"C0\")\n",
279279
" ax = fig.ax\n",
280+
" xlim = ax.get_xlim()\n",
281+
" ylim = ax.get_ylim()\n",
280282
" removed.plot(ax=ax, c='C2')\n",
281283
"\n",
282284
" # Initial estimates\n",
@@ -314,13 +316,16 @@
314316
" best_fit.data = result.eval_model(best_fit.coords[best_fit.dim])\n",
315317
" best_fit.plot(ax=ax, c=\"C1\", ls=\"-\", marker=\"none\")\n",
316318
"\n",
319+
" ax.set_xlim(xlim)\n",
320+
" # allocate extra space at the top for annotations\n",
321+
" ax.set_ylim((ylim[0], ylim[1] * 1.05))\n",
317322
" return fig"
318323
]
319324
},
320325
{
321326
"cell_type": "code",
322327
"execution_count": null,
323-
"id": "bee3ae5a-ae4c-41a8-901b-b0fada19504c",
328+
"id": "20",
324329
"metadata": {},
325330
"outputs": [],
326331
"source": [
@@ -335,7 +340,7 @@
335340
{
336341
"cell_type": "code",
337342
"execution_count": null,
338-
"id": "fa420140-073c-4104-b9aa-990190f9bd4f",
343+
"id": "21",
339344
"metadata": {},
340345
"outputs": [],
341346
"source": [
@@ -350,7 +355,7 @@
350355
},
351356
{
352357
"cell_type": "markdown",
353-
"id": "6bab60d1-1ea9-4481-9f5c-1d55423766c7",
358+
"id": "22",
354359
"metadata": {},
355360
"source": [
356361
"The resulting data array `incoherent` can be saved and used in the main workflow [POWGEN_data_reduction](./POWGEN_data_reduction.rst) to replace `FocussedDataDspacing[VanadiumRun]`."

0 commit comments

Comments
 (0)