Skip to content

Commit

Permalink
Update runs and samples per run. (#351)
Browse files Browse the repository at this point in the history
* Update runs and samples per run.

* Update black
  • Loading branch information
sebgrijalva committed Mar 25, 2022
1 parent 704ab64 commit bee6a59
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit bee6a59

Please sign in to comment.