-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.html
1186 lines (958 loc) · 65.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" data-bs-theme="light"> <!-- data-bs-theme="dark/light" -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="online, gamma, spectroscopy, spectrometry, scintillator, mca, open-source, physics, science, web, application, particle-physics, nuclear, radiation, serial, spectrum, radiation, multi-channel analyzer">
<meta name="description" content="Gamma MCA is a free and complete progressive web app for gamma spectroscopy. You can import spectrum files and record new ones using the serial interface.">
<meta name="author" content="NuclearPhoenix">
<meta name="robots" content="index, follow">
<meta name="title" content="Gamma MCA - Gamma-ray spectroscopy">
<meta name="language" content="English">
<!--
CSP: Only allow loading resources from this website.
Style-src: unsafe-inline needed for Plotly.js and bootstrap styles.
Img-src needs data: and blob: otherwise it cannot load some images.
Connect-src is used for fetch (Custom isotope list URL) - * allow all.
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
style-src 'self' 'unsafe-inline';
img-src 'self' data: blob:;
connect-src * ">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon/favicon-16x16.png">
<link rel="mask-icon" href="/assets/favicon/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/assets/favicon/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/assets/favicon/browserconfig.xml">
<meta name="theme-color" content="#f6bd16">
<title>Gamma MCA - Gamma-ray spectroscopy</title>
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="/dist/main.css">
<script type="module" src="/dist/main.bundle.js"></script>
</head>
<body>
<!--
LOADING AND NOSCRIPT ALERT
-->
<div id="loading" class="vh-100 vw-100 fixed-top">
<div id="text-window" class="position-absolute top-50 start-50 translate-middle mx-auto pt-3 pb-3 ps-5 pe-5 text-center border border-2 rounded-2 border-primary bg-body">
<noscript>
<p class="fs-3 text-bg-danger text-center">
This website only works with Javascript enabled! You need to enable it in your browser to be able to use this site!
<br>
Instructions on how to do this can be found <a class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" title="Enable-Javascript.com" href="https://enable-javascript.com/" target="_blank"><here></a>.
</p>
</noscript>
<p class="fs-2">LOADING</p>
<div id="loading-spinner" class="fs-5 spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<div class="vh-100 vw-100 text-bg-dark bg-opacity-75"></div>
</div>
<!--
MAIN PAGE CONTENT
-->
<div class="container-fluid flex-column d-flex vh-100 pb-1 p-1 lh-sm main" id="main"> <!-- pb-1 needed for vertical scroll bar -->
<div class="row border border-1 border-dark border-bottom-0 rounded-top-3 border-mode border-theme">
<div class="col-md-auto p-2 text-center mt-2">
<nav class="nav nav-pills flex-column" id="main-tabs" role="tablist" aria-orientation="vertical">
<button class="nav-link active mb-1 fw-semibold border border-1 rounded-1 border-primary shadow-sm" id="file-import-tab" data-bs-toggle="pill" data-bs-target="#v-file" type="button" role="tab" aria-controls="v-file" aria-selected="true" title="File Import Tab">
<i class="fa-solid fa-file-import"></i> File Control
</button>
<button class="nav-link mb-1 fw-semibold border border-1 rounded-1 border-primary shadow-sm" id="serial-tab" data-bs-toggle="pill" data-bs-target="#v-serial" type="button" role="tab" aria-controls="v-serial" aria-selected="false" title="Serial Connection Tab">
<i class="fa-solid fa-network-wired"></i> Serial Connection
<span class="align-middle border border-light rounded-circle spinner-grow spinner-grow-sm recording-spinner text-danger d-none" role="status">
<span class="visually-hidden">Recording...</span>
</span>
</button>
<button class="nav-link mb-1 fw-semibold border border-1 rounded-1 border-primary shadow-sm d-none" id="sound-tab" data-bs-toggle="pill" data-bs-target="#v-sound" type="button" role="tab" aria-controls="v-sound" aria-selected="false" title="Soundcard Connection Tab (WIP!)" disabled>
<i class="fa-solid fa-microphone"></i> Sound Connection
</button>
<button class="nav-link mb-1 fw-semibold border border-1 rounded-1 border-primary shadow-sm" id="calibration-tab" data-bs-toggle="pill" data-bs-target="#v-calibration" type="button" role="tab" aria-controls="v-calibration" aria-selected="false" title="Calibration Tab">
<i class="fa-solid fa-calculator"></i> Calibration
</button>
<button class="nav-link fw-semibold border border-1 rounded-1 border-primary shadow-sm" id="metadata-tab" data-bs-toggle="pill" data-bs-target="#v-metadata" type="button" role="tab" aria-controls="v-metadata" aria-selected="false" title="Sample Information Tab">
<i class="fa-solid fa-circle-info"></i> Sample Info
</button>
</nav>
<hr>
<button class="btn btn-sm btn-outline-primary rounded-1 w-100 fw-semibold shadow-sm" id="toggle-menu" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas" aria-controls="offcanvas" title="Settings Menu">
<i class="fa-solid fa-gear"></i> Settings
</button>
</div>
<div class="col-md-auto g-0 bg-dark border-theme">
<div class="vr h-100 d-none d-md-block"></div>
<hr class="d-md-none m-0">
</div>
<div class="col-md p-3">
<div class="tab-content h-100">
<div class="tab-pane fade show active h-100" id="v-file" role="tabpanel" aria-labelledby="file-import-tab">
<!--
###############
FILE IMPORT TAB
###############
-->
<div class="row h-100">
<div class="col">
<!--
#####
COL 1
#####
-->
<p>
<label id="data-label" for="data"><strong>Spectrum Data:</strong> <i id="data-icon" class="fa-solid fa-circle-check align-baseline text-primary d-none fa-beat animation-very-slow"></i></label>
</p>
<div class="input-group input-group-sm">
<label for="data" class="btn btn-sm btn-primary" title="Import a file"> <i class="fas fa-file-import"></i> Open File </label>
<label class="cursor-pointer form-control text-truncate" for="data" id="data-form-label">No File Chosen</label>
<button class="btn btn-primary btn-sm" type="button" id="clear-data" title="Remove File"> <i class="fas fa-trash"></i> Clear</button>
</div>
<input class="d-none" type="file" id="data" accept=".csv, .tka, .xml, .txt, .json">
<br>
<p>
<label id="background-label" for="background"><strong>Background Data:</strong> <i id="background-icon" class="fa-solid fa-circle-check align-baseline text-primary d-none fa-beat animation-very-slow"></i></label>
</p>
<div class="input-group input-group-sm">
<label for="background" class="btn btn-sm btn-primary" title="Import a file"> <i class="fas fa-file-import"></i> Open File </label>
<label class="cursor-pointer form-control text-truncate" for="background" id="background-form-label">No File Chosen</label>
<button class="btn btn-primary btn-sm" type="button" id="clear-bg" title="Remove File"> <i class="fas fa-trash"></i> Clear</button>
</div>
<input class="d-none" type="file" id="background" accept=".csv, .tka, .xml, .txt, .json">
<hr>
<p>
<button class="btn btn-primary btn-sm" type="button" data-bs-toggle="modal" data-bs-target="#export-modal" title="Create new file with current data.">
<i class="fa-solid fa-download"></i> Save As
</button>
<button class="btn btn-primary btn-sm" id="overwrite-button" type="button" title="Overwrite file(s) with current data." disabled>
<i class="fa-solid fa-floppy-disk"></i> Save
</button>
</p>
</div>
<div class="col-lg-auto g-0">
<div class="vr h-100 d-none d-lg-block"></div>
<hr class="d-lg-none">
</div>
<div class="col">
<!--
#####
COL 2
#####
-->
<p><strong>File Type (CSV-related only):</strong></p>
<p>
<input id="r1" class="form-check-input" type="radio" value="2" name="filetype">
<label class="form-check-label align-middle" for="r1">Chronological Stream (e.g. serial data)</label>
</p>
<p>
<input id="r2" class="form-check-input" type="radio" value="1" name="filetype" checked="checked">
<label class="form-check-label align-middle" for="r2">Histogram (e.g. CSV, TKA, TXT)</label>
</p>
<hr>
<button class="btn btn-primary btn-sm" type="button" id="print-report" title="Print an analysis report using the current plot (experimental)"> <i class="fa-solid fa-print"></i> Print Report </button>
</div>
</div>
</div>
<div class="tab-pane fade h-100" id="v-serial" role="tabpanel" aria-labelledby="serial-tab">
<!--
#####################
SERIAL CONNECTION TAB
#####################
-->
<div class="alert alert-warning" role="alert" id="serial-error">
<p>Oh no! Looks like neither the <a class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href="https://caniuse.com/web-serial" target="_blank" title="CanIUse? Web Serial API"> Web Serial API</a>,
nor <a class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href="https://caniuse.com/webusb" target="_blank" title="CanIUse? WebUSB">WebUSB</a> are supported in your browser.</p>
<p>Please switch to the latest Chromium-based browser (e.g. Chrome, Edge, etc.) or enable one of the features in your browser's settings if possible.
Otherwise it's not possible to connect to serial devices.</p>
</div>
<div id="serial-div" class="h-100">
<div class="row h-100">
<div class="col">
<!--
#####
COL 1
#####
-->
<p>
<strong>Select Port:</strong>
<span class="badge rounded-pill text-bg-success float-end d-none" id="autosave-badge" title="Last autosaved"></span>
</p>
<div class="input-group input-group-sm">
<button class="btn btn-primary btn-sm" type="button" id="serial-list-btn" title="Refresh List"> <i class="fas fa-sync"></i> </button>
<select class="form-select form-select-sm ser-settings" id="port-selector" aria-label=".form-select-sm example" title="Choose a serial device">
<!-- NOTHING -->
</select>
<button class="btn btn-primary btn-sm" type="button" id="serial-add-device" title="Add new device"> <i class="fas fa-plus"></i> Add </button>
</div>
<br>
<div class="clearfix">
<button class="btn btn-primary btn-sm ser-settings" id="record-button" type="button" data-bs-toggle="modal" data-bs-target="#record-modal" title="Start recording" disabled> <i class="fas fa-play"></i> Record </button>
<button class="btn btn-primary btn-sm ser-settings d-none" id="pause-button" type="button" title="Pause recording"> <i class="fas fa-pause"></i> Pause </button>
<button class="btn btn-primary btn-sm ser-settings d-none" id="resume-button" type="button" title="Resume recording"> <i class="fas fa-play fa-beat-fade"></i> Resume </button>
<button class="btn btn-primary btn-sm" id="stop-button" type="button" title="Stop recording" disabled> <i class="fas fa-stop"></i> Stop </button>
<div class="spinner-grow spinner-grow-sm text-danger align-middle recording-spinner d-none" role="status">
<span class="visually-hidden">Recording...</span>
</div>
<div class="float-end">
<div class="vstack align-middle">
<span class="align-middle fw-bold"><span id="record-time"></span><span id="total-record-time"></span></span>
<div class="progress mt-1" id="ser-time-progress-bar" role="progressbar" title="Serial recording progress" aria-label="Serial recording progress" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar text-bg-primary" id="ser-time-progress"></div>
</div>
</div>
</div>
</div>
<hr>
<div class="clearfix">
<button class="btn btn-primary btn-sm ser-settings" type="button" data-bs-toggle="modal" data-bs-target="#serial-console-modal" title="Serial Console" id="open-console" disabled>
<i class="fa-solid fa-terminal"></i> Console
</button>
<div class="float-end">
<div class="vstack align-middle text-end">
<span class="align-middle fw-bold" id="cps"></span>
<span class="align-middle"><span id="avg-cps"></span><span id="avg-cps-std"></span></span>
</div>
</div>
</div>
</div>
<div class="col-lg-auto g-0">
<div class="vr h-100 d-none d-lg-block"></div>
<hr class="d-lg-none">
</div>
<div class="col">
<!--
#####
COL 2
#####
-->
<p><strong>Data Order:</strong></p>
<p>
<input id="s1" class="form-check-input" type="radio" value="chron" name="serialtype" checked="checked">
<label class="form-check-label align-middle" for="s1">Chronological Mode (serial events in succession)</label>
</p>
<p>
<input id="s2" class="form-check-input" type="radio" value="hist" name="serialtype">
<label class="form-check-label align-middle" for="s2">Histogram Mode (serial data is histogram)</label>
</p>
<hr>
<input type="checkbox" class="btn-check" id="toggle-evolution-chart" disabled>
<label class="btn btn-outline-primary btn-sm" title="Show Evolution Chart" id="toggle-evol-chart-label" for="toggle-evolution-chart"> <i class="fa-solid fa-eye"></i> Show Evolution </label>
<button class="btn btn-primary btn-sm" type="button" id="evolution-download-btn" title="Export the time evolution as CSV"> <i class="fas fa-file-export"></i> Export </button>
</div>
</div>
</div>
</div>
<div class="tab-pane fade h-100" id="v-sound" role="tabpanel" aria-labelledby="sound-tab">
<!--
############################
SOUNDCARD/MIC CONNECTION TAB
############################
-->
<div class="row h-100">
<div class="col">
<!--
#####
COL 1
#####
-->
<p><strong>Work in progress!</strong></p>
<button class="btn btn-primary btn-sm" id="sound-start-btn" type="button">Start</button>
<button class="btn btn-primary btn-sm" id="sound-stop-btn" type="button">Stop</button>
<br><br>
<input type="file" id="audio-input" accept=".wav">
</div>
<div class="col-lg-auto g-0">
<div class="vr h-100 d-none d-lg-block"></div>
<hr class="d-lg-none">
</div>
<div class="col">
<!--
#####
COL 2
#####
-->
<p><strong>Work in progress!</strong></p>
</div>
</div>
</div>
<div class="tab-pane fade h-100" id="v-calibration" role="tabpanel" aria-labelledby="calibration-tab">
<!--
###############
CALIBRATION TAB
###############
-->
<div class="row h-100">
<div class="col">
<!--
#####
COL 1
#####
-->
<p class="text-center fs-6 fw-bold mb-1 text-bg-primary rounded d-none" id="calibration-title">IMPORTED FROM FILE</p>
<form>
<div class="vstack gap-1 calibration-form overflow-y-auto" id="calibration-input">
<div>
<button class="btn btn-primary btn-sm cal-setting" id="add-new-cal-bin" type="button" title="Add an additional bin for energy calibration"><i class="fa-solid fa-circle-plus"></i> Add another bin</button>
</div>
</div>
<hr>
<div class="vstack gap-2">
<div class="hstack gap-1">
<input type="checkbox" class="btn-check" id="apply-cal">
<label class="btn btn-outline-primary btn-sm" title="Toggle plot calibration" id="calibration-label" for="apply-cal"> <i class="fa-solid fa-check"></i> Calibrate </label>
<button class="btn btn-primary btn-sm" type="reset" id="calibration-reset" title="Clear calibration"> <i class="fas fa-trash"></i> Delete</button>
<input type="checkbox" class="btn-check" id="toggle-calibration-chart">
<label class="btn btn-outline-primary btn-sm" title="Show Calibration Chart" id="toggle-cal-chart-label" for="toggle-calibration-chart"> <i class="fa-solid fa-eye"></i> Show Chart </label>
</div>
<div class="hstack gap-1">
<label for="cal-input" class="btn btn-primary btn-sm" title="Import a calibration.json"> <i class="fas fa-file-import"></i> Import </label>
<input id="cal-input" class="visually-hidden" type="file" accept=".json" name="name">
<button class="btn btn-primary btn-sm" type="button" id="calibration-download" title="Export the calibration.json"> <i class="fas fa-file-export"></i> Export </button>
</div>
</div>
</form>
</div>
<div class="col-lg-auto g-0">
<div class="vr h-100 d-none d-lg-block"></div>
<hr class="d-lg-none">
</div>
<div class="col">
<!--
#####
COL 2
#####
-->
<p class="mb-1">Calibration using an <var>n</var>th degree polynomial:</p>
<p class="mb-1"><var>E</var> [keV] = <var>c<sub>n</sub></var> <var>x<sup>n</sup></var> + ... + <var>c<sub>2</sub></var> <var>x</var> + <var>c<sub>1</sub></var> (<var>x</var> ... Bin Number)</p>
<hr>
<p>Coefficients will be computed automatically:</p>
<div class="calibration-form overflow-y-auto" id="energy-cal-coeff-list"></div>
</div>
</div>
</div>
<div class="tab-pane fade h-100" id="v-metadata" role="tabpanel" aria-labelledby="metadata-tab">
<!--
############
METADATA TAB
############
-->
<div class="row h-100">
<div class="col">
<!--
#####
COL 1
#####
-->
<p><strong>Sample Information</strong></p>
<div class="vstack gap-2">
<div class="input-group input-group-sm">
<label class="input-group-text w-25" for="sample-name">Name</label>
<input type="text" class="form-control sample-info" id="sample-name" aria-label="Sample name" placeholder="Name of sample">
</div>
<div class="input-group input-group-sm">
<label class="input-group-text w-25" for="sample-loc">Location</label>
<input type="text" class="form-control sample-info" id="sample-loc" aria-label="Sample location" placeholder="Location of sample">
</div>
<div class="input-group input-group-sm">
<label class="input-group-text w-25" for="sample-time">Time</label>
<input type="datetime-local" class="form-control sample-info" id="sample-time" aria-label="Sample time">
</div>
<div class="input-group input-group-sm">
<label class="input-group-text w-25" for="sample-weight">Weight</label>
<input type="number" min="0" step="0.1" class="form-control sample-info" id="sample-weight" aria-label="Sample weight" placeholder="Sample weight [g]">
</div>
<div class="input-group input-group-sm">
<label class="input-group-text w-25" for="sample-vol">Volume</label>
<input type="number" min="0" step="0.1" class="form-control sample-info" id="sample-vol" aria-label="Sample volume" placeholder="Sample volume [cm^3]">
</div>
</div>
</div>
<div class="col-lg-auto g-0">
<div class="vr h-100 d-none d-lg-block"></div>
<hr class="d-lg-none">
</div>
<div class="col">
<!--
#####
COL 2
#####
-->
<p><strong>Device Information</strong></p>
<div class="input-group input-group-sm mb-2">
<label class="input-group-text" for="device-name">Device Name</label>
<input type="text" class="form-control sample-info" id="device-name" aria-label="Recording device name" placeholder="Recording device name">
</div>
<div class="form-floating h-50">
<textarea class="form-control sample-info h-100" placeholder="Leave additional notes here" id="add-notes"></textarea>
<label for="add-notes">Additional notes</label>
</div>
<div class="mt-2 mb-3 d-flex">
<small class="flex-fill me-1">This data will only be saved to JSON or XML exports.</small>
<button class="btn btn-primary btn-sm text-nowrap" type="reset" id="reset-meta-values" title="Clear all sample tags"> <i class="fas fa-trash"></i> Clear All</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-auto g-0 bg-dark border-theme">
<div class="vr h-100 d-none d-md-block"></div>
<hr class="d-md-none m-0">
</div>
<div class="col-md-2 p-2 mt-2">
<div id="static-info">
<strong>Click Position:</strong>
<p><span id="click-data">None</span></p>
<hr>
<strong>Spectrum:</strong>
<p class="mb-1"><span id="total-spec-cts">0</span> cts</p>
<p class="mt-1 mb-2"><span id="spec-time">00:00:00</span></p>
<strong>Background:</strong>
<p class="mb-1"><span id="total-bg-cts">0</span> cts</p>
<p class="mt-1 mb-2"><span id="bg-time">00:00:00</span></p>
</div>
<div id="roi-info" class="d-none">
<h2 class="fs-4">ROI</h2>
<strong>Range:</strong>
<p class="mt-1 mb-3"><span id="roi-range">N/A</span> <span id="roi-range-unit">N/A</span></p>
<strong>Counts:</strong>
<p class="mb-1">Total: <span id="total-counts">N/A</span> cts</p>
<p class="mb-1">Net: <span id="net-counts">N/A</span> cts</p>
<p class="mb-1">Background: <span id="bg-counts">N/A</span> cts</p>
<p class="mt-1 mb-3">BG ratio: <span id="bg-ratio">N/A</span> %</p>
</div>
</div>
</div>
<div id="plot-tab" class="row flex-grow-1 plot-div border border-1 border-dark border-theme"> <!-- flex-fill -->
<div class="col p-1">
<!--
PLOT DIV
-->
<div class="w-100 h-100" id="plot"></div>
</div>
</div>
<div class="row border border-top-0 border-1 border-dark rounded-bottom-3 border-mode border-theme p-1 d-flex justify-content-center">
<div class="col-auto p-1">
<button class="btn btn-primary btn-sm" type="button" id="reset-plot" title="Reset plot settings"> <i class="fas fa-redo"></i> Reset Plot </button>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<div class="input-group input-group-sm">
<span class="input-group-text">X</span>
<button class="btn btn-primary btn-sm" type="button" id="xAxis" title="Toggle x-axis scale">Linear</button>
</div>
</div>
<div class="col-auto p-1">
<div class="input-group input-group-sm">
<span class="input-group-text">Y</span>
<button class="btn btn-primary btn-sm" type="button" id="yAxis" title="Toggle y-axis scale">Linear</button>
</div>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<div class="input-group input-group-sm">
<label class="input-group-text" for="sma-val">SMA Length</label>
<input class="form-control form-control-sm" type="number" id="sma-val" min="1" max="1000" value="" title="Width of simple moving average">
<input type="checkbox" class="btn-check" id="sma">
<label class="btn btn-outline-primary" id="sma-label" for="sma" title="Toggle simple moving average">Enable</label>
</div>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<div class="input-group input-group-sm">
<span class="input-group-text">Type</span>
<button class="btn btn-primary btn-sm" type="button" id="plot-type" title="Switch plot type"><i class="fas fa-chart-bar"></i> Bar</button>
</div>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<div class="input-group input-group-sm">
<span class="input-group-text">Counts</span>
<button class="btn btn-primary btn-sm" type="button" id="plot-cps" title="Switch total or counts per second"> Total </button>
</div>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<div class="input-group input-group-sm">
<span class="input-group-text">Peaks</span>
<button class="btn btn-primary btn-sm" type="button" id="peak-finder-btn" title="Toggle between Gaussian Correlation Filter, energy and isotope peak finder">None</button>
</div>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<input type="checkbox" class="btn-check" id="iso-hover">
<label class="btn btn-outline-primary btn-sm" title="Show closest isotope when hovering" id="iso-hover-label" for="iso-hover"> <i class="fa-solid fa-magnifying-glass"></i> Isotopes </label>
</div>
<div class="col-auto ps-1 pe-1">
<div class="vr h-100 d-none d-sm-block"></div>
</div>
<div class="col-auto p-1">
<input type="checkbox" class="btn-check" id="enhance-eff">
<label class="btn btn-outline-primary btn-sm" title="Rough qualitative enhancement of the detector efficiency (experimental)" id="enhance-eff-label" for="enhance-eff"> <i class="fa-solid fa-signal"></i> Efficiency </label>
</div>
</div>
</div>
<!--
BOOTSTRAP MODALS FOR SELECTION SCREENS, SERIAL CONSOLE, ...
-->
<!-- Record Modal -->
<div class="modal fade" id="record-modal" tabindex="-1" aria-labelledby="record-modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4"><i class="fas fa-play me-2 fa-beat-fade animation-very-slow"></i>Record Spectrum</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><strong>What do you want to record?</strong></p>
<p>You can either record an energy spectrum or a background energy spectrum. This will change the way the data is plotted and saved.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary ser-settings" data-bs-dismiss="modal" title="Record energy spectrum" id="record-spectrum-btn"> Spectrum </button>
<button type="button" class="btn btn-primary ser-settings" data-bs-dismiss="modal" title="Record background energy spectrum" id="record-bg-btn"> Background </button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Cancel </button>
</div>
</div>
</div>
</div>
<!-- Export Modal -->
<div class="modal fade" id="export-modal" tabindex="-1" aria-labelledby="export-modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4"><i class="fa-solid fa-download me-2 fa-beat-fade animation-very-slow"></i>Save File</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><strong>What do you want to save?</strong></p>
<p>You can either choose to use one of the combined file types (JSON, XML) or just plain CSVs for the spectrum or background spectrum.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" id="npes-export-btn" title="Export all data as combined JSON (NPES), recommended"> JSON </button>
<button type="button" class="btn btn-primary" id="xml-export-btn" title="Export all data as combined XML, deprecated"> XML </button>
<button type="button" class="btn btn-primary" id="download-spectrum-btn" title="Export spectrum as CSV"> Spectrum </button>
<button type="button" class="btn btn-primary" id="download-bg-btn" title="Export background as CSV"> Background </button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Cancel </button>
</div>
</div>
</div>
</div>
<!-- Serial Console Modal -->
<div class="modal fade" id="serial-console-modal" tabindex="-1" aria-labelledby="serial-console-modal" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4 flex-fill">Serial Console <span id="serial-console-title"></span></h2>
<div class="g-1 pe-2">
<input type="checkbox" class="btn-check" id="autoscroll-console">
<label class="btn btn-sm btn-primary" for="autoscroll-console" title="Toggle Autoscroll"><i class="fa-solid fa-angles-down"></i></label>
<button type="button" class="btn btn-sm btn-outline-primary" id="reconnect-console-log" title="Reconnect Console (stops all recordings!)"><i class="fa-solid fa-rotate"></i></button>
<button type="button" class="btn btn-sm btn-outline-primary" id="clear-console-log" title="Clear Console History"><i class="fa-solid fa-trash"></i></button>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<br>
<div class="input-group input-group-md p-2">
<label class="input-group-text" for="ser-command"> <i class="fa-solid fa-terminal"></i> </label>
<input type="text" class="form-control" id="ser-command" spellcheck="false">
<button type="button" class="btn btn-primary ser-settings" id="send-command"> <i class="fa-solid fa-share"></i> Send </button>
</div>
<hr>
<div class="modal-body">
<p class="font-monospace text-nowrap ps-1 pe-1" id="ser-output"></p> <!-- text-break -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Close </button>
</div>
</div>
</div>
</div>
<!-- File Import Error Modal -->
<div class="modal fade" id="import-error-modal" data-bs-backdrop="static" tabindex="-1" aria-labelledby="import-error-modal" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4"><i class="fas fa-exclamation-triangle fa-shake me-2 animation-very-slow"></i>Import Error</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><strong>An error occured when trying to import the following file:</strong></p>
<div class="alert alert-danger" role="alert">
<p><strong><code id="error-filename"></code></strong></p>
<p><strong>ERROR CODE: </strong><span id="error-code">ERROR_CODE</span></p>
<p id="error-desc">File does not import.</p>
</div>
<p>There probably is an error with the file formatting. Either it is not valid JSON, or it does not comply with the NPES formatting schema. If the file was generated using a different program, please contact the developers <i class="fa-regular fa-face-smile"></i></p>
<p>For more information about the schema, please head to <a title="GitHub/NPES-JSON" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href="https://github.com/OpenGammaProject/NPES-JSON" target="_blank">NPES-JSON</a>.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Close </button>
</div>
</div>
</div>
</div>
<!-- File Import Spectrum Select Modal -->
<div class="modal fade" id="file-select-modal" data-bs-backdrop="static" tabindex="-1" aria-labelledby="file-select-modal" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h4"><i class="fa-solid fa-list me-2 fa-beat-fade animation-very-slow"></i>Select Spectrum</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><strong>Select a spectrum to load:</strong></p>
<div class="input-group">
<select class="form-select" id="select-spectrum" aria-label="Select Spectrum" title="Select Spectrum"></select>
<!--
<button class="btn btn-outline-primary" type="button" id="delete-spectrum" title="Delete spectrum from file"><i class="fa-solid fa-trash"></i></button>
-->
</div>
<br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="spectrum-select-btn"> Select </button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Close </button>
</div>
</div>
</div>
</div>
<!--
BOOTSTRAP OFFCANVAS FOR SETTINGS, INFO AND ISOTOPE VIEWER
-->
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel">
<div class="offcanvas-header">
<img class="logo" src="/assets/logo.svg" alt="Logo" title="Gamma MCA Logo" loading="lazy">
<h1 class="display-6 offcanvas-title" id="offcanvasLabel">Gamma MCA</h1>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body" id="offbody">
<nav class="nav nav-tabs" role="tablist">
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#isotopes" type="button" role="tab" aria-controls="isotopes" aria-selected="true">Isotopes</button>
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button>
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#info" type="button" role="tab" aria-controls="info" aria-selected="false">Info</button>
</nav>
<div class="tab-content" id="tabcontent">
<div class="tab-pane fade show active me-2" id="isotopes" role="tabpanel" aria-labelledby="isotopes">
<br>
<h3 class="fs-5">
Common Gamma-Ray Energies <button type="button" class="btn btn-outline-primary btn-sm float-end" id="reload-isos-btn" title="Reload Isotope List"><i class="fa-solid fa-arrow-rotate-right"></i></button>
</h3>
<br>
<div class="text-center">
<div class="alert alert-danger d-none" role="alert" id="iso-load-error"></div>
<div class="alert alert-primary d-none" role="alert" id="iso-loading">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<p><strong>Loading...</strong></p>
</div>
</div>
<div class="table-responsive"> <!-- style="max-height:70vh;" -->
<table id="table" class="table table-hover align-middle">
<caption>List of gamma-ray energies of common isotopes.</caption>
<thead> <!-- class="table-light" style="box-shadow: inset 1px 1px #000, 0 2px #000;" -->
<tr>
<th> <input class="form-check-input" id="check-all-isos" type="checkbox" value="" title="Toggle all isotopes"> </th>
<th class="cursor-pointer" data-sort-by="1">Isotope <i class="fa-solid fa-sort"></i></th>
<th class="cursor-pointer" data-sort-by="2">Energy [keV] <i class="fa-solid fa-sort"></i></th>
</tr>
</thead>
<tbody class="table-group-divider" id="iso-table"></tbody>
</table>
</div>
</div>
<div class="tab-pane fade me-2" id="settings" role="tabpanel" aria-labelledby="settings">
<br>
<div class="alert alert-success alert-dismissible fade show" role="alert" id="ls-available">
<i class="fa-solid fa-floppy-disk"></i> Settings will be saved automatically in this browser.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-warning alert-dismissible fade show" role="alert" id="ls-unavailable">
<i class="fa-solid fa-floppy-disk"></i> Settings will <strong>not</strong> be saved!
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="accordion accordion-flush">
<div class="accordion-item">
<h3 class="accordion-header" id="panel0-heading">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panel0-collaps" aria-expanded="true" aria-controls="panel0-collaps">
General
</button>
</h3>
<div id="panel0-collaps" class="accordion-collapse collapse" aria-labelledby="panel0-heading">
<div class="accordion-body">
<div class="input-group input-group-sm">
<label class="input-group-text" for="theme-select">Theme</label>
<select class="form-select form-select-sm" id="theme-select" aria-label="Select the Gamma MCA theme">
<option value="auto" selected>System (auto)</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<p><small>Select a theme for Gamma MCA. <code>System</code> will automatically use your system theme.</small></p>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="notifications-toggle" disabled>
<label class="form-check-label" for="notifications-toggle">Enable Notifications</label>
</div>
<p><small>Enable system notifications for serial events and similar (only if the window is not focused).</small></p>
</div>
</div>
</div>
<div class="accordion-item">
<h3 class="accordion-header" id="panel1-heading">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panel1-collaps" aria-expanded="true" aria-controls="panel1-collaps">
Plot
</button>
</h3>
<div id="panel1-collaps" class="accordion-collapse collapse" aria-labelledby="panel1-heading">
<div class="accordion-body">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="edit-plot">
<label class="form-check-label" for="edit-plot">Editable Plot Labels</label>
</div>
<p><small>Modify the axes labels, plot title and data names by clicking on them.</small></p>
<div class="input-group input-group-sm">
<label class="input-group-text" for="iso-hover-prox">Iso Hover Proximity</label>
<input type="number" class="form-control" id="iso-hover-prox" min="1">
<label class="input-group-text" for="iso-hover-prox">keV</label>
<button class="btn btn-primary" type="button" id="iso-hover-prox-btn" title="Apply"> <i class="fas fa-check"></i> </button>
</div>
<p><small>Any positive integer is valid.</small></p>
<div class="input-group input-group-sm">
<label class="input-group-text" for="custom-url">Isotope List</label>
<input type="url" class="form-control" id="custom-url" spellcheck="false">
<button class="btn btn-primary" type="button" id="custom-url-btn" title="Apply"> <i class="fas fa-check"></i> </button>
</div>
<p><small>File must be of valid JSON format. Use only trusted sources!</small></p>
<div class="input-group input-group-sm">
<label class="input-group-text" for="download-format">Download Plot</label>
<select class="form-select form-select-sm" id="download-format" aria-label="Plot download file format">
<option value="png" selected>.png</option>
<option value="svg">.svg</option>
<option value="jpeg">.jpeg</option>
<option value="webp">.webp</option>
</select>
</div>
<p><small>File format for downloading a static plot. SVG looks the best.</small></p>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="fwhm-fast">
<label class="form-check-label" for="fwhm-fast">FWHM Fast Mode</label>
</div>
<p><small>Better FWHM calculation performance by assuming symmetrical peaks.</small></p>
</div>
</div>
</div>
<div class="accordion-item">
<h3 class="accordion-header" id="panel2-heading">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panel2-collapse" aria-expanded="false" aria-controls="panel2-collapse">
File Import
</button>
</h3>
<div id="panel2-collapse" class="accordion-collapse collapse" aria-labelledby="panel2-heading">
<div class="accordion-body">
<div class="input-group input-group-sm">
<label class="input-group-text" for="custom-delimiter">CSV File Delimiter</label>
<input type="text" class="form-control" id="custom-delimiter" spellcheck="false">
<button class="btn btn-primary" type="button" id="custom-delimiter-btn" title="Apply"> <i class="fas fa-check"></i> </button>
</div>
<p><small>Any character is valid.</small></p>
<div class="input-group input-group-sm">
<label class="input-group-text" for="custom-file-adc">RAW Stream Channel No</label>
<input type="number" class="form-control" id="custom-file-adc" min="1">
<button class="btn btn-primary" type="button" id="custom-file-adc-btn" title="Apply"> <i class="fas fa-check"></i> </button>
</div>
<p><small>Number of (ADC) channels of the original device. Any positive integer is valid.</small></p>
</div>
</div>
</div>
<div class="accordion-item">
<h3 class="accordion-header" id="panel3-heading">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panel3-collapse" aria-expanded="false" aria-controls="panel3-collapse">
Serial Connection
</button>
</h3>
<div id="panel3-collapse" class="accordion-collapse collapse" aria-labelledby="panel3-heading">
<div class="accordion-body">
<div class="input-group input-group-sm">
<label class="input-group-text" for="custom-baud">Baud Rate</label>
<input type="number" class="form-control serial-controls" id="custom-baud" min="1">
<label class="input-group-text" for="custom-baud">bps</label>
<button class="btn btn-primary serial-controls" type="button" id="custom-baud-btn" title="Apply"> <i class="fas fa-check"></i> </button>
</div>
<p><small>Any positive integer is valid.</small></p>
<div class="input-group input-group-sm">
<label class="input-group-text" for="eol-char">EOL character</label>
<input type="text" class="form-control serial-controls" id="eol-char" spellcheck="false">
<button class="btn btn-primary serial-controls" type="button" id="eol-char-btn" title="Apply"> <i class="fas fa-check"></i> </button>
</div>
<p><small>Character transmitted at the end of every single data point. Any character is valid.</small></p>
<div class="form-check form-switch">
<input class="form-check-input serial-controls" type="checkbox" role="switch" id="toggle-time-limit">
<label class="form-check-label" for="toggle-time-limit">Enable Time Limit</label>
</div>
<div class="input-group input-group-sm">
<label class="input-group-text" for="ser-limit-h">Time Limit</label>