Force overwrite of dobs in makeSyntheticData

This commit is contained in:
rowanc1
2014-07-03 22:48:17 -07:00
parent 94ddcb0f3a
commit 41d105eef1
+3 -2
View File
@@ -355,16 +355,17 @@ class BaseSurvey(object):
"Check if the data is synthetic."
return self.mtrue is not None
def makeSyntheticData(self, m, std=0.05, u=None):
def makeSyntheticData(self, m, std=0.05, u=None, force=False):
"""
Make synthetic data given a model, and a standard deviation.
:param numpy.array m: geophysical model
:param numpy.array std: standard deviation
:param numpy.array u: fields for the given model (if pre-calculated)
:param bool force: force overwriting of dobs
"""
if getattr(self, 'dobs', None) is not None:
if getattr(self, 'dobs', None) is not None and not force:
raise Exception('Survey already has dobs.')
self.mtrue = m
self.dtrue = self.dpred(m, u=u)