@@ -300,7 +300,7 @@ def view_datasets(self):
300
300
table = list (map (list , zip (* table )))
301
301
302
302
# Print the table with headers
303
- print (tabulate (table , headers = ["Component" , "Component Name" , "Data Available" , "Component Image" ],tablefmt = "fancy_grid " ))
303
+ print (tabulate (table , headers = ["Component" , "Component Name" , "Data Available" , "Component Image" ],tablefmt = "grid " ))
304
304
305
305
def get_dataset_info (self , component = None , component_name = None , data_type = None ):
306
306
"""
@@ -361,35 +361,51 @@ def get_dataset_info(self, component=None, component_name=None, data_type=None):
361
361
362
362
def view_all_contributors (self ):
363
363
"""
364
- View all unique contributors and their relevant information.
364
+ View all unique contributors and their relevant information from simulation configurations .
365
365
366
- This method iterates through the configurations and extracts the relevant information
366
+ This method iterates through the simulation configurations and extracts the relevant information
367
367
of each contributor. It checks if the combination of uploader, PI, group, and institution
368
368
is already in the list of unique contributors. If not, it adds the relevant information
369
- to the list. Finally, it prints the list of unique contributors in a tabular format.
369
+ to the list. Finally, it prints the list of unique contributors in a tabular format with a banner.
370
+ """
371
+ view_contributors_from_rst ('../docs/source/developer/index.rst' )
372
+
373
+ def view_all_simulation_contributors (self ):
374
+ """
375
+ View all unique simulation contributors and their relevant information.
370
376
"""
371
377
# Placeholder for the full contributor info
372
378
unique_contributors_info = []
373
379
380
+ banner = "=" * 80
381
+ title = "SIMULATION DATA CONTRIBUTORS"
382
+ print (f"\n { banner } \n { title .center (80 )} \n { banner } \n " )
383
+
374
384
for config in self .configs :
375
385
dataset = load_dataset (self .repo_name , config )["train" ]
376
386
configs_contrib_info = dataset ["contributor" ]
377
-
387
+
378
388
for contrib_info in configs_contrib_info :
379
389
# Extracting the relevant information
380
- relevant_info = {key : contrib_info [key ] for key in ['uploader' , 'PI' , 'group' , 'institution' ]}
381
- relevant_info ['config' ] = config # Add the config to the relevant info
390
+ relevant_info = {
391
+ "Uploader" : contrib_info .get ('uploader' , 'N/A' ),
392
+ "PI" : contrib_info .get ('PI' , 'N/A' ),
393
+ "Group" : contrib_info .get ('group' , 'N/A' ),
394
+ "Institution" : contrib_info .get ('institution' , 'N/A' ),
395
+ "Config" : config # Add the config to the relevant info
396
+ }
382
397
383
398
# Check if this combination of info is already in the list
384
- if not any (existing_info ['config ' ] == config and
385
- existing_info ['uploader ' ] == relevant_info ['uploader ' ] and
386
- existing_info ['PI' ] == relevant_info ['PI' ] and
387
- existing_info ['group ' ] == relevant_info ['group ' ] and
388
- existing_info ['institution ' ] == relevant_info ['institution ' ]
389
- for existing_info in unique_contributors_info ):
399
+ if not any (existing_info ['Config ' ] == config and
400
+ existing_info ['Uploader ' ] == relevant_info ['Uploader ' ] and
401
+ existing_info ['PI' ] == relevant_info ['PI' ] and
402
+ existing_info ['Group ' ] == relevant_info ['Group ' ] and
403
+ existing_info ['Institution ' ] == relevant_info ['Institution ' ]
404
+ for existing_info in unique_contributors_info ):
390
405
unique_contributors_info .append (relevant_info )
391
406
392
- print (tabulate (unique_contributors_info , headers = "keys" , tablefmt = "fancy_grid" ))
407
+ print (tabulate (unique_contributors_info , headers = "keys" , tablefmt = "grid" ))
408
+ print (f"\n { banner } \n " ) # End with a banner
393
409
394
410
def get_measured_devices (self ):
395
411
"""
@@ -450,7 +466,7 @@ def view_measured_devices(self):
450
466
rows = [[device_info [header ] for header in headers ] for device_info in all_devices_info ]
451
467
452
468
# Print the table with tabulate
453
- print (tabulate (rows , headers = headers , tablefmt = "fancy_grid " , stralign = "left" , numalign = "left" ))
469
+ print (tabulate (rows , headers = headers , tablefmt = "grid " , stralign = "left" , numalign = "left" ))
454
470
455
471
def view_contributors_of_config (self , config ):
456
472
"""
@@ -472,22 +488,36 @@ def view_contributors_of_config(self, config):
472
488
if relevant_info not in unique_contributors_info :
473
489
unique_contributors_info .append (relevant_info )
474
490
475
- print (tabulate (unique_contributors_info , headers = 'keys' , tablefmt = "fancy_grid " ))
491
+ print (tabulate (unique_contributors_info , headers = 'keys' , tablefmt = "grid " ))
476
492
477
- def view_contributors_of (self , component = None , component_name = None , data_type = None ):
493
+ def view_contributors_of (self , component = None , component_name = None , data_type = None , measured_device_name = None ):
478
494
"""
479
495
View contributors of a specific component, component name, and data type.
480
496
481
497
Args:
482
498
component (str): The component of interest.
483
499
component_name (str): The name of the component.
484
500
data_type (str): The type of data.
501
+ measured_device_name (str): The name of the measured device.
485
502
486
503
Returns:
487
504
None
488
505
"""
489
506
config = component + "-" + component_name + "-" + data_type
490
- self .view_contributors_of_config (config )
507
+ try :
508
+ print ("=" * 80 )
509
+ print (f"\t \t \t Measured Device Contributor(s):" )
510
+ print ("=" * 80 )
511
+ self .view_device_contributors_of (component , component_name , data_type )
512
+ except :
513
+ pass
514
+ try :
515
+ print ("=" * 80 )
516
+ print (f"\t \t \t Simulation Data Contributor(s):" )
517
+ print ("=" * 80 )
518
+ self .view_contributors_of_config (config )
519
+ except :
520
+ pass
491
521
492
522
def view_simulation_results (self , device_name ):
493
523
"""
@@ -508,7 +538,44 @@ def view_simulation_results(self, device_name):
508
538
return sim_results
509
539
return {}
510
540
511
- def view_reference_device_of (self , component = None , component_name = None , data_type = None ):
541
+ def get_device_contributors_of (self , component = None , component_name = None , data_type = None ):
542
+ """
543
+ View the reference/source experimental device that was used to validate a specific simulation configuration.
544
+
545
+ Args:
546
+ component (str): The component of interest.
547
+ component_name (str): The name of the component.
548
+ data_type (str): The type of data.
549
+
550
+ Returns:
551
+ dict: The relevant contributor information.
552
+ """
553
+ if not (component and component_name and data_type ):
554
+ return "Component, component_name, and data_type must all be provided."
555
+
556
+ config = f"{ component } -{ component_name } -{ data_type } "
557
+ dataset = load_dataset (self .repo_name , 'measured_device_database' )["train" ]
558
+
559
+ for entry in zip (dataset ["contrib_info" ], dataset ["sim_results" ]):
560
+ contrib_info , sim_results = entry
561
+
562
+ if config in sim_results :
563
+ relevant_info = {
564
+ "Foundry" : contrib_info .get ("foundry" , "N/A" ),
565
+ "PI" : contrib_info .get ("PI" , "N/A" ),
566
+ "Group" : contrib_info .get ("group" , "N/A" ),
567
+ "Institution" : contrib_info .get ("institution" , "N/A" ),
568
+ "Measured By" : ", " .join (contrib_info .get ("measured_by" , [])),
569
+ "Reference Device Name" : contrib_info .get ("name" , "N/A" ),
570
+ "Uploader" : contrib_info .get ("uploader" , "N/A" )
571
+ }
572
+
573
+ print (tabulate (relevant_info .items (), tablefmt = "grid" ))
574
+ return relevant_info
575
+
576
+ return None
577
+
578
+ def view_device_contributors_of (self , component = None , component_name = None , data_type = None ):
512
579
"""
513
580
View the reference/source experimental device that was used to validate a specific simulation configuration.
514
581
@@ -518,7 +585,42 @@ def view_reference_device_of(self, component=None, component_name=None, data_typ
518
585
data_type (str): The type of data.
519
586
520
587
Returns:
521
- str: the name of the experimentally validated reference device, or an error message if not found.
588
+ str: The name of the experimentally validated reference device, or an error message if not found.
589
+ """
590
+ if not (component and component_name and data_type ):
591
+ return "Component, component_name, and data_type must all be provided."
592
+
593
+ config = f"{ component } -{ component_name } -{ data_type } "
594
+ dataset = load_dataset (self .repo_name , 'measured_device_database' )["train" ]
595
+
596
+ for entry in zip (dataset ["contrib_info" ], dataset ["sim_results" ]):
597
+ contrib_info , sim_results = entry
598
+
599
+ if config in sim_results :
600
+ relevant_info = {
601
+ "Foundry" : contrib_info .get ("foundry" , "N/A" ),
602
+ "PI" : contrib_info .get ("PI" , "N/A" ),
603
+ "Group" : contrib_info .get ("group" , "N/A" ),
604
+ "Institution" : contrib_info .get ("institution" , "N/A" ),
605
+ "Measured By" : ", " .join (contrib_info .get ("measured_by" , [])),
606
+ "Reference Device Name" : contrib_info .get ("name" , "N/A" ),
607
+ "Uploader" : contrib_info .get ("uploader" , "N/A" )
608
+ }
609
+
610
+ print (tabulate (relevant_info .items (), tablefmt = "grid" ))
611
+
612
+ return "The reference device could not be retrieved."
613
+
614
+
615
+ def view_reference_device_of (self , component = None , component_name = None , data_type = None ):
616
+ """
617
+ View the reference/source experimental device that was used to validate a specific simulation configuration.
618
+
619
+ Args:
620
+ component (str): The component of interest.
621
+ component_name (str): The name of the component.
622
+ data_type (str): The type of data.
623
+
522
624
"""
523
625
if not (component and component_name and data_type ):
524
626
return "Component, component_name, and data_type must all be provided."
@@ -540,12 +642,10 @@ def view_reference_device_of(self, component=None, component_name=None, data_typ
540
642
}
541
643
combined_info .update (contrib_info )
542
644
543
- print (tabulate (combined_info .items (), headers = ["Key" , "Value" ], tablefmt = "grid" ))
544
- return contrib_info ['name' ]
645
+ print (tabulate (combined_info .items (), tablefmt = "grid" ))
545
646
546
- return "The reference device could not be retrieved."
547
647
548
- def get_recipe_of (self , device_name ):
648
+ def view_recipe_of (self , device_name ):
549
649
"""
550
650
Retrieve the foundry and fabrication recipe information for a specified device.
551
651
@@ -557,14 +657,18 @@ def get_recipe_of(self, device_name):
557
657
"""
558
658
dataset = load_dataset (self .repo_name , 'measured_device_database' )["train" ]
559
659
560
- for contrib_info , foundry , recipe in zip (dataset ["contrib_info" ], dataset ["foundry" ], dataset ["fabrication_recipe" ]):
660
+ for contrib_info , foundry , recipe , github_url in zip (dataset ["contrib_info" ], dataset ["foundry" ], dataset ["fabrication_recipe" ], dataset [ "design_code" ], ):
561
661
if contrib_info ['name' ] == device_name :
562
- return {
563
- "Foundry" : foundry ,
564
- "Fabrication Recipe" : recipe
565
- }
662
+ # append tree/main/Fabrication to the github_url
663
+ github_url = f"{ github_url } /tree/main/Fabrication"
664
+ # Prepare the data for tabulation
665
+ data = [["Foundry" , foundry ], ["Fabublox Link" , recipe ], ["Fabrication Recipe Links" , github_url ]]
666
+
667
+ # Print the data in a tabulated format
668
+ print (tabulate (data , tablefmt = "grid" ))
669
+ return
566
670
567
- return { "Error" : " Device not found in the dataset."}
671
+ print ( "Error: Device not found in the dataset." )
568
672
569
673
def view_reference_devices (self ):
570
674
"""
@@ -590,7 +694,7 @@ def view_reference_devices(self):
590
694
if relevant_info not in unique_contributors_info :
591
695
unique_contributors_info .append (relevant_info )
592
696
593
- print (tabulate (unique_contributors_info , headers = 'keys' , tablefmt = "fancy_grid " ))
697
+ print (tabulate (unique_contributors_info , headers = 'keys' , tablefmt = "grid " ))
594
698
595
699
596
700
def select_components (self , component_dict = None ):
0 commit comments