Skip to content

Commit

Permalink
Make deepcopy in solver optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MarJMue committed Jul 3, 2024
1 parent 32dcedc commit e8a03ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/elli/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ class Solver(ABC):
def calculate(self) -> Result:
pass

def __init__(self, experiment: "Experiment") -> None:
self.experiment = deepcopy(experiment)
def __init__(self, experiment: "Experiment", save_experiment: bool = False) -> None:
if save_experiment:
self.experiment = deepcopy(experiment)
else:
self.experiment = experiment
self.structure = self.experiment.structure
self.lbda = self.experiment.lbda
self.theta_i = self.experiment.theta_i
Expand Down
7 changes: 5 additions & 2 deletions src/elli/solver4x4.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,12 @@ def get_k_z(
return sqrt(k_z2)

def __init__(
self, experiment: "Experiment", propagator: Propagator = PropagatorExpm()
self,
experiment: "Experiment",
propagator: Propagator = PropagatorExpm(),
save_experiment: bool = False,
) -> None:
super().__init__(experiment)
super().__init__(experiment, save_experiment)
self.propagator = propagator

def calculate(self) -> Result:
Expand Down

0 comments on commit e8a03ab

Please sign in to comment.