15
15
import adi
16
16
import scipy .io
17
17
18
- app = Dash (__name__ )
18
+ app = Dash (__name__ , update_title = None )
19
19
20
20
# Data
21
21
labels = ['16QAM' , '64QAM' , '8PSK' , 'BPSK' , 'CPFSK' , 'GFSK' , 'PAM4' , 'QPSK' ]
@@ -66,8 +66,8 @@ def plot_modulated_data1():
66
66
estimated_ch7 = 0
67
67
estimated_ch8 = 0
68
68
69
- file_path = 'cnn_output .txt'
70
- file_path1 = 'cnn_output1 .txt'
69
+ file_path = '/home/analog/Workspace/holohub/build/matlab_classify_modulator/applications/matlab_classify_modulator/cpp/modulation_results .txt'
70
+ file_path1 = '/home/analog/Workspace/holohub/build/matlab_classify_modulator/applications/matlab_classify_modulator/cpp/modulation_results1 .txt'
71
71
72
72
truth = 0
73
73
truth1 = 0
@@ -213,7 +213,7 @@ def get_cnn_data():
213
213
sdr3 .tx (iq )
214
214
sdr3 ._tx2 .tx (iq )
215
215
216
- time .sleep (0.1 )
216
+ time .sleep (0.5 )
217
217
if get_timestamp (file_path ):
218
218
with open (file_path , 'r' ) as file :
219
219
lines = file .readlines ()
@@ -314,7 +314,9 @@ def plot_confusion_matrix():
314
314
z = confusion_matrix ,
315
315
x = labels ,
316
316
y = labels ,
317
- colorscale = 'Blues'
317
+ colorscale = 'Blues' ,
318
+ linewidths = .5 ,
319
+ annot = True
318
320
))
319
321
fig .update_layout (
320
322
xaxis = dict (title = 'Estimated Modulation' ),
@@ -327,7 +329,9 @@ def plot_confusion_matrix1():
327
329
z = confusion_matrix1 ,
328
330
x = labels ,
329
331
y = labels ,
330
- colorscale = 'Blues'
332
+ colorscale = 'Blues' ,
333
+ linewidths = .5 ,
334
+ annot = True
331
335
))
332
336
fig .update_layout (
333
337
xaxis = dict (title = 'Estimated Modulation' ),
@@ -368,12 +372,12 @@ def update_table():
368
372
r2 = r2_score (y_true , y_pred )
369
373
370
374
table_data = [
371
- {'column-1' : f'{ accuracy :.2f } ' ,
372
- 'column-2' : f'{ precision :.2f } ' ,
373
- 'column-3' : f'{ recall :.2f } ' ,
374
- 'column-4' : f'{ f1 :.2f } ' ,
375
- 'column-5' : f'{ mse :.2f } ' ,
376
- 'column-6' : f'{ r2 :.2f } '
375
+ {'column-1' : f'{ accuracy :.4f } ' ,
376
+ 'column-2' : f'{ precision :.4f } ' ,
377
+ 'column-3' : f'{ recall :.4f } ' ,
378
+ 'column-4' : f'{ f1 :.4f } ' ,
379
+ 'column-5' : f'{ mse :.4f } ' ,
380
+ 'column-6' : f'{ r2 :.4f } '
377
381
},
378
382
]
379
383
@@ -382,87 +386,83 @@ def update_truth_table():
382
386
global truth_table_data1
383
387
384
388
truth_table_data = [
385
- {'column-1' : 'Channel 1' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch1 )]} ' },
386
- {'column-1' : 'Channel 2' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch2 )]} ' },
387
- {'column-1' : 'Channel 3' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch3 )]} ' },
388
- {'column-1' : 'Channel 4' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch4 )]} ' },
389
+ {'column-1' : ' Channel 1 ' , 'column-2' : f' { modulation_map [str (truth )]} ' , 'column-3' : f' { modulation_map [str (estimated_ch1 )]} ' },
390
+ {'column-1' : ' Channel 2 ' , 'column-2' : f' { modulation_map [str (truth )]} ' , 'column-3' : f' { modulation_map [str (estimated_ch2 )]} ' },
391
+ {'column-1' : ' Channel 3 ' , 'column-2' : f' { modulation_map [str (truth )]} ' , 'column-3' : f' { modulation_map [str (estimated_ch3 )]} ' },
392
+ {'column-1' : ' Channel 4 ' , 'column-2' : f' { modulation_map [str (truth )]} ' , 'column-3' : f' { modulation_map [str (estimated_ch4 )]} ' },
389
393
]
390
394
391
395
truth_table_data1 = [
392
- {'column-1' : 'Channel 1' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch5 )]} ' },
393
- {'column-1' : 'Channel 2' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch6 )]} ' },
394
- {'column-1' : 'Channel 3' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch7 )]} ' },
395
- {'column-1' : 'Channel 4' , 'column-2' : f'{ modulation_map [str (truth )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch8 )]} ' },
396
+ {'column-1' : 'Channel 1' , 'column-2' : f'{ modulation_map [str (truth1 )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch5 )]} ' },
397
+ {'column-1' : 'Channel 2' , 'column-2' : f'{ modulation_map [str (truth1 )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch6 )]} ' },
398
+ {'column-1' : 'Channel 3' , 'column-2' : f'{ modulation_map [str (truth1 )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch7 )]} ' },
399
+ {'column-1' : 'Channel 4' , 'column-2' : f'{ modulation_map [str (truth1 )]} ' , 'column-3' : f'{ modulation_map [str (estimated_ch8 )]} ' },
396
400
]
397
401
398
-
399
-
400
-
401
-
402
402
app .layout = html .Div ([
403
403
html .Div ([
404
404
html .Img (src = '/assets/ADI_logo.svg' , style = {'height' : '45px' , 'margin-right' : '16px' , 'vertical-align' : 'middle' }),
405
405
html .H1 ('High-Performance Analog Meets AI' , style = {'display' : 'inline-block' , 'vertical-align' : 'middle' , 'fontSize' : '46px' })
406
406
], style = {'width' : '100%' , 'text-align' : 'left' , 'padding' : '5px' , 'border-bottom' : '1px solid #B7BBC3' , 'backgroundColor' : '#FFFFFF' , 'font-family' : 'Barlow' , 'align-items' : 'center' }),
407
407
408
408
html .Div ([
409
- html .H2 ('ADRV9009ZU11EG device 1 ' , style = {'text-align' : 'center' , 'margin-top' : '2%' , ' font-family' : 'Barlow' ,'height ' : '10% ' }),
409
+ html .H2 ('First ADRV9009ZU11eg ' , style = {'text-align' : 'center' , 'font-family' : 'Barlow' ,'padding ' : '25px ' }),
410
410
html .Div ([
411
- dcc .Graph (id = 'confusion-matrix' , style = {'width' : '40%' ,'height' : '100%' ,'display' : 'inline-block' }),
411
+ dcc .Graph (id = 'confusion-matrix' , style = {'width' : '40%' ,'height' : '40%' ,'display' : 'inline-block' }),
412
412
dash_table .DataTable (
413
413
id = 'truth-table' ,
414
414
columns = [
415
- {'name' : 'Channel' , 'id' : 'column-1' },
416
- {'name' : 'Estimated' , 'id' : 'column-2' },
417
- {'name' : 'Truth' , 'id' : 'column-3' },
415
+ {'name' : 'Channel' , 'id' : 'column-1' },
416
+ {'name' : 'Truth' , 'id' : 'column-2' },
417
+ {'name' : 'Estimated' , 'id' : 'column-3' },
418
418
],
419
419
data = truth_table_data ,
420
- style_cell = {'textAlign' : 'center' , 'fontSize' : '20px ' , 'font-family' : 'Barlow' },
421
- style_header = {'backgroundColor' : '#1E4056' , 'color' : 'white' , 'font-family' : 'Barlow' , 'fontSize' : '25px ' },
422
- style_table = {'width' : '25 %' ,'height' : '100 %' , 'display' : 'inline-block' ,'margin-top' : '50%' ,'vertical-align' : 'middle' }
420
+ style_cell = {'textAlign' : 'center' , 'fontSize' : '15px ' , 'font-family' : 'Barlow' , 'padding' : '10px ' },
421
+ style_header = {'backgroundColor' : '#1E4056' , 'color' : 'white' , 'font-family' : 'Barlow' , 'fontSize' : '15px ' },
422
+ style_table = {'width' : '20 %' ,'height' : '40 %' , 'display' : 'inline-block' ,'margin-top' : '50%' ,'vertical-align' : 'middle' }
423
423
),
424
- dcc .Graph (id = 'modulated-data' , style = {'width' : '40%' ,'height' : '100%' ,'display' : 'inline-block' })
424
+ dcc .Graph (id = 'modulated-data' , style = {'width' : '40%' ,'height' : '40%' ,'display' : 'inline-block' })
425
425
], style = {'display' : 'flex' , 'justify-content' : 'space-between' , 'width' : '100%' ,'height' : '90%' })],
426
- style = {'width' : '98%' , 'height' : '65 %' , 'margin-left' : '1%' , 'backgroundColor' : 'transparent' , 'border-radius' : '20px' , 'box-shadow' : '10px 10px 20px rgba(0, 0, 0, 0.2)' , 'font-family' : 'Barlow' , 'fontSize' : '20px' }),
426
+ style = {'width' : '98%' , 'height' : '55 %' , 'margin-left' : '1%' , 'backgroundColor' : 'transparent' , 'border-radius' : '20px' , 'box-shadow' : '10px 10px 20px rgba(0, 0, 0, 0.2)' , 'font-family' : 'Barlow' , 'fontSize' : '20px' }),
427
427
html .Div (
428
428
dash_table .DataTable (
429
429
id = 'example-table' ,
430
430
columns = [
431
- {'name' : 'Accuracy' , 'id' : 'column-1' },
431
+ {'name' : 'Accuracy' , 'id' : 'column-1' },
432
432
{'name' : 'Precision' , 'id' : 'column-2' },
433
- {'name' : 'Recall' , 'id' : 'column-3' },
434
- {'name' : 'F1 rate' , 'id' : 'column-4' },
435
- {'name' : 'MSE rate' , 'id' : 'column-5' },
436
- {'name' : 'R2 rate' , 'id' : 'column-6' }
433
+ {'name' : 'Recall' , 'id' : 'column-3' },
434
+ {'name' : 'F1 rate' , 'id' : 'column-4' },
435
+ {'name' : 'MSE rate' , 'id' : 'column-5' },
436
+ {'name' : 'R2 rate' , 'id' : 'column-6' }
437
437
],
438
438
data = table_data ,
439
- style_table = {'width' : '90%' , 'margin-left' : '5%' , 'margin-top' : '2%' , 'border-radius' : '50px' , 'box-shadow' : '10px 10px 20px rgba(0, 0, 0, 0.2)' , 'font-family' : 'Barlow' },
439
+ style_table = {'width' : '90%' , 'margin-left' : '5%' , 'margin-top' : '2%' , 'margin-bottom' : '2%' , ' border-radius' : '50px' , 'box-shadow' : '10px 10px 20px rgba(0, 0, 0, 0.2)' , 'font-family' : 'Barlow' },
440
440
style_cell = {'textAlign' : 'center' , 'fontSize' : '20px' , 'font-family' : 'Barlow' },
441
- style_header = {'backgroundColor' : '#1E4056' , 'color' : 'white' , 'font-family' : 'Barlow' , 'fontSize' : '20px' }
441
+ style_header = {'backgroundColor' : '#1E4056' , 'color' : 'white' , 'font-family' : 'Barlow' , 'fontSize' : '20px' , 'font-family' : 'Barlow' }
442
442
)
443
443
),
444
444
html .Div ([
445
- html .H2 ('ADRV9009ZU11EG device 2 ' , style = {'text-align' : 'center' , 'margin-top' : '2%' , ' font-family' : 'Barlow' ,'height ' : '10% ' }),
445
+ html .H2 ('Second ADRV9009ZU11eg ' , style = {'text-align' : 'center' , 'font-family' : 'Barlow' ,'padding ' : '25px ' }),
446
446
html .Div ([
447
- dcc .Graph (id = 'confusion-matrix1' , style = {'width' : '40%' ,'height' : '100%' ,'display' : 'inline-block' }),
447
+ dcc .Graph (id = 'confusion-matrix1' , style = {'width' : '40%' ,'height' : '40%' ,'display' : 'inline-block' }),
448
448
dash_table .DataTable (
449
449
id = 'truth-table1' ,
450
450
columns = [
451
- {'name' : 'Channel' , 'id' : 'column-1' },
452
- {'name' : 'Estimated' , 'id' : 'column-2' },
453
- {'name' : 'Truth' , 'id' : 'column-3' },
451
+ {'name' : 'Channel ' , 'id' : 'column-1' },
452
+ {'name' : 'Truth ' , 'id' : 'column-2' },
453
+ {'name' : 'Estimated ' , 'id' : 'column-3' },
454
454
],
455
455
data = truth_table_data1 ,
456
- style_cell = {'textAlign' : 'center' , 'fontSize' : '20px ' , 'font-family' : 'Barlow' },
457
- style_header = {'backgroundColor' : '#1E4056' , 'color' : 'white' , 'font-family' : 'Barlow' , 'fontSize' : '25px ' },
458
- style_table = {'width' : '25 %' ,'height' : '100 %' , 'display' : 'inline-block' ,'margin-top' : '50%' ,'vertical-align' : 'middle' }
456
+ style_cell = {'textAlign' : 'center' , 'fontSize' : '15px ' , 'font-family' : 'Barlow' , 'padding' : '10px ' },
457
+ style_header = {'backgroundColor' : '#1E4056' , 'color' : 'white' , 'font-family' : 'Barlow' , 'fontSize' : '15px ' },
458
+ style_table = {'width' : '100 %' , 'height' : '40 %' ,'display' : 'inline-block' ,'margin-top' : '50%' ,'vertical-align' : 'middle' , 'font-family' : 'Barlow ' }
459
459
),
460
- dcc .Graph (id = 'modulated-data1' , style = {'width' : '40%' ,'height' : '100%' ,'display' : 'inline-block' })
460
+ dcc .Graph (id = 'modulated-data1' , style = {'width' : '40%' ,'height' : '40%' ,'display' : 'inline-block' })
461
461
], style = {'display' : 'flex' , 'justify-content' : 'space-between' , 'width' : '100%' ,'height' : '90%' })],
462
- style = {'width' : '98%' , 'height' : '65 %' , 'margin-left' : '1%' , 'backgroundColor' : 'transparent' , 'border-radius' : '20px' , 'box-shadow' : '10px 10px 20px rgba(0, 0, 0, 0.2)' , 'font-family' : 'Barlow' , 'fontSize' : '20px' }),
462
+ style = {'width' : '98%' , 'height' : '55 %' , 'margin-left' : '1%' , 'backgroundColor' : 'transparent' , 'border-radius' : '20px' , 'box-shadow' : '10px 10px 20px rgba(0, 0, 0, 0.2)' , 'font-family' : 'Barlow' , 'fontSize' : '20px' }),
463
463
dcc .Interval (
464
464
id = 'interval-component' ,
465
- interval = 1 * 1000 , # in milliseconds
465
+ interval = 3 * 1000 , # in milliseconds
466
466
n_intervals = 0
467
467
)
468
468
], style = {'font-family' : 'Barlow' })
@@ -495,6 +495,7 @@ def update_graph_live(n):
495
495
sdr .tx_ensm_mode_chan0 = "rf_enabled"
496
496
sdr .tx_ensm_mode_chan1 = "rf_enabled"
497
497
sdr .tx_cyclic_buffer = True
498
+ sdr .tx2_cyclic_buffer = True
498
499
sdr .tx0_lo = 2400000000
499
500
sdr .tx1_lo = 2400000000
500
501
sdr .tx_hardwaregain_chan0 = - 10
@@ -544,4 +545,20 @@ def update_graph_live(n):
544
545
sdr3 .tx_hardwaregain_chan0 = - 10
545
546
sdr3 .tx_hardwaregain_chan1 = - 10
546
547
547
- app .run_server (debug = True )
548
+ sdr .tx0_en = 1
549
+ sdr .tx1_en = 1
550
+ sdr1 .tx0_en = 1
551
+ sdr1 .tx1_en = 1
552
+ sdr2 .tx0_en = 1
553
+ sdr2 .tx1_en = 1
554
+ sdr3 .tx0_en = 1
555
+ sdr3 .tx1_en = 1
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+ app .run_server (debug = True )
0 commit comments