SQuADDS 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {SQuADDS-0.3.0/SQuADDS.egg-info → SQuADDS-0.3.2}/PKG-INFO +28 -3
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/README.md +27 -2
- {SQuADDS-0.3.0 → SQuADDS-0.3.2/SQuADDS.egg-info}/PKG-INFO +28 -3
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/SQuADDS.egg-info/SOURCES.txt +1 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/setup.py +1 -1
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/__init__.py +1 -1
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/components/coupled_systems.py +2 -2
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/db.py +220 -45
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/utils.py +43 -0
- SQuADDS-0.3.2/squadds/database/HuggingFace.py +293 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/interpolations/physics.py +0 -1
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/simulations/objects.py +5 -3
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/LICENSE +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/MANIFEST.in +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/SQuADDS.egg-info/dependency_links.txt +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/SQuADDS.egg-info/requires.txt +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/SQuADDS.egg-info/top_level.txt +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/requirements.txt +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/setup.cfg +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/calcs/__init__.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/calcs/qubit.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/calcs/transmon_cross.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/components/__init__.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/components/cavity_claw.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/components/claw_coupler.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/__init__.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/analysis.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/design_patterns.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/globals.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/metrics.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/core/processing.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/__init__.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/abstract_upload_data.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/checker.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/config.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/contributor.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/contributor_HF.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/new_contribution.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/database/utils.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/interpolations/__init__.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/interpolations/interpolator.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/simulations/__init__.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/simulations/ansys_simulator.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/simulations/simulator.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/simulations/sweeper_helperfunctions.py +0 -0
- {SQuADDS-0.3.0 → SQuADDS-0.3.2}/squadds/simulations/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SQuADDS
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Our project introduces an open-source database of programmatically generated and experimentally validated superconducting quantum device designs, accessible through a user-friendly interface, significantly lowering the entry barrier for research in this field.
|
|
5
5
|
Home-page: https://github.com/LFL-Lab/SQuADDS
|
|
6
6
|
Author: Sadman Ahmed Shanto
|
|
@@ -15,8 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
<img src="docs/_static/images/squadds_not_transparent.png" width="100%" alt="SQuADDS Logo" /> <!-- This will stretch the logo to the full container width -->
|
|
16
16
|
</center>
|
|
17
17
|
|
|
18
|
-
#     
|
|
20
19
|
> :warning: **This project is an alpha release and currently under active development. Some features and documentation may be incomplete. Please update to the latest release.**
|
|
21
20
|
|
|
22
21
|
The SQuADDS (Superconducting Qubit And Device Design and Simulation) Database Project is an open-source resource aimed at advancing research in superconducting quantum device designs. It provides a robust workflow for generating and simulating superconducting quantum device designs, facilitating the accurate prediction of Hamiltonian parameters across a wide range of design geometries.
|
|
@@ -34,6 +33,8 @@ The SQuADDS (Superconducting Qubit And Device Design and Simulation) Database Pr
|
|
|
34
33
|
- [License](#license)
|
|
35
34
|
- [FAQs](#faqs)
|
|
36
35
|
- [Contact](#contact)
|
|
36
|
+
- [Contributors](#contributors)
|
|
37
|
+
- [Developers](#developers)
|
|
37
38
|
|
|
38
39
|
---
|
|
39
40
|
|
|
@@ -108,4 +109,28 @@ Check out our [FAQs](https://lfl-lab.github.io/SQuADDS/source/getting_started.ht
|
|
|
108
109
|
|
|
109
110
|
For inquiries or support, please contact [Sadman Ahmed Shanto](mailto:shanto@usc.edu).
|
|
110
111
|
|
|
112
|
+
## Contributors
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
| Name | Institution | Contribution |
|
|
116
|
+
|:-------------------|:-----------------------------------|:------------------------------------|
|
|
117
|
+
| Clark Miyamoto | New York University | Code contributor 💻 |
|
|
118
|
+
| Madison Howard | California Institute of Technology | Bug Hunter 🐛 |
|
|
119
|
+
| Malida Hecht | University of Southern California | Data contributor 📀 |
|
|
120
|
+
| Evangelos Vlachos | University of Southern California | Code contributor 💻 and Bug Hunter 🐛 |
|
|
121
|
+
| Anne Whelan | US Navy | Documentation contributor 📄 |
|
|
122
|
+
| Jenny Huang | Columbia University | Documentation contributor 📄 |
|
|
123
|
+
| Connie Miao | Stanford University | Data Contributor 📀 |
|
|
124
|
+
| Daria Kowsari, PhD | University of Southern California | Data contributor 📀 |
|
|
125
|
+
| Vivek Maurya | University of Southern California | Data contributor 📀 |
|
|
126
|
+
| Haimeng Zhang, PhD | IBM | Data contributor 📀 |
|
|
127
|
+
| Ethan Zheng | University of Southern California | Data contributor 📀 |
|
|
128
|
+
| Sara Sussman, PhD | Fermilab | Bug Hunter 🐛 |
|
|
129
|
+
|
|
130
|
+
## Developers
|
|
131
|
+
- [shanto268](https://github.com/shanto268) - 230 contributions
|
|
132
|
+
- [elizabethkunz](https://github.com/elizabethkunz) - 17 contributions
|
|
133
|
+
- [NxtGenLegend](https://github.com/NxtGenLegend) - 1 contributions
|
|
111
134
|
---
|
|
135
|
+
|
|
136
|
+
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
<img src="docs/_static/images/squadds_not_transparent.png" width="100%" alt="SQuADDS Logo" /> <!-- This will stretch the logo to the full container width -->
|
|
3
3
|
</center>
|
|
4
4
|
|
|
5
|
-
#     
|
|
7
6
|
> :warning: **This project is an alpha release and currently under active development. Some features and documentation may be incomplete. Please update to the latest release.**
|
|
8
7
|
|
|
9
8
|
The SQuADDS (Superconducting Qubit And Device Design and Simulation) Database Project is an open-source resource aimed at advancing research in superconducting quantum device designs. It provides a robust workflow for generating and simulating superconducting quantum device designs, facilitating the accurate prediction of Hamiltonian parameters across a wide range of design geometries.
|
|
@@ -21,6 +20,8 @@ The SQuADDS (Superconducting Qubit And Device Design and Simulation) Database Pr
|
|
|
21
20
|
- [License](#license)
|
|
22
21
|
- [FAQs](#faqs)
|
|
23
22
|
- [Contact](#contact)
|
|
23
|
+
- [Contributors](#contributors)
|
|
24
|
+
- [Developers](#developers)
|
|
24
25
|
|
|
25
26
|
---
|
|
26
27
|
|
|
@@ -95,4 +96,28 @@ Check out our [FAQs](https://lfl-lab.github.io/SQuADDS/source/getting_started.ht
|
|
|
95
96
|
|
|
96
97
|
For inquiries or support, please contact [Sadman Ahmed Shanto](mailto:shanto@usc.edu).
|
|
97
98
|
|
|
99
|
+
## Contributors
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
| Name | Institution | Contribution |
|
|
103
|
+
|:-------------------|:-----------------------------------|:------------------------------------|
|
|
104
|
+
| Clark Miyamoto | New York University | Code contributor 💻 |
|
|
105
|
+
| Madison Howard | California Institute of Technology | Bug Hunter 🐛 |
|
|
106
|
+
| Malida Hecht | University of Southern California | Data contributor 📀 |
|
|
107
|
+
| Evangelos Vlachos | University of Southern California | Code contributor 💻 and Bug Hunter 🐛 |
|
|
108
|
+
| Anne Whelan | US Navy | Documentation contributor 📄 |
|
|
109
|
+
| Jenny Huang | Columbia University | Documentation contributor 📄 |
|
|
110
|
+
| Connie Miao | Stanford University | Data Contributor 📀 |
|
|
111
|
+
| Daria Kowsari, PhD | University of Southern California | Data contributor 📀 |
|
|
112
|
+
| Vivek Maurya | University of Southern California | Data contributor 📀 |
|
|
113
|
+
| Haimeng Zhang, PhD | IBM | Data contributor 📀 |
|
|
114
|
+
| Ethan Zheng | University of Southern California | Data contributor 📀 |
|
|
115
|
+
| Sara Sussman, PhD | Fermilab | Bug Hunter 🐛 |
|
|
116
|
+
|
|
117
|
+
## Developers
|
|
118
|
+
- [shanto268](https://github.com/shanto268) - 230 contributions
|
|
119
|
+
- [elizabethkunz](https://github.com/elizabethkunz) - 17 contributions
|
|
120
|
+
- [NxtGenLegend](https://github.com/NxtGenLegend) - 1 contributions
|
|
98
121
|
---
|
|
122
|
+
|
|
123
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SQuADDS
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Our project introduces an open-source database of programmatically generated and experimentally validated superconducting quantum device designs, accessible through a user-friendly interface, significantly lowering the entry barrier for research in this field.
|
|
5
5
|
Home-page: https://github.com/LFL-Lab/SQuADDS
|
|
6
6
|
Author: Sadman Ahmed Shanto
|
|
@@ -15,8 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
<img src="docs/_static/images/squadds_not_transparent.png" width="100%" alt="SQuADDS Logo" /> <!-- This will stretch the logo to the full container width -->
|
|
16
16
|
</center>
|
|
17
17
|
|
|
18
|
-
#     
|
|
20
19
|
> :warning: **This project is an alpha release and currently under active development. Some features and documentation may be incomplete. Please update to the latest release.**
|
|
21
20
|
|
|
22
21
|
The SQuADDS (Superconducting Qubit And Device Design and Simulation) Database Project is an open-source resource aimed at advancing research in superconducting quantum device designs. It provides a robust workflow for generating and simulating superconducting quantum device designs, facilitating the accurate prediction of Hamiltonian parameters across a wide range of design geometries.
|
|
@@ -34,6 +33,8 @@ The SQuADDS (Superconducting Qubit And Device Design and Simulation) Database Pr
|
|
|
34
33
|
- [License](#license)
|
|
35
34
|
- [FAQs](#faqs)
|
|
36
35
|
- [Contact](#contact)
|
|
36
|
+
- [Contributors](#contributors)
|
|
37
|
+
- [Developers](#developers)
|
|
37
38
|
|
|
38
39
|
---
|
|
39
40
|
|
|
@@ -108,4 +109,28 @@ Check out our [FAQs](https://lfl-lab.github.io/SQuADDS/source/getting_started.ht
|
|
|
108
109
|
|
|
109
110
|
For inquiries or support, please contact [Sadman Ahmed Shanto](mailto:shanto@usc.edu).
|
|
110
111
|
|
|
112
|
+
## Contributors
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
| Name | Institution | Contribution |
|
|
116
|
+
|:-------------------|:-----------------------------------|:------------------------------------|
|
|
117
|
+
| Clark Miyamoto | New York University | Code contributor 💻 |
|
|
118
|
+
| Madison Howard | California Institute of Technology | Bug Hunter 🐛 |
|
|
119
|
+
| Malida Hecht | University of Southern California | Data contributor 📀 |
|
|
120
|
+
| Evangelos Vlachos | University of Southern California | Code contributor 💻 and Bug Hunter 🐛 |
|
|
121
|
+
| Anne Whelan | US Navy | Documentation contributor 📄 |
|
|
122
|
+
| Jenny Huang | Columbia University | Documentation contributor 📄 |
|
|
123
|
+
| Connie Miao | Stanford University | Data Contributor 📀 |
|
|
124
|
+
| Daria Kowsari, PhD | University of Southern California | Data contributor 📀 |
|
|
125
|
+
| Vivek Maurya | University of Southern California | Data contributor 📀 |
|
|
126
|
+
| Haimeng Zhang, PhD | IBM | Data contributor 📀 |
|
|
127
|
+
| Ethan Zheng | University of Southern California | Data contributor 📀 |
|
|
128
|
+
| Sara Sussman, PhD | Fermilab | Bug Hunter 🐛 |
|
|
129
|
+
|
|
130
|
+
## Developers
|
|
131
|
+
- [shanto268](https://github.com/shanto268) - 230 contributions
|
|
132
|
+
- [elizabethkunz](https://github.com/elizabethkunz) - 17 contributions
|
|
133
|
+
- [NxtGenLegend](https://github.com/NxtGenLegend) - 1 contributions
|
|
111
134
|
---
|
|
135
|
+
|
|
136
|
+
|
|
@@ -6,7 +6,7 @@ with open('requirements.txt') as f:
|
|
|
6
6
|
|
|
7
7
|
setup(
|
|
8
8
|
name='SQuADDS',
|
|
9
|
-
version='0.3.
|
|
9
|
+
version='0.3.2',
|
|
10
10
|
packages=find_packages(),
|
|
11
11
|
description='Our project introduces an open-source database of programmatically generated and experimentally validated superconducting quantum device designs, accessible through a user-friendly interface, significantly lowering the entry barrier for research in this field.',
|
|
12
12
|
long_description=open('README.md').read(),
|
|
@@ -221,7 +221,7 @@ class QubitCavity(QComponent):
|
|
|
221
221
|
print(self.coupler.options)
|
|
222
222
|
options = Dict(
|
|
223
223
|
orientation = -90,
|
|
224
|
-
pos_y = (float)(self.coupler.options.pos_y[:-2]) +
|
|
224
|
+
pos_y = (float)(self.coupler.options.pos_y[:-2]) + 2.75,
|
|
225
225
|
trace_width = p.cavity_claw_options.cpw_opts.left_options.trace_width,
|
|
226
226
|
trace_gap = p.cavity_claw_options.cpw_opts.left_options.trace_gap
|
|
227
227
|
)
|
|
@@ -229,7 +229,7 @@ class QubitCavity(QComponent):
|
|
|
229
229
|
|
|
230
230
|
options = Dict(
|
|
231
231
|
orientation = 90,
|
|
232
|
-
pos_y = (float)(self.coupler.options.pos_y[:-2]) -
|
|
232
|
+
pos_y = (float)(self.coupler.options.pos_y[:-2]) - 2.75,
|
|
233
233
|
trace_width = p.cavity_claw_options.cpw_opts.left_options.trace_width,
|
|
234
234
|
trace_gap = p.cavity_claw_options.cpw_opts.left_options.trace_gap
|
|
235
235
|
)
|
|
@@ -300,8 +300,7 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
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="
|
|
304
|
-
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"))
|
|
305
304
|
|
|
306
305
|
def get_dataset_info(self, component=None, component_name=None, data_type=None):
|
|
307
306
|
"""
|
|
@@ -362,35 +361,112 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
362
361
|
|
|
363
362
|
def view_all_contributors(self):
|
|
364
363
|
"""
|
|
365
|
-
View all unique contributors and their relevant information.
|
|
364
|
+
View all unique contributors and their relevant information from simulation configurations.
|
|
366
365
|
|
|
367
|
-
This method iterates through the configurations and extracts the relevant information
|
|
366
|
+
This method iterates through the simulation configurations and extracts the relevant information
|
|
368
367
|
of each contributor. It checks if the combination of uploader, PI, group, and institution
|
|
369
368
|
is already in the list of unique contributors. If not, it adds the relevant information
|
|
370
|
-
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.
|
|
371
376
|
"""
|
|
372
377
|
# Placeholder for the full contributor info
|
|
373
378
|
unique_contributors_info = []
|
|
374
379
|
|
|
380
|
+
banner = "=" * 80
|
|
381
|
+
title = "SIMULATION DATA CONTRIBUTORS"
|
|
382
|
+
print(f"\n{banner}\n{title.center(80)}\n{banner}\n")
|
|
383
|
+
|
|
375
384
|
for config in self.configs:
|
|
376
385
|
dataset = load_dataset(self.repo_name, config)["train"]
|
|
377
386
|
configs_contrib_info = dataset["contributor"]
|
|
378
|
-
|
|
387
|
+
|
|
379
388
|
for contrib_info in configs_contrib_info:
|
|
380
389
|
# Extracting the relevant information
|
|
381
|
-
relevant_info = {
|
|
382
|
-
|
|
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
|
+
}
|
|
383
397
|
|
|
384
398
|
# Check if this combination of info is already in the list
|
|
385
|
-
if not any(existing_info['
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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):
|
|
391
405
|
unique_contributors_info.append(relevant_info)
|
|
392
406
|
|
|
393
|
-
print(tabulate(unique_contributors_info, headers="keys", tablefmt="
|
|
407
|
+
print(tabulate(unique_contributors_info, headers="keys", tablefmt="grid"))
|
|
408
|
+
print(f"\n{banner}\n") # End with a banner
|
|
409
|
+
|
|
410
|
+
def get_measured_devices(self):
|
|
411
|
+
"""
|
|
412
|
+
Retrieve all measured devices with their corresponding design codes, paper links, images, foundries, and fabrication recipes.
|
|
413
|
+
|
|
414
|
+
Returns:
|
|
415
|
+
pd.DataFrame: A DataFrame containing the name, design code, paper link, image, foundry, and fabrication recipe for each device.
|
|
416
|
+
"""
|
|
417
|
+
dataset = load_dataset(self.repo_name, 'measured_device_database')["train"]
|
|
418
|
+
|
|
419
|
+
all_devices_info = []
|
|
420
|
+
|
|
421
|
+
for entry in zip(dataset["contrib_info"], dataset["design_code"], dataset["paper_link"],
|
|
422
|
+
dataset["image"], dataset["foundry"], dataset["fabrication_recipe"]):
|
|
423
|
+
contrib_info, design_code, paper_link, image, foundry, recipe = entry
|
|
424
|
+
|
|
425
|
+
device_info = {
|
|
426
|
+
"Name": contrib_info.get('name', 'N/A'),
|
|
427
|
+
"Design Code": design_code,
|
|
428
|
+
"Paper Link": paper_link,
|
|
429
|
+
"Image": image,
|
|
430
|
+
"Foundry": foundry,
|
|
431
|
+
# "Fabrication Recipe": recipe
|
|
432
|
+
}
|
|
433
|
+
all_devices_info.append(device_info)
|
|
434
|
+
|
|
435
|
+
# Convert the list of dictionaries to a DataFrame
|
|
436
|
+
df = pd.DataFrame(all_devices_info)
|
|
437
|
+
|
|
438
|
+
return df
|
|
439
|
+
|
|
440
|
+
def view_measured_devices(self):
|
|
441
|
+
"""
|
|
442
|
+
View all measured devices with their corresponding design codes, paper links, images, foundries, and fabrication recipes.
|
|
443
|
+
|
|
444
|
+
This method retrieves and displays the relevant information for each device in the dataset in a well-formatted table.
|
|
445
|
+
"""
|
|
446
|
+
dataset = load_dataset(self.repo_name, 'measured_device_database')["train"]
|
|
447
|
+
|
|
448
|
+
all_devices_info = []
|
|
449
|
+
|
|
450
|
+
for entry in zip(dataset["contrib_info"], dataset["design_code"], dataset["paper_link"],
|
|
451
|
+
dataset["image"], dataset["foundry"], dataset["fabrication_recipe"]):
|
|
452
|
+
contrib_info, design_code, paper_link, image, foundry, recipe = entry
|
|
453
|
+
|
|
454
|
+
device_info = {
|
|
455
|
+
"Name": contrib_info.get('name', 'N/A'),
|
|
456
|
+
"Design Code": design_code,
|
|
457
|
+
"Paper Link": paper_link,
|
|
458
|
+
"Image": image,
|
|
459
|
+
"Foundry": foundry,
|
|
460
|
+
"Fabrication Recipe": recipe
|
|
461
|
+
}
|
|
462
|
+
all_devices_info.append(device_info)
|
|
463
|
+
|
|
464
|
+
# Prepare the data for tabular display
|
|
465
|
+
headers = ["Name", "Design Code", "Paper Link", "Image", "Foundry", "Fabrication Recipe"]
|
|
466
|
+
rows = [[device_info[header] for header in headers] for device_info in all_devices_info]
|
|
467
|
+
|
|
468
|
+
# Print the table with tabulate
|
|
469
|
+
print(tabulate(rows, headers=headers, tablefmt="grid", stralign="left", numalign="left"))
|
|
394
470
|
|
|
395
471
|
def view_contributors_of_config(self, config):
|
|
396
472
|
"""
|
|
@@ -412,9 +488,9 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
412
488
|
if relevant_info not in unique_contributors_info:
|
|
413
489
|
unique_contributors_info.append(relevant_info)
|
|
414
490
|
|
|
415
|
-
print(tabulate(unique_contributors_info, headers='keys', tablefmt="
|
|
491
|
+
print(tabulate(unique_contributors_info, headers='keys', tablefmt="grid"))
|
|
416
492
|
|
|
417
|
-
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):
|
|
418
494
|
"""
|
|
419
495
|
View contributors of a specific component, component name, and data type.
|
|
420
496
|
|
|
@@ -422,16 +498,27 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
422
498
|
component (str): The component of interest.
|
|
423
499
|
component_name (str): The name of the component.
|
|
424
500
|
data_type (str): The type of data.
|
|
501
|
+
measured_device_name (str): The name of the measured device.
|
|
425
502
|
|
|
426
503
|
Returns:
|
|
427
504
|
None
|
|
428
505
|
"""
|
|
429
506
|
config = component + "-" + component_name + "-" + data_type
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
507
|
+
try:
|
|
508
|
+
print("="*80)
|
|
509
|
+
print(f"\t\t\tMeasured 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\tSimulation Data Contributor(s):")
|
|
517
|
+
print("="*80)
|
|
518
|
+
self.view_contributors_of_config(config)
|
|
519
|
+
except:
|
|
520
|
+
pass
|
|
433
521
|
|
|
434
|
-
|
|
435
522
|
def view_simulation_results(self, device_name):
|
|
436
523
|
"""
|
|
437
524
|
View the simulation results of a specific device specified with a device name.
|
|
@@ -451,7 +538,44 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
451
538
|
return sim_results
|
|
452
539
|
return {}
|
|
453
540
|
|
|
454
|
-
def
|
|
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):
|
|
455
579
|
"""
|
|
456
580
|
View the reference/source experimental device that was used to validate a specific simulation configuration.
|
|
457
581
|
|
|
@@ -461,39 +585,90 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
461
585
|
data_type (str): The type of data.
|
|
462
586
|
|
|
463
587
|
Returns:
|
|
464
|
-
str:
|
|
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"]
|
|
465
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):
|
|
466
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
|
+
|
|
624
|
+
"""
|
|
625
|
+
if not (component and component_name and data_type):
|
|
626
|
+
return "Component, component_name, and data_type must all be provided."
|
|
627
|
+
|
|
467
628
|
config = f"{component}-{component_name}-{data_type}"
|
|
468
629
|
dataset = load_dataset(self.repo_name, 'measured_device_database')["train"]
|
|
469
|
-
configs_contrib_info = dataset["contrib_info"]
|
|
470
|
-
simulation_info = dataset["sim_results"]
|
|
471
|
-
design_codes = dataset["design_code"]
|
|
472
|
-
paper_links = dataset["paper_link"]
|
|
473
|
-
images = dataset["image"]
|
|
474
630
|
|
|
475
|
-
for
|
|
631
|
+
for entry in zip(dataset["contrib_info"], dataset["sim_results"], dataset["design_code"],
|
|
632
|
+
dataset["paper_link"], dataset["image"], dataset["foundry"], dataset["fabrication_recipe"]):
|
|
633
|
+
contrib_info, sim_results, design_code, paper_link, image, foundry, recipe = entry
|
|
634
|
+
|
|
476
635
|
if config in sim_results:
|
|
477
|
-
# Combine the information into one dictionary
|
|
478
636
|
combined_info = {
|
|
479
|
-
"Design Code":
|
|
480
|
-
"Paper Link":
|
|
481
|
-
"Image":
|
|
637
|
+
"Design Code": design_code,
|
|
638
|
+
"Paper Link": paper_link,
|
|
639
|
+
"Image": image,
|
|
640
|
+
"Foundry": foundry,
|
|
641
|
+
"Fabrication Recipe": recipe
|
|
482
642
|
}
|
|
483
643
|
combined_info.update(contrib_info)
|
|
484
644
|
|
|
485
|
-
|
|
486
|
-
print(tabulate(combined_info.items(), headers=["Key", "Value"], tablefmt="grid"))
|
|
487
|
-
return contrib_info['name']
|
|
488
|
-
|
|
489
|
-
else:
|
|
490
|
-
return "The reference device could not be retrieved."
|
|
491
|
-
|
|
492
|
-
return None
|
|
493
|
-
|
|
494
|
-
|
|
645
|
+
print(tabulate(combined_info.items(), tablefmt="grid"))
|
|
495
646
|
|
|
496
647
|
|
|
648
|
+
def view_recipe_of(self, device_name):
|
|
649
|
+
"""
|
|
650
|
+
Retrieve the foundry and fabrication recipe information for a specified device.
|
|
651
|
+
|
|
652
|
+
Args:
|
|
653
|
+
device_name (str): The name of the device to retrieve information for.
|
|
654
|
+
|
|
655
|
+
Returns:
|
|
656
|
+
dict: A dictionary containing foundry and fabrication recipe information.
|
|
657
|
+
"""
|
|
658
|
+
dataset = load_dataset(self.repo_name, 'measured_device_database')["train"]
|
|
659
|
+
|
|
660
|
+
for contrib_info, foundry, recipe, github_url in zip(dataset["contrib_info"], dataset["foundry"], dataset["fabrication_recipe"], dataset["design_code"],):
|
|
661
|
+
if contrib_info['name'] == device_name:
|
|
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
|
|
670
|
+
|
|
671
|
+
print("Error: Device not found in the dataset.")
|
|
497
672
|
|
|
498
673
|
def view_reference_devices(self):
|
|
499
674
|
"""
|
|
@@ -519,7 +694,7 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
519
694
|
if relevant_info not in unique_contributors_info:
|
|
520
695
|
unique_contributors_info.append(relevant_info)
|
|
521
696
|
|
|
522
|
-
print(tabulate(unique_contributors_info, headers='keys', tablefmt="
|
|
697
|
+
print(tabulate(unique_contributors_info, headers='keys', tablefmt="grid"))
|
|
523
698
|
|
|
524
699
|
|
|
525
700
|
def select_components(self, component_dict=None):
|
|
@@ -1150,4 +1325,4 @@ class SQuADDS_DB(metaclass=SingletonMeta):
|
|
|
1150
1325
|
f.write(response.content)
|
|
1151
1326
|
df = pd.read_parquet(file_name)
|
|
1152
1327
|
os.remove(file_name) # Cleanup the downloaded file
|
|
1153
|
-
return df
|
|
1328
|
+
return df
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import getpass
|
|
2
2
|
import os
|
|
3
3
|
import platform
|
|
4
|
+
import re
|
|
4
5
|
import shutil
|
|
5
6
|
import urllib.parse
|
|
6
7
|
import webbrowser
|
|
@@ -8,10 +9,52 @@ import webbrowser
|
|
|
8
9
|
import numpy as np
|
|
9
10
|
import pandas as pd
|
|
10
11
|
from huggingface_hub import HfApi, HfFolder
|
|
12
|
+
from tabulate import tabulate
|
|
11
13
|
|
|
12
14
|
from squadds.core.globals import ENV_FILE_PATH
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
def view_contributors_from_rst(rst_file_path):
|
|
18
|
+
"""
|
|
19
|
+
Extract and print relevant contributor information from the index.rst file.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
rst_file_path (str): The path to the `index.rst` file.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
None
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
contributors_data = []
|
|
29
|
+
|
|
30
|
+
with open(rst_file_path, 'r') as file:
|
|
31
|
+
content = file.read()
|
|
32
|
+
|
|
33
|
+
# Find the Contributors section
|
|
34
|
+
contributors_match = re.search(r'Contributors\s+-{3,}\s+(.*?)(\n\n|$)', content, re.S)
|
|
35
|
+
if contributors_match:
|
|
36
|
+
contributors_section = contributors_match.group(1).strip()
|
|
37
|
+
|
|
38
|
+
# Extract individual contributor entries
|
|
39
|
+
contributor_entries = contributors_section.split("\n| ")
|
|
40
|
+
|
|
41
|
+
for entry in contributor_entries:
|
|
42
|
+
if entry.strip():
|
|
43
|
+
# Extract name, institution, and contribution
|
|
44
|
+
match = re.match(r'\*\*(.*?)\*\* \((.*?)\) - (.*)', entry.strip())
|
|
45
|
+
if match:
|
|
46
|
+
name = match.group(1)
|
|
47
|
+
institution = match.group(2)
|
|
48
|
+
contribution = match.group(3)
|
|
49
|
+
contributors_data.append([name, institution, contribution])
|
|
50
|
+
|
|
51
|
+
if contributors_data:
|
|
52
|
+
headers = ["Name", "Institution", "Contribution"]
|
|
53
|
+
print(tabulate(contributors_data, headers=headers, tablefmt="grid"))
|
|
54
|
+
else:
|
|
55
|
+
print("No contributors found in the RST file.")
|
|
56
|
+
|
|
57
|
+
|
|
15
58
|
def save_intermediate_df(df, filename, file_idx):
|
|
16
59
|
"""
|
|
17
60
|
Save the intermediate DataFrame to disk in Parquet format.
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from datasets import Dataset, concatenate_datasets, load_dataset
|
|
4
|
+
from dotenv import load_dotenv
|
|
5
|
+
from huggingface_hub import HfApi, Repository, login
|
|
6
|
+
|
|
7
|
+
from squadds.core.globals import *
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def fork_dataset(repo_id: str, dataset_name: str, new_dataset_name: str, private: bool = True):
|
|
11
|
+
"""
|
|
12
|
+
Fork a dataset from Hugging Face Hub.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
repo_id (str): The repo ID (namespace/repo) of the dataset to fork.
|
|
16
|
+
dataset_name (str): Name of the dataset to fork.
|
|
17
|
+
new_dataset_name (str): Name of the new dataset.
|
|
18
|
+
private (bool): Whether the new dataset should be private or public.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
None
|
|
22
|
+
"""
|
|
23
|
+
dataset = load_dataset(repo_id, dataset_name)
|
|
24
|
+
dataset.push_to_hub(repo_id, new_dataset_name, private=private)
|
|
25
|
+
print(f"Forked dataset '{dataset_name}' to '{new_dataset_name}'.")
|
|
26
|
+
|
|
27
|
+
def create_PR(repo_id: str, branch_name: str, title: str, description: str):
|
|
28
|
+
"""
|
|
29
|
+
Create a Pull Request (PR) on Hugging Face Hub.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
repo_id (str): The repo ID (namespace/repo) where the PR will be created.
|
|
33
|
+
branch_name (str): The branch name where the changes are made.
|
|
34
|
+
title (str): The title of the PR.
|
|
35
|
+
description (str): A description of the changes made in the PR.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
dict: Information about the created PR.
|
|
39
|
+
"""
|
|
40
|
+
api = HfApi()
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
pr_info = api.create_pull_request(
|
|
44
|
+
repo_id=repo_id,
|
|
45
|
+
head=branch_name, # The branch with your changes
|
|
46
|
+
title=title,
|
|
47
|
+
body=description
|
|
48
|
+
)
|
|
49
|
+
print(f"Created PR '{title}' on repo '{repo_id}'.")
|
|
50
|
+
return pr_info
|
|
51
|
+
|
|
52
|
+
except Exception as e:
|
|
53
|
+
print(f"Failed to create PR: {e}")
|
|
54
|
+
raise
|
|
55
|
+
|
|
56
|
+
# Make sure you are logged in to Hugging Face
|
|
57
|
+
def login_to_huggingface():
|
|
58
|
+
"""
|
|
59
|
+
Log into Hugging Face using an API token from environment variables.
|
|
60
|
+
"""
|
|
61
|
+
load_dotenv(ENV_FILE_PATH) # Load environment variables from .env file
|
|
62
|
+
token = os.getenv("HUGGINGFACE_API_KEY") # Retrieve the token from environment variables
|
|
63
|
+
|
|
64
|
+
if token is None:
|
|
65
|
+
raise ValueError("Hugging Face API token not found in environment variables.")
|
|
66
|
+
|
|
67
|
+
login(token)
|
|
68
|
+
print("Successfully logged in to Hugging Face")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# Load the dataset from the Hugging Face Hub
|
|
72
|
+
def load_hf_dataset(dataset_name: str, config: str = None):
|
|
73
|
+
"""
|
|
74
|
+
Load a dataset from Hugging Face Hub.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
dataset_name (str): The name or path of the dataset on the Hugging Face Hub.
|
|
78
|
+
config (str): Specific configuration or version of the dataset.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
Dataset or DatasetDict: Loaded dataset.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
dataset = load_dataset(dataset_name, config)
|
|
85
|
+
|
|
86
|
+
print(f"Loaded dataset: {dataset_name}")
|
|
87
|
+
return dataset
|
|
88
|
+
|
|
89
|
+
# Add a new column to the dataset
|
|
90
|
+
def add_column_to_dataset(dataset: Dataset, column_name: str, column_data: list):
|
|
91
|
+
"""
|
|
92
|
+
Add a new column to a dataset.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
dataset (Dataset): Hugging Face dataset to which you want to add a column.
|
|
96
|
+
column_name (str): Name of the new column.
|
|
97
|
+
column_data (list): Data for the new column.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Dataset: Dataset with the new column.
|
|
101
|
+
"""
|
|
102
|
+
new_dataset = dataset.add_column(column_name, column_data)
|
|
103
|
+
print(f"Added new column '{column_name}' to dataset.")
|
|
104
|
+
return new_dataset
|
|
105
|
+
|
|
106
|
+
# Remove a column from the dataset
|
|
107
|
+
def remove_column_from_dataset(dataset: Dataset, column_name: str):
|
|
108
|
+
"""
|
|
109
|
+
Remove a column from a dataset.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
dataset (Dataset): Hugging Face dataset from which you want to remove a column.
|
|
113
|
+
column_name (str): Name of the column to remove.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Dataset: Dataset with the column removed.
|
|
117
|
+
"""
|
|
118
|
+
new_dataset = dataset.remove_columns([column_name])
|
|
119
|
+
print(f"Removed column '{column_name}' from dataset.")
|
|
120
|
+
return new_dataset
|
|
121
|
+
|
|
122
|
+
# View a specific column in the dataset
|
|
123
|
+
def view_column_in_dataset(dataset: Dataset, column_name: str, num_values: int):
|
|
124
|
+
"""
|
|
125
|
+
View a specific column in the dataset by its name.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
dataset (Dataset): Hugging Face dataset.
|
|
129
|
+
column_name (str): Name of the column to view.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
list: Data from the specified column.
|
|
133
|
+
"""
|
|
134
|
+
if column_name not in dataset.column_names:
|
|
135
|
+
raise ValueError(f"Column '{column_name}' not found in the dataset.")
|
|
136
|
+
|
|
137
|
+
column_data = dataset[column_name]
|
|
138
|
+
print(f"Data from column '{column_name}':")
|
|
139
|
+
print(column_data[:num_values]) # Print values for preview
|
|
140
|
+
return column_data
|
|
141
|
+
|
|
142
|
+
# Update a specific column in the dataset
|
|
143
|
+
def update_column_in_dataset(dataset: Dataset, column_name: str, new_column_data: list):
|
|
144
|
+
"""
|
|
145
|
+
Update a specific column in the dataset.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
dataset (Dataset): Hugging Face dataset to update.
|
|
149
|
+
column_name (str): Name of the column to update.
|
|
150
|
+
new_column_data (list): List of new data to replace the existing column.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
Dataset: Updated dataset.
|
|
154
|
+
"""
|
|
155
|
+
if column_name not in dataset.column_names:
|
|
156
|
+
raise ValueError(f"Column '{column_name}' not found in the dataset.")
|
|
157
|
+
|
|
158
|
+
if len(new_column_data) != len(dataset):
|
|
159
|
+
raise ValueError(f"The new data length ({len(new_column_data)}) does not match the dataset length ({len(dataset)}).")
|
|
160
|
+
|
|
161
|
+
updated_dataset = dataset.map(lambda x, idx: {column_name: new_column_data[idx]}, with_indices=True)
|
|
162
|
+
print(f"Updated column '{column_name}' in the dataset.")
|
|
163
|
+
return updated_dataset
|
|
164
|
+
|
|
165
|
+
# Add a new row to the dataset
|
|
166
|
+
def add_row_to_dataset(dataset: Dataset, row_data: dict):
|
|
167
|
+
"""
|
|
168
|
+
Add a new row to a dataset.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
dataset (Dataset): The Hugging Face dataset to which you want to add a row.
|
|
172
|
+
row_data (dict): The row data in dictionary format.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
Dataset: Dataset with the new row added.
|
|
176
|
+
"""
|
|
177
|
+
# Convert the dataset to a list, append the new row, and convert back to a Dataset
|
|
178
|
+
new_dataset = Dataset.from_dict({k: dataset[k] + [v] for k, v in row_data.items()})
|
|
179
|
+
print("Added new row to dataset.")
|
|
180
|
+
return new_dataset
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# Remove a row from the dataset by index
|
|
184
|
+
def remove_row_from_dataset(dataset: Dataset, row_index: int):
|
|
185
|
+
"""
|
|
186
|
+
Remove a row from a dataset by index.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
dataset (Dataset): Hugging Face dataset from which you want to remove a row.
|
|
190
|
+
row_index (int): Index of the row to remove.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
Dataset: Dataset with the row removed.
|
|
194
|
+
"""
|
|
195
|
+
new_dataset = dataset.select([i for i in range(len(dataset)) if i != row_index])
|
|
196
|
+
print(f"Removed row at index {row_index} from dataset.")
|
|
197
|
+
return new_dataset
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# Update a row in the dataset
|
|
201
|
+
def update_row_in_dataset(dataset: Dataset, row_index: int, new_row_data: dict):
|
|
202
|
+
"""
|
|
203
|
+
Update an existing row in a dataset by index.
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
dataset (Dataset): Hugging Face dataset to update.
|
|
207
|
+
row_index (int): Index of the row to update.
|
|
208
|
+
new_row_data (dict): The new data for the row.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
Dataset: Updated dataset.
|
|
212
|
+
"""
|
|
213
|
+
updated_rows = dataset.to_dict()
|
|
214
|
+
|
|
215
|
+
for key in new_row_data:
|
|
216
|
+
updated_rows[key][row_index] = new_row_data[key]
|
|
217
|
+
|
|
218
|
+
updated_dataset = Dataset.from_dict(updated_rows)
|
|
219
|
+
print(f"Updated row at index {row_index} in the dataset.")
|
|
220
|
+
return updated_dataset
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# View a specific row in the dataset
|
|
224
|
+
def view_row_in_dataset(dataset: Dataset, row_index: int):
|
|
225
|
+
"""
|
|
226
|
+
View a specific row in the dataset by index.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
dataset (Dataset): Hugging Face dataset.
|
|
230
|
+
row_index (int): Index of the row to view.
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
dict: Data for the specified row.
|
|
234
|
+
"""
|
|
235
|
+
row_data = dataset[row_index]
|
|
236
|
+
print(f"Row {row_index}: {row_data}")
|
|
237
|
+
return row_data
|
|
238
|
+
|
|
239
|
+
# Merge two datasets
|
|
240
|
+
def merge_datasets(dataset1: Dataset, dataset2: Dataset):
|
|
241
|
+
"""
|
|
242
|
+
Merge two datasets into one.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
dataset1 (Dataset): First dataset.
|
|
246
|
+
dataset2 (Dataset): Second dataset.
|
|
247
|
+
|
|
248
|
+
Returns:
|
|
249
|
+
Dataset: Merged dataset.
|
|
250
|
+
"""
|
|
251
|
+
merged_dataset = concatenate_datasets([dataset1, dataset2])
|
|
252
|
+
print("Merged two datasets.")
|
|
253
|
+
return merged_dataset
|
|
254
|
+
|
|
255
|
+
# Save the dataset to Hugging Face Hub
|
|
256
|
+
def save_dataset_to_hf(dataset: Dataset, repo_id: str, dataset_name: str, private: bool = True):
|
|
257
|
+
"""
|
|
258
|
+
Push a dataset to Hugging Face Hub.
|
|
259
|
+
|
|
260
|
+
Args:
|
|
261
|
+
dataset (Dataset): The dataset to push to Hugging Face Hub.
|
|
262
|
+
repo_id (str): The repo ID (namespace/repo) on Hugging Face Hub.
|
|
263
|
+
dataset_name (str): Name of the dataset on Hugging Face Hub.
|
|
264
|
+
private (bool): Whether the dataset should be private or public.
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
None
|
|
268
|
+
"""
|
|
269
|
+
dataset.push_to_hub(repo_id, dataset_name, private=private)
|
|
270
|
+
print(f"Dataset '{dataset_name}' saved to Hugging Face Hub.")
|
|
271
|
+
|
|
272
|
+
# Filter the dataset based on a condition
|
|
273
|
+
def filter_dataset(dataset: Dataset, filter_fn):
|
|
274
|
+
"""
|
|
275
|
+
Filter a dataset based on a custom condition.
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
dataset (Dataset): Hugging Face dataset to filter.
|
|
279
|
+
filter_fn (function): Function that returns True or False for filtering.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
Dataset: Filtered dataset.
|
|
283
|
+
"""
|
|
284
|
+
filtered_dataset = dataset.filter(filter_fn)
|
|
285
|
+
print("Filtered dataset based on condition.")
|
|
286
|
+
return filtered_dataset
|
|
287
|
+
|
|
288
|
+
if __name__ == "__main__":
|
|
289
|
+
# Log in to Hugging Face
|
|
290
|
+
login_to_huggingface()
|
|
291
|
+
|
|
292
|
+
# Define repo_id, dataset_name, and new_dataset_name
|
|
293
|
+
repo_id = "SQuADDS/SQuADDS_DB"
|
|
@@ -109,7 +109,6 @@ class ScalingInterpolator(Interpolator):
|
|
|
109
109
|
print(f"g scaling: {g_scaling.values[0]}")
|
|
110
110
|
print(f"alpha scaling: {alpha_scaling.values[0]}")
|
|
111
111
|
print(f"resonator scaling: {res_scaling}")
|
|
112
|
-
print(f"resonator scaling: {res_scaling}")
|
|
113
112
|
print("="*50)
|
|
114
113
|
|
|
115
114
|
updated_coupling_length = closest_coupler_length * kappa_scaling
|
|
@@ -254,7 +254,8 @@ def run_eigenmode(design, geometry_dict, sim_options):
|
|
|
254
254
|
epra, hfss = start_simulation(design, config)
|
|
255
255
|
hfss.clean_active_design()
|
|
256
256
|
# setup = set_simulation_hyperparameters(epra, config)
|
|
257
|
-
|
|
257
|
+
# ["setup"]
|
|
258
|
+
epra.sim.setup = Dict(sim_options)
|
|
258
259
|
epra.sim.setup.name = "test_setup"
|
|
259
260
|
epra.sim.renderer.options.max_mesh_length_port = '7um'
|
|
260
261
|
setup = epra.sim.setup
|
|
@@ -264,7 +265,8 @@ def run_eigenmode(design, geometry_dict, sim_options):
|
|
|
264
265
|
|
|
265
266
|
mesh_lengths = {}
|
|
266
267
|
coupler_type = "CLT"
|
|
267
|
-
|
|
268
|
+
# "finger_count" in geometry_dict["cplr_opts"]
|
|
269
|
+
if geometry_dict['cprl_opts'].get('finger_count') is not None :
|
|
268
270
|
coupler_type = "NCap"
|
|
269
271
|
render_simulation_no_ports(epra, [cpw,claw], [(cpw.name, "start")], config.design_name, setup.vars)
|
|
270
272
|
mesh_lengths = {'mesh1': {"objects": [f"trace_{cpw.name}", f"readout_connector_arm_{claw.name}"], "MaxLength": '4um'}}
|
|
@@ -554,4 +556,4 @@ def render_simulation_no_ports(epra, components, open_pins, ansys_design_name, s
|
|
|
554
556
|
solution_type='eigenmode',
|
|
555
557
|
vars_to_initialize=setup_vars,
|
|
556
558
|
box_plus_buffer=True)
|
|
557
|
-
print("Sim rendered into HFSS!")
|
|
559
|
+
print("Sim rendered into HFSS!")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|