Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update runs and samples per run. #351

Merged
merged 2 commits into from
Mar 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions pulser/simulation/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,13 @@ def add_config(self, config: SimConfig) -> None:
old_noise_set = set(self.config.noise)
new_noise_set = old_noise_set.union(config.noise)
diff_noise_set = new_noise_set - old_noise_set
# Create temporary param_dict to add noise parameters:
param_dict: dict[str, Any] = asdict(self._config)
# remove redundant `spam_dict`:
del param_dict["spam_dict"]
# `doppler_sigma` will be recalculated from temperature if needed:
del param_dict["doppler_sigma"]
# Begin populating with added noise parameters:
param_dict["noise"] = tuple(new_noise_set)
if "SPAM" in diff_noise_set:
param_dict["eta"] = config.eta
Expand All @@ -238,6 +242,11 @@ def add_config(self, config: SimConfig) -> None:
if "dephasing" in diff_noise_set:
param_dict["dephasing_prob"] = config.dephasing_prob
param_dict["temperature"] *= 1.0e6
# update runs:
param_dict["runs"] = config.runs
param_dict["samples_per_run"] = config.samples_per_run

# set config with the new parameters:
self.set_config(SimConfig(**param_dict))

def show_config(self, solver_options: bool = False) -> None:
Expand Down