Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def chainBestfit(self, paramNameFile=None):
bf_file = self.chainRoot + '.minimum'
if nonEmptyFile(bf_file):
return types.BestFit(bf_file, paramNameFile)
return None
def getBestFit(self, max_posterior=True):
"""
Returns a :class:`~.types.BestFit` object with best-fit point stored in .minimum or .bestfit file
:param max_posterior: whether to get maximum posterior (from .minimum file)
or maximum likelihood (from .bestfit file)
:return:
"""
ext = '.minimum' if max_posterior else '.bestfit'
bf_file = self.root + ext
if os.path.exists(bf_file):
return types.BestFit(bf_file, max_posterior=max_posterior)
else:
raise MCSamplesError('Best fit can only be included if loaded from file and file_root%s exists '
'(cannot be calculated from samples)' % ext)