Commit 416f2cd5 authored by Theo Steininger's avatar Theo Steininger

Added convenience to EnsembleLikelihood

parent 05f87bd4
...@@ -9,10 +9,12 @@ from imagine.likelihoods.likelihood import Likelihood ...@@ -9,10 +9,12 @@ from imagine.likelihoods.likelihood import Likelihood
class EnsembleLikelihood(Likelihood): class EnsembleLikelihood(Likelihood):
def __init__(self, observable_name, measured_data, def __init__(self, observable_name, measured_data,
data_covariance_operator, profile=None): data_covariance, profile=None):
self.observable_name = observable_name self.observable_name = observable_name
self.measured_data = self._strip_data(measured_data) self.measured_data = self._strip_data(measured_data)
self.data_covariance_operator = data_covariance_operator if isinstance(data_covariance, Field):
data_covariance = data_covariance.val.get_full_data()
self.data_covariance = data_covariance
def _strip_data(self, data): def _strip_data(self, data):
# if the first element in the domain tuple is a FieldArray we must # if the first element in the domain tuple is a FieldArray we must
...@@ -27,7 +29,7 @@ class EnsembleLikelihood(Likelihood): ...@@ -27,7 +29,7 @@ class EnsembleLikelihood(Likelihood):
field = observable[self.observable_name] field = observable[self.observable_name]
return self._process_simple_field(field, return self._process_simple_field(field,
self.measured_data, self.measured_data,
self.data_covariance_operator) self.data_covariance)
def _process_simple_field(self, observable, measured_data, def _process_simple_field(self, observable, measured_data,
data_covariance): data_covariance):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment