Skip to content

Commit

Permalink
testchanges
Browse files Browse the repository at this point in the history
  • Loading branch information
annndruha committed Mar 12, 2024
1 parent 95f6807 commit 3ef1977
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions generate_dataset/dataset_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def generate_dataset(save_png=False, debug=False):
_, cls = os.path.split(circuit_class_folder)
cir_path = os.path.join(circuit_class_folder, cls + '.cir')
scheme_png_path = os.path.join(circuit_class_folder, cls + '.png')
output_path = os.path.join(DATASET_FOLDER, measurement_variant['name'], cls)
output_path = os.path.join(DATASET_FOLDER, measurement_variant['name'])

changer = ParametersChanger(cir_path, parameters_settings)
changer.generate_circuits(debug)
Expand All @@ -37,15 +37,15 @@ def generate_dataset(save_png=False, debug=False):
print(output_path, i)
analysis = simulator.get_ivc(circuit)
if measurement_variant['noise_settings']['without_noise']:
uzf_name = os.path.join(output_path, f'{i}_no_noise.uzf')
png_name = os.path.join(output_path, f'{i}_no_noise.png')
uzf_name = os.path.join(output_path, f'{cls}.uzf')
png_name = os.path.join(output_path, f'p_{cls}.png')
simulator.save_ivc(circuit.plot_title, analysis, uzf_name)
simulator.save_plot(circuit.plot_title, analysis, png_name, scheme_png_path, save_png=save_png)

for noise_number in range(measurement_variant['noise_settings']['with_noise']):
analysis = simulator.add_noise(analysis, measurement_variant['noise_settings']['SNR'])
# for noise_number in range(measurement_variant['noise_settings']['with_noise']):
# analysis = simulator.add_noise(analysis, measurement_variant['noise_settings']['SNR'])

uzf_name = os.path.join(output_path, f'{i}_noise{noise_number}.uzf')
png_name = os.path.join(output_path, f'{i}_noise{noise_number}.png')
simulator.save_ivc(circuit.plot_title, analysis, uzf_name)
simulator.save_plot(circuit.plot_title, analysis, png_name, scheme_png_path, save_png=save_png)
# uzf_name = os.path.join(output_path, f'{i}_noise{noise_number}.uzf')
# png_name = os.path.join(output_path, f'{i}_noise{noise_number}.png')
# simulator.save_ivc(circuit.plot_title, analysis, uzf_name)
# simulator.save_plot(circuit.plot_title, analysis, png_name, scheme_png_path, save_png=save_png)
16 changes: 8 additions & 8 deletions generate_dataset/measurement_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,33 @@
}
},
{
"name": "measurement_10kHz_middle_5v",
"name": "measurement_1kHz_middle_5v",
"noise_settings": {
"without_noise": true,
"with_noise": 0,
"SNR": 40.0
},
"measurement_settings": {
"sampling_rate": 1000000,
"sampling_rate": 100000,
"internal_resistance": 4750.0,
"max_voltage": 5.0,
"precharge_delay": 0.01,
"probe_signal_frequency": 10000
"probe_signal_frequency": 1000
}
},
{
"name": "measurement_100kHz_high_5v",
"name": "measurement_10kHz_middle_5v",
"noise_settings": {
"without_noise": true,
"with_noise": 0,
"SNR": 40.0
},
"measurement_settings": {
"sampling_rate": 2000000,
"internal_resistance": 47500.0,
"sampling_rate": 1000000,
"internal_resistance": 4750.0,
"max_voltage": 5.0,
"precharge_delay": 0.001,
"probe_signal_frequency": 100000
"precharge_delay": 0.01,
"probe_signal_frequency": 10000
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions generate_dataset/parameters_changer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def dump_circuits_on_disk(self, base_folder) -> None:
:param base_folder: Folder to save .cir files. (If not exist - it's ok)
"""
os.makedirs(base_folder, exist_ok=True)
for i, circuit in enumerate(self.circuits):
with open(os.path.join(base_folder, f'{i}.cir'), 'w+') as f:
f.write(str(circuit))
# for i, circuit in enumerate(self.circuits):
# with open(os.path.join(base_folder, f'{i}.cir'), 'w+') as f:
# f.write(str(circuit))

def _params_combination_to_circuit(self, params_combination):
# Make from combination-dict a circuit with this params.
Expand Down

0 comments on commit 3ef1977

Please sign in to comment.