elizabethkunz commited on
Commit
486126e
1 Parent(s): dd99df7

Upload liz.py

Browse files
Files changed (1) hide show
  1. liz.py +74 -0
liz.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ import json
4
+ import datasets
5
+
6
+ class MyDatasetConfig(datasets.BuilderConfig):
7
+ def __init__(self, **kwargs):
8
+ super(MyDatasetConfig, self).__init__(**kwargs)
9
+
10
+ class MyDataset(datasets.GeneratorBasedBuilder):
11
+ BUILDER_CONFIGS = [
12
+ MyDatasetConfig(name="master_device-attributes", version=datasets.Version("1.0.0"), description="Master Device Attributes."),
13
+ MyDatasetConfig(name="qubit-transmomcross", version=datasets.Version("1.0.0"), description="Qubit Transmom Cross simulation results."),
14
+ MyDatasetConfig(name="coupler-Ncap-cap_matrix", version=datasets.Version("1.0.0"), description="Coupler NCap Cap Matrix simulation results."),
15
+ MyDatasetConfig(name="cavity_claw-RouteMeander-eigenmode", version=datasets.Version("1.0.0"), description="Cavity Claw Route Meander Eigenmode simulation results."),
16
+ MyDatasetConfig(name="coupler-CapNInterdigitalTee-cap_matrix", version=datasets.Version("1.0.0"), description="Coupler CapN Interdigital Tee simulation"),
17
+ ]
18
+
19
+ def _info(self):
20
+ return datasets.DatasetInfo(
21
+ features=datasets.Features({
22
+ "Qubit": datasets.Value("int32"),
23
+ "F_res_GHz": datasets.Value("string"),
24
+ "F_01_GHz": datasets.Value("string"),
25
+ "Alpha_2pi_MHz": datasets.Value("string"),
26
+ "Punchout_shift_MHz": datasets.Value("string"),
27
+ "Extracted_g_MHz": datasets.Value("string"),
28
+ "Estimated_Dispersive_Shift_KHz": datasets.Value("string"),
29
+ "L_j_nH": datasets.Value("string"),
30
+ "kappa": datasets.Value("string"),
31
+ }),
32
+ )
33
+
34
+ def _split_generators(self, dl_manager):
35
+ urls_to_download = {
36
+ "master_device-attributes": "C:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\master_device-attributes'",
37
+ "qubit-transmomcross": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\qubit-TransmonCross-cap_matrix.json'",
38
+ "coupler-Ncap-cap_matrix": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\coupler-NCap-cap_matrix.json",
39
+ "cavity_claw-RouteMeander-eigenmode": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\cavity_claw-RouteMeander-eigenmode.json",
40
+ "coupler-CapNInterdigitalTee-cap_matrix": "c:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\coupler-CapNInterdigitalTee-cap_matrix.json",
41
+ }
42
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
43
+
44
+ if self.config.name == "master_device-attributes":
45
+ return [
46
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["master_device-attributes"]}),
47
+ ]
48
+ if self.config.name == "qubit-transmomcross":
49
+ return [
50
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["qubit-transmomcross"]}),
51
+ ]
52
+ if self.config.name == "coupler-Ncap-cap_matrix":
53
+ return [
54
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["coupler-Ncap-cap_matrix"]}),
55
+ ]
56
+ if self.config.name == "cavity_claw-RouteMeander-eigenmode":
57
+ return [
58
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["cavity_claw-RouteMeander-eigenmode"]}),
59
+ ]
60
+ if self.config.name == "coupler-CapNInterdigitalTee-cap_matrix":
61
+ return [
62
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": downloaded_files["coupler-CapNInterdigitalTee-cap_matrix"]}),
63
+ ]
64
+
65
+ def _generate_examples(self, file_path):
66
+ with open(file_path, encoding="utf-8") as f:
67
+ data = json.load(f)
68
+ for id_, row in enumerate(data):
69
+ yield id_, row
70
+
71
+
72
+
73
+
74
+