Commit cd23003d authored by Theo Steininger's avatar Theo Steininger

Pipeline can now fix seed for MagneticFieldFactory

parent 70da1a0f
......@@ -130,7 +130,7 @@ class MagneticFieldFactory(Loggable, object):
parameter_dict[variable_name] = mapped_variable
return parameter_dict
def generate(self, variables={}, ensemble_size=1):
def generate(self, variables={}, ensemble_size=1, random_seed=None):
mapped_variables = self._map_variables_to_parameters(variables)
work_parameters = self.parameter_defaults.copy()
work_parameters.update(mapped_variables)
......@@ -142,7 +142,8 @@ class MagneticFieldFactory(Loggable, object):
result_magnetic_field = self.magnetic_field_class(
domain=domain,
parameters=work_parameters,
distribution_strategy='equal')
distribution_strategy='equal',
random_seed=random_seed)
self.logger.debug("Generated magnetic field with work-parameters %s" %
work_parameters)
return result_magnetic_field
......@@ -56,6 +56,8 @@ class Pipeline(Loggable, object):
self.sample_callback = sample_callback
self.fixed_random_seed = None
@property
def observer(self):
return self._observer
......@@ -172,8 +174,9 @@ class Pipeline(Loggable, object):
# create magnetic field
self.logger.debug("Creating magnetic field.")
b_field = self.magnetic_field_factory.generate(
variables=variables,
ensemble_size=self.ensemble_size)
variables=variables,
ensemble_size=self.ensemble_size,
random_seed=self.fixed_random_seed)
# create observables
self.logger.debug("Creating observables.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment