Skip to content

Commit 3c9f8b2

Browse files
authored
Merge pull request #67 from scipp/require-chopper-name
Require name for Chopper constructor
2 parents f574d3b + 7415c98 commit 3c9f8b2

12 files changed

+215
-191
lines changed

.pre-commit-config.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-added-large-files
66
- id: check-json
@@ -14,41 +14,41 @@ repos:
1414
args: [ --markdown-linebreak-ext=md ]
1515
exclude: '\.svg'
1616
- repo: https://github.com/pycqa/isort
17-
rev: 5.12.0
17+
rev: 5.13.0
1818
hooks:
1919
- id: isort
2020
name: isort (python)
2121
- repo: https://github.com/psf/black
22-
rev: 23.1.0
22+
rev: 24.10.0
2323
hooks:
2424
- id: black
2525
- repo: https://github.com/kynan/nbstripout
26-
rev: 0.6.0
26+
rev: 0.8.1
2727
hooks:
2828
- id: nbstripout
2929
types: [ "jupyter" ]
3030
args: [ "--drop-empty-cells",
3131
"--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ]
3232
- repo: https://github.com/pycqa/flake8
33-
rev: 4.0.1
33+
rev: 7.1.1
3434
hooks:
3535
- id: flake8
3636
types: ["python"]
37-
additional_dependencies: ["flake8-bugbear==22.10.27"]
37+
additional_dependencies: ["flake8-bugbear==24.10.31"]
3838
- repo: https://github.com/pycqa/bandit
39-
rev: 1.7.4
39+
rev: 1.8.0
4040
hooks:
4141
- id: bandit
4242
additional_dependencies: ["bandit[toml]"]
4343
args: ["-c", "pyproject.toml"]
4444
- repo: https://github.com/codespell-project/codespell
45-
rev: v2.2.2
45+
rev: v2.3.0
4646
hooks:
4747
- id: codespell
4848
additional_dependencies:
4949
- tomli
5050
- repo: https://github.com/pre-commit/pygrep-hooks
51-
rev: v1.9.0
51+
rev: v1.10.0
5252
hooks:
5353
- id: python-no-eval
5454
exclude: "object_list.py"

docs/components.ipynb

+34-34
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "32ad7110-b627-4e52-b014-a70ad3d5193a",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Component guide\n",
@@ -14,7 +14,7 @@
1414
{
1515
"cell_type": "code",
1616
"execution_count": null,
17-
"id": "1d69bb0a-4b4d-47c6-9465-318c21e72e7c",
17+
"id": "1",
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"cell_type": "markdown",
32-
"id": "0543c13d-847d-4642-8736-14a75ed5fd01",
32+
"id": "2",
3333
"metadata": {},
3434
"source": [
3535
"We begin by making a source pulse using the profile from ESS."
@@ -38,7 +38,7 @@
3838
{
3939
"cell_type": "code",
4040
"execution_count": null,
41-
"id": "35b39244-c45b-4bdb-8138-7d0e56a40478",
41+
"id": "3",
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
@@ -48,7 +48,7 @@
4848
},
4949
{
5050
"cell_type": "markdown",
51-
"id": "3c6ecb82-a47f-4f66-a067-9224e9d67be9",
51+
"id": "4",
5252
"metadata": {},
5353
"source": [
5454
"## Adding a detector\n",
@@ -60,11 +60,11 @@
6060
{
6161
"cell_type": "code",
6262
"execution_count": null,
63-
"id": "e2ced2be-d642-4886-9281-37cd90102c31",
63+
"id": "5",
6464
"metadata": {},
6565
"outputs": [],
6666
"source": [
67-
"detector = tof.Detector(distance=30.0 * meter)\n",
67+
"detector = tof.Detector(distance=30.0 * meter, name='detector')\n",
6868
"\n",
6969
"# Build the instrument model\n",
7070
"model = tof.Model(source=source, detectors=[detector])\n",
@@ -74,7 +74,7 @@
7474
{
7575
"cell_type": "code",
7676
"execution_count": null,
77-
"id": "75dd1359-d990-482c-b0d6-4a0ae094b0fc",
77+
"id": "6",
7878
"metadata": {},
7979
"outputs": [],
8080
"source": [
@@ -85,7 +85,7 @@
8585
},
8686
{
8787
"cell_type": "markdown",
88-
"id": "a2c80ee1-5729-4a09-88c0-3c4e04610772",
88+
"id": "7",
8989
"metadata": {},
9090
"source": [
9191
"As expected, the detector sees all the neutrons from the pulse.\n",
@@ -96,7 +96,7 @@
9696
{
9797
"cell_type": "code",
9898
"execution_count": null,
99-
"id": "112124d4-689b-408a-9be6-de1bef8a6205",
99+
"id": "8",
100100
"metadata": {},
101101
"outputs": [],
102102
"source": [
@@ -105,7 +105,7 @@
105105
},
106106
{
107107
"cell_type": "markdown",
108-
"id": "34267819-4f83-48c6-b51b-9f13742ac3da",
108+
"id": "9",
109109
"metadata": {},
110110
"source": [
111111
"The data itself is available via the `.toas`, `.wavelengths`, `.birth_times`, and `.speeds` properties,\n",
@@ -119,7 +119,7 @@
119119
{
120120
"cell_type": "code",
121121
"execution_count": null,
122-
"id": "bbda2581-ebfa-44ce-ae58-1f4f2db832d9",
122+
"id": "10",
123123
"metadata": {},
124124
"outputs": [],
125125
"source": [
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"cell_type": "markdown",
131-
"id": "89ad197a-4304-4cff-a332-e865a2c93f43",
131+
"id": "11",
132132
"metadata": {},
133133
"source": [
134134
"## Adding a chopper\n",
@@ -141,7 +141,7 @@
141141
{
142142
"cell_type": "code",
143143
"execution_count": null,
144-
"id": "e7e49cac-affd-4c01-860f-03934bc348e9",
144+
"id": "12",
145145
"metadata": {},
146146
"outputs": [],
147147
"source": [
@@ -166,7 +166,7 @@
166166
},
167167
{
168168
"cell_type": "markdown",
169-
"id": "6893e0a2-70c9-424f-aeb2-aac010fc02bd",
169+
"id": "13",
170170
"metadata": {},
171171
"source": [
172172
"We can directly set this on our existing model, and re-run the simulation."
@@ -175,7 +175,7 @@
175175
{
176176
"cell_type": "code",
177177
"execution_count": null,
178-
"id": "48909c2a-51e8-4532-a8eb-7c7bbba7544d",
178+
"id": "14",
179179
"metadata": {},
180180
"outputs": [],
181181
"source": [
@@ -186,7 +186,7 @@
186186
},
187187
{
188188
"cell_type": "markdown",
189-
"id": "3155b564-12e1-4d06-a2dd-d376314713f4",
189+
"id": "15",
190190
"metadata": {},
191191
"source": [
192192
"As expected, the two openings now create two bursts of neutrons,\n",
@@ -198,7 +198,7 @@
198198
{
199199
"cell_type": "code",
200200
"execution_count": null,
201-
"id": "94bc5f13-4e58-4ae4-ba15-86078ab8311d",
201+
"id": "16",
202202
"metadata": {},
203203
"outputs": [],
204204
"source": [
@@ -207,7 +207,7 @@
207207
},
208208
{
209209
"cell_type": "markdown",
210-
"id": "7ce2e25e-e21f-442b-b729-9b1c7a97893b",
210+
"id": "17",
211211
"metadata": {},
212212
"source": [
213213
"we notice that the chopper sees all the incoming neutrons,\n",
@@ -219,7 +219,7 @@
219219
{
220220
"cell_type": "code",
221221
"execution_count": null,
222-
"id": "90341882-625a-432d-8625-3d0850403f85",
222+
"id": "18",
223223
"metadata": {},
224224
"outputs": [],
225225
"source": [
@@ -228,7 +228,7 @@
228228
},
229229
{
230230
"cell_type": "markdown",
231-
"id": "68e35c62-6072-47b1-8c3e-e610826da008",
231+
"id": "19",
232232
"metadata": {},
233233
"source": [
234234
"## Multiple choppers\n",
@@ -241,7 +241,7 @@
241241
{
242242
"cell_type": "code",
243243
"execution_count": null,
244-
"id": "ac5f9697-a2a6-45a8-ad99-af6ad1a60be7",
244+
"id": "20",
245245
"metadata": {},
246246
"outputs": [],
247247
"source": [
@@ -269,7 +269,7 @@
269269
},
270270
{
271271
"cell_type": "markdown",
272-
"id": "62d721c5-3c3e-457c-ab05-60659fccdaaa",
272+
"id": "21",
273273
"metadata": {},
274274
"source": [
275275
"The distribution of neutrons that are blocked and pass through the second chopper looks as follows:"
@@ -278,7 +278,7 @@
278278
{
279279
"cell_type": "code",
280280
"execution_count": null,
281-
"id": "ab11bd09-73ba-4bf8-9b52-e503d77f3f5c",
281+
"id": "22",
282282
"metadata": {},
283283
"outputs": [],
284284
"source": [
@@ -287,7 +287,7 @@
287287
},
288288
{
289289
"cell_type": "markdown",
290-
"id": "09d6cbef-f2f3-48db-a696-b4ed912817c8",
290+
"id": "23",
291291
"metadata": {},
292292
"source": [
293293
"while the detector now sees 4 peaks"
@@ -296,7 +296,7 @@
296296
{
297297
"cell_type": "code",
298298
"execution_count": null,
299-
"id": "20349f5e-bfd3-4ccb-bde4-119f3e3d423a",
299+
"id": "24",
300300
"metadata": {},
301301
"outputs": [],
302302
"source": [
@@ -305,7 +305,7 @@
305305
},
306306
{
307307
"cell_type": "markdown",
308-
"id": "55c8ca14-e885-43b2-8409-48c1eb964625",
308+
"id": "25",
309309
"metadata": {},
310310
"source": [
311311
"To view the blocked rays on the time-distance diagram of the model, use"
@@ -314,7 +314,7 @@
314314
{
315315
"cell_type": "code",
316316
"execution_count": null,
317-
"id": "a3e040c6-afee-495f-a32f-7fdcad506df1",
317+
"id": "26",
318318
"metadata": {},
319319
"outputs": [],
320320
"source": [
@@ -323,7 +323,7 @@
323323
},
324324
{
325325
"cell_type": "markdown",
326-
"id": "b3c4a5fb-010b-4d6a-a391-4fb48aa4b1d2",
326+
"id": "27",
327327
"metadata": {},
328328
"source": [
329329
"## Adding a monitor\n",
@@ -335,7 +335,7 @@
335335
{
336336
"cell_type": "code",
337337
"execution_count": null,
338-
"id": "1c8bdc32-583a-4c7c-8c6d-34dab8061c6f",
338+
"id": "28",
339339
"metadata": {},
340340
"outputs": [],
341341
"source": [
@@ -349,7 +349,7 @@
349349
{
350350
"cell_type": "code",
351351
"execution_count": null,
352-
"id": "2f008516-af80-4c55-a6bb-a71a86fa9132",
352+
"id": "29",
353353
"metadata": {},
354354
"outputs": [],
355355
"source": [
@@ -358,7 +358,7 @@
358358
},
359359
{
360360
"cell_type": "markdown",
361-
"id": "021f81eb-42c3-4094-981e-ada20eca3fdb",
361+
"id": "30",
362362
"metadata": {},
363363
"source": [
364364
"## Counter-rotating chopper\n",
@@ -373,7 +373,7 @@
373373
{
374374
"cell_type": "code",
375375
"execution_count": null,
376-
"id": "0e978761-f2de-423e-9e43-a9e664a85a48",
376+
"id": "31",
377377
"metadata": {},
378378
"outputs": [],
379379
"source": [
@@ -402,7 +402,7 @@
402402
{
403403
"cell_type": "code",
404404
"execution_count": null,
405-
"id": "354e87fd-05e4-4237-84d7-3599610e3403",
405+
"id": "32",
406406
"metadata": {},
407407
"outputs": [],
408408
"source": [

0 commit comments

Comments
 (0)