|
15 | 15 | "metadata": {}, |
16 | 16 | "outputs": [], |
17 | 17 | "source": [ |
| 18 | + "%matplotlib ipympl\n", |
| 19 | + "import plopp as pp\n", |
18 | 20 | "import scippneutron as scn\n", |
19 | 21 | "\n", |
20 | 22 | "from ess.beer import BeerModMcStasWorkflow, BeerModMcStasWorkflowKnownPeaks\n", |
|
159 | 161 | "outputs": [], |
160 | 162 | "source": [ |
161 | 163 | "wf = BeerModMcStasWorkflowKnownPeaks()\n", |
| 164 | + "wf[DetectorBank] = 2\n", |
162 | 165 | "wf[Filename[SampleRun]] = mcstas_silicon_medium_resolution()\n", |
163 | | - "wf.compute(RawDetector[SampleRun])['bank1'].hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 166 | + "da = wf.compute(RawDetector[SampleRun])\n", |
| 167 | + "da.masks.clear()\n", |
| 168 | + "da.hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
164 | 169 | ] |
165 | 170 | }, |
166 | 171 | { |
|
179 | 184 | "outputs": [], |
180 | 185 | "source": [ |
181 | 186 | "wf[DHKLList] = silicon_peaks_array()\n", |
182 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
183 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
184 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), silicon_peaks_array())" |
| 187 | + "wf[Filename[SampleRun]] = mcstas_silicon_medium_resolution()\n", |
| 188 | + "\n", |
| 189 | + "results = {}\n", |
| 190 | + "for bank in (1, 2):\n", |
| 191 | + " wf[DetectorBank] = bank\n", |
| 192 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 193 | + " results[bank] = (\n", |
| 194 | + " da\n", |
| 195 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 196 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 197 | + " )\n", |
| 198 | + "\n", |
| 199 | + "ground_truth_peak_positions(pp.plot(results), silicon_peaks_array())" |
185 | 200 | ] |
186 | 201 | }, |
187 | 202 | { |
|
201 | 216 | "source": [ |
202 | 217 | "wf = BeerModMcStasWorkflow()\n", |
203 | 218 | "wf[Filename[SampleRun]] = mcstas_silicon_medium_resolution()\n", |
204 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
205 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
206 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), silicon_peaks_array())" |
| 219 | + "\n", |
| 220 | + "results = {}\n", |
| 221 | + "for bank in (1, 2):\n", |
| 222 | + " wf[DetectorBank] = bank\n", |
| 223 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 224 | + " results[bank] = (\n", |
| 225 | + " da\n", |
| 226 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 227 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 228 | + " )\n", |
| 229 | + "\n", |
| 230 | + "\n", |
| 231 | + "ground_truth_peak_positions(pp.plot(results), silicon_peaks_array())" |
207 | 232 | ] |
208 | 233 | }, |
209 | 234 | { |
|
223 | 248 | "metadata": {}, |
224 | 249 | "outputs": [], |
225 | 250 | "source": [ |
226 | | - "da = da['bank2'].copy()\n", |
227 | 251 | "da.masks.clear()\n", |
228 | 252 | "da.bins.masks['too_far_from_center'] = ~da.bins.masks.pop('too_far_from_center')\n", |
229 | | - "\n", |
230 | | - "da.bins.concat().hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 253 | + "da.bins.concat().hist(two_theta=400, event_time_offset=400).plot(norm='log', cmin=1.0e-3)" |
231 | 254 | ] |
232 | 255 | }, |
233 | 256 | { |
|
254 | 277 | "outputs": [], |
255 | 278 | "source": [ |
256 | 279 | "wf = BeerModMcStasWorkflowKnownPeaks()\n", |
| 280 | + "wf[DetectorBank] = 1\n", |
257 | 281 | "wf[Filename[SampleRun]] = mcstas_duplex(8)\n", |
258 | | - "wf.compute(RawDetector[SampleRun])['bank1'].hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-2)" |
| 282 | + "wf.compute(RawDetector[SampleRun]).hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-2)" |
259 | 283 | ] |
260 | 284 | }, |
261 | 285 | { |
|
274 | 298 | "outputs": [], |
275 | 299 | "source": [ |
276 | 300 | "wf[DHKLList] = duplex_peaks_array()\n", |
277 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
278 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
279 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 301 | + "\n", |
| 302 | + "results = {}\n", |
| 303 | + "for bank in (1, 2):\n", |
| 304 | + " wf[DetectorBank] = bank\n", |
| 305 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 306 | + " results[bank] = (\n", |
| 307 | + " da\n", |
| 308 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 309 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 310 | + " )\n", |
| 311 | + "\n", |
| 312 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
280 | 313 | ] |
281 | 314 | }, |
282 | 315 | { |
|
296 | 329 | "source": [ |
297 | 330 | "wf = BeerModMcStasWorkflow()\n", |
298 | 331 | "wf[Filename[SampleRun]] = mcstas_duplex(8)\n", |
299 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
300 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
301 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 332 | + "\n", |
| 333 | + "results = {}\n", |
| 334 | + "for bank in (1, 2):\n", |
| 335 | + " wf[DetectorBank] = bank\n", |
| 336 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 337 | + " results[bank] = (\n", |
| 338 | + " da\n", |
| 339 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 340 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 341 | + " )\n", |
| 342 | + "\n", |
| 343 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
302 | 344 | ] |
303 | 345 | }, |
304 | 346 | { |
|
318 | 360 | "metadata": {}, |
319 | 361 | "outputs": [], |
320 | 362 | "source": [ |
321 | | - "da = da['bank2'].copy()\n", |
322 | 363 | "da.masks.clear()\n", |
323 | 364 | "da.bins.masks['too_far_from_center'] = ~da.bins.masks.pop('too_far_from_center')\n", |
324 | 365 | "\n", |
325 | | - "da.bins.concat().hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 366 | + "da.bins.concat().hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
326 | 367 | ] |
327 | 368 | }, |
328 | 369 | { |
|
349 | 390 | "outputs": [], |
350 | 391 | "source": [ |
351 | 392 | "wf = BeerModMcStasWorkflowKnownPeaks()\n", |
| 393 | + "wf[DetectorBank] = 1\n", |
352 | 394 | "wf[Filename[SampleRun]] = mcstas_duplex(9)\n", |
353 | | - "wf.compute(RawDetector[SampleRun])['bank1'].hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 395 | + "wf.compute(RawDetector[SampleRun]).hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
354 | 396 | ] |
355 | 397 | }, |
356 | 398 | { |
|
369 | 411 | "outputs": [], |
370 | 412 | "source": [ |
371 | 413 | "wf[DHKLList] = duplex_peaks_array()\n", |
372 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
373 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
374 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 414 | + "\n", |
| 415 | + "results = {}\n", |
| 416 | + "for bank in (1, 2):\n", |
| 417 | + " wf[DetectorBank] = bank\n", |
| 418 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 419 | + " results[bank] = (\n", |
| 420 | + " da\n", |
| 421 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 422 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 423 | + " )\n", |
| 424 | + "\n", |
| 425 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
375 | 426 | ] |
376 | 427 | }, |
377 | 428 | { |
|
391 | 442 | "source": [ |
392 | 443 | "wf = BeerModMcStasWorkflow()\n", |
393 | 444 | "wf[Filename[SampleRun]] = mcstas_duplex(9)\n", |
394 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
395 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
396 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 445 | + "\n", |
| 446 | + "results = {}\n", |
| 447 | + "for bank in (1, 2):\n", |
| 448 | + " wf[DetectorBank] = bank\n", |
| 449 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 450 | + " results[bank] = (\n", |
| 451 | + " da\n", |
| 452 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 453 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 454 | + " )\n", |
| 455 | + "\n", |
| 456 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
397 | 457 | ] |
398 | 458 | }, |
399 | 459 | { |
|
413 | 473 | "metadata": {}, |
414 | 474 | "outputs": [], |
415 | 475 | "source": [ |
416 | | - "da = da['bank2'].copy()\n", |
417 | 476 | "da.masks.clear()\n", |
418 | 477 | "da.bins.masks['too_far_from_center'] = ~da.bins.masks.pop('too_far_from_center')\n", |
419 | 478 | "\n", |
420 | | - "da.bins.concat().hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 479 | + "da.bins.concat().hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
421 | 480 | ] |
422 | 481 | }, |
423 | 482 | { |
|
444 | 503 | "outputs": [], |
445 | 504 | "source": [ |
446 | 505 | "wf = BeerModMcStasWorkflowKnownPeaks()\n", |
| 506 | + "wf[DetectorBank] = 1\n", |
447 | 507 | "wf[Filename[SampleRun]] = mcstas_duplex(10)\n", |
448 | | - "wf.compute(RawDetector[SampleRun])['bank1'].hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 508 | + "wf.compute(RawDetector[SampleRun]).hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
449 | 509 | ] |
450 | 510 | }, |
451 | 511 | { |
|
464 | 524 | "outputs": [], |
465 | 525 | "source": [ |
466 | 526 | "wf[DHKLList] = duplex_peaks_array()\n", |
467 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
468 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
469 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 527 | + "\n", |
| 528 | + "results = {}\n", |
| 529 | + "for bank in (1, 2):\n", |
| 530 | + " wf[DetectorBank] = bank\n", |
| 531 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 532 | + " results[bank] = (\n", |
| 533 | + " da\n", |
| 534 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 535 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 536 | + " )\n", |
| 537 | + "\n", |
| 538 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
470 | 539 | ] |
471 | 540 | }, |
472 | 541 | { |
|
486 | 555 | "source": [ |
487 | 556 | "wf = BeerModMcStasWorkflow()\n", |
488 | 557 | "wf[Filename[SampleRun]] = mcstas_duplex(10)\n", |
489 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
490 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
491 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 558 | + "\n", |
| 559 | + "results = {}\n", |
| 560 | + "for bank in (1, 2):\n", |
| 561 | + " wf[DetectorBank] = bank\n", |
| 562 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 563 | + " results[bank] = (\n", |
| 564 | + " da\n", |
| 565 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 566 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 567 | + " )\n", |
| 568 | + "\n", |
| 569 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
492 | 570 | ] |
493 | 571 | }, |
494 | 572 | { |
|
508 | 586 | "metadata": {}, |
509 | 587 | "outputs": [], |
510 | 588 | "source": [ |
511 | | - "da = da['bank2'].copy()\n", |
512 | 589 | "da.masks.clear()\n", |
513 | 590 | "da.bins.masks['too_far_from_center'] = ~da.bins.masks.pop('too_far_from_center')\n", |
514 | 591 | "\n", |
515 | | - "da.bins.concat().hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 592 | + "da.bins.concat().hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
516 | 593 | ] |
517 | 594 | }, |
518 | 595 | { |
|
539 | 616 | "outputs": [], |
540 | 617 | "source": [ |
541 | 618 | "wf = BeerModMcStasWorkflowKnownPeaks()\n", |
| 619 | + "wf[DetectorBank] = 1\n", |
542 | 620 | "wf[Filename[SampleRun]] = mcstas_duplex(16)\n", |
543 | | - "wf.compute(RawDetector[SampleRun])['bank1'].hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 621 | + "wf.compute(RawDetector[SampleRun]).hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
544 | 622 | ] |
545 | 623 | }, |
546 | 624 | { |
|
559 | 637 | "outputs": [], |
560 | 638 | "source": [ |
561 | 639 | "wf[DHKLList] = duplex_peaks_array()\n", |
562 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
563 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
564 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 640 | + "\n", |
| 641 | + "results = {}\n", |
| 642 | + "for bank in (1, 2):\n", |
| 643 | + " wf[DetectorBank] = bank\n", |
| 644 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 645 | + " results[bank] = (\n", |
| 646 | + " da\n", |
| 647 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 648 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 649 | + " )\n", |
| 650 | + "\n", |
| 651 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
565 | 652 | ] |
566 | 653 | }, |
567 | 654 | { |
|
581 | 668 | "source": [ |
582 | 669 | "wf = BeerModMcStasWorkflow()\n", |
583 | 670 | "wf[Filename[SampleRun]] = mcstas_duplex(16)\n", |
584 | | - "da = wf.compute(TofDetector[SampleRun])\n", |
585 | | - "da = da.transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
586 | | - "ground_truth_peak_positions(da.hist(dspacing=dspacing, dim=da.dims).plot(), duplex_peaks_array())" |
| 671 | + "\n", |
| 672 | + "results = {}\n", |
| 673 | + "for bank in (1, 2):\n", |
| 674 | + " wf[DetectorBank] = bank\n", |
| 675 | + " da = wf.compute(TofDetector[SampleRun])\n", |
| 676 | + " results[bank] = (\n", |
| 677 | + " da\n", |
| 678 | + " .transform_coords(('dspacing',), graph=scn.conversion.graph.tof.elastic('tof'),)\n", |
| 679 | + " .hist(dspacing=dspacing, dim=da.dims)\n", |
| 680 | + " )\n", |
| 681 | + "\n", |
| 682 | + "ground_truth_peak_positions(pp.plot(results), duplex_peaks_array())" |
587 | 683 | ] |
588 | 684 | }, |
589 | 685 | { |
|
603 | 699 | "metadata": {}, |
604 | 700 | "outputs": [], |
605 | 701 | "source": [ |
606 | | - "da = da['bank2'].copy()\n", |
607 | 702 | "da.masks.clear()\n", |
608 | 703 | "da.bins.masks['too_far_from_center'] = ~da.bins.masks.pop('too_far_from_center')\n", |
609 | 704 | "\n", |
610 | | - "da.bins.concat().hist(two_theta=1000, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
| 705 | + "da.bins.concat().hist(two_theta=400, event_time_offset=1000).plot(norm='log', cmin=1.0e-3)" |
611 | 706 | ] |
612 | 707 | } |
613 | 708 | ], |
|
627 | 722 | "name": "python", |
628 | 723 | "nbconvert_exporter": "python", |
629 | 724 | "pygments_lexer": "ipython3", |
630 | | - "version": "3.12.7" |
| 725 | + "version": "3.11.13" |
631 | 726 | } |
632 | 727 | }, |
633 | 728 | "nbformat": 4, |
|
0 commit comments