|
|
|
|
|
import json
|
|
import datasets
|
|
|
|
class MyDatasetConfig(datasets.BuilderConfig):
|
|
def __init__(self, **kwargs):
|
|
super(MyDatasetConfig, self).__init__(**kwargs)
|
|
|
|
class MyDataset(datasets.GeneratorBasedBuilder):
|
|
BUILDER_CONFIGS = [
|
|
MyDatasetConfig(name="master_device-attributes", version=datasets.Version("1.0.0"), description="Master Device Attributes."),
|
|
MyDatasetConfig(name="qubit-transmomcross", version=datasets.Version("1.0.0"), description="Qubit Transmom Cross simulation results."),
|
|
MyDatasetConfig(name="coupler-Ncap-cap_matrix", version=datasets.Version("1.0.0"), description="Coupler NCap Cap Matrix simulation results."),
|
|
MyDatasetConfig(name="cavity_claw-RouteMeander-eigenmode", version=datasets.Version("1.0.0"), description="Cavity Claw Route Meander Eigenmode simulation results."),
|
|
MyDatasetConfig(name="coupler-CapNInterdigitalTee-cap_matrix", version=datasets.Version("1.0.0"), description="Coupler CapN Interdigital Tee simulation"),
|
|
]
|
|
|
|
def _info(self):
|
|
return datasets.DatasetInfo(
|
|
features=datasets.Features({
|
|
"Qubit": datasets.Value("int32"),
|
|
"F_res_GHz": datasets.Value("string"),
|
|
"F_01_GHz": datasets.Value("string"),
|
|
"Alpha_2pi_MHz": datasets.Value("string"),
|
|
"Punchout_shift_MHz": datasets.Value("string"),
|
|
"Extracted_g_MHz": datasets.Value("string"),
|
|
"Estimated_Dispersive_Shift_KHz": datasets.Value("string"),
|
|
"L_j_nH": datasets.Value("string"),
|
|
"kappa": datasets.Value("string"),
|
|
}),
|
|
)
|
|
|
|
def _split_generators(self, dl_manager):
|
|
urls_to_download = {
|
|
"master_device-attributes": "C:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\master_device-attributes'",
|
|
"qubit-transmomcross": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\qubit-TransmonCross-cap_matrix.json'",
|
|
"coupler-Ncap-cap_matrix": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\coupler-NCap-cap_matrix.json",
|
|
"cavity_claw-RouteMeander-eigenmode": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\cavity_claw-RouteMeander-eigenmode.json",
|
|
"coupler-CapNInterdigitalTee-cap_matrix": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\coupler-CapNInterdigitalTee-cap_matrix.json",
|
|
}
|
|
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
|
|
|
if self.config.name == "master_device-attributes":
|
|
return [
|
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["master_device-attributes"]}),
|
|
]
|
|
if self.config.name == "qubit-transmomcross":
|
|
return [
|
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["qubit-transmomcross"]}),
|
|
]
|
|
if self.config.name == "coupler-Ncap-cap_matrix":
|
|
return [
|
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["coupler-Ncap-cap_matrix"]}),
|
|
]
|
|
if self.config.name == "cavity_claw-RouteMeander-eigenmode":
|
|
return [
|
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["cavity_claw-RouteMeander-eigenmode"]}),
|
|
]
|
|
if self.config.name == "coupler-CapNInterdigitalTee-cap_matrix":
|
|
return [
|
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["coupler-CapNInterdigitalTee-cap_matrix"]}),
|
|
]
|
|
|
|
def _generate_examples(self, file_path):
|
|
with open(file_path, encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
for id_, row in enumerate(data):
|
|
yield id_, row
|
|
|
|
|
|
|
|
|
|
|
|
|