Skip to content

Commit

Permalink
title
Browse files Browse the repository at this point in the history
  • Loading branch information
annndruha committed Dec 29, 2023
1 parent 03bc7d5 commit 8f3e2a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 1 addition & 2 deletions generate_dataset/dataset_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@


def generate_dataset():
# changer = ParametersChanger('circuit_classes\\DR_R\\DR_R.cir',
# GENERATE_SETTINGS_PATH)
# changer = ParametersChanger('circuit_classes\\DR_R\\DR_R.cir', GENERATE_SETTINGS_PATH)
# changer.generate_circuits()
# path = os.path.join('dataset', 'measurement_default', 'DR')
# changer.dump_circuits_on_disk(path)
Expand Down
15 changes: 14 additions & 1 deletion generate_dataset/parameters_changer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, base_cir_path, params_settings_path):
self.base_cir_path = base_cir_path

self.circuits = []

self.circuit_class = os.path.splitext(os.path.basename(self.base_cir_path))[0]
self._base_circuit = CleanSpiceParser(path=base_cir_path).build_circuit()
self._params_settings = self._load_params_settings()
self._settings = self._generate_intervals(self._filter_settings(self._params_settings))
Expand Down Expand Up @@ -83,6 +83,7 @@ def _load_params_settings(self):
def _params_combination_to_circuit(self, params_combination):
# Make from combination-dict a circuit with this params.
circuit = self._base_circuit.clone() # TODO: Fix clone without change PySpice
# circuit.title = self._params_repr(params_combination)
for el_name, el_params in params_combination.items():
# Some crutch or define what element has DeviceModel and what hasn't
if el_params[0]['cir_key'] is not None:
Expand Down Expand Up @@ -185,3 +186,15 @@ def _make_assist_settings(self):
del clean_param['nominal']
clean_settings.append({k: clean_param})
return clean_settings

def _params_repr(self, params_combination) -> str:
els = []
for k, params in params_combination.items():
s_params = []
for param in params:
if param["cir_key"] is not None:
s_params.append(f'{param["cir_key"]}={param["value"]}')
else:
s_params.append(f'{param["value"]}{param["cir_unit"]}') # :.2f
els.append(f'{k}({", ".join(s_params)})')
return f"[{self.circuit_class}] {' '.join(els)}"

0 comments on commit 8f3e2a2

Please sign in to comment.