Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_yaml_path(self, name):
"""Return a path for the YAML file specified by `name`.
If a YAML file with that name is found in the package's data
directory, that is used. Otherwise, `name` is assumed to be a path.
Raises `FileNotFoundError` if path does not exists.
"""
path = get_datapath('smelli', 'data/yaml/' + name)
if os.path.exists(path):
return path
path = get_datapath('smelli', 'data/yaml/' + name + '.yaml')
if os.path.exists(path):
return path
if os.path.exists(name):
return name
if os.path.exists(name + '.yaml'):
return name + '.yaml'
else:
raise FileNotFoundError("Likelihood YAML file '{}' was not found".format(name))
def _get_yaml_path(self, name):
"""Return a path for the YAML file specified by `name`.
If a YAML file with that name is found in the package's data
directory, that is used. Otherwise, `name` is assumed to be a path.
Raises `FileNotFoundError` if path does not exists.
"""
path = get_datapath('smelli', 'data/yaml/' + name)
if os.path.exists(path):
return path
path = get_datapath('smelli', 'data/yaml/' + name + '.yaml')
if os.path.exists(path):
return path
if os.path.exists(name):
return name
if os.path.exists(name + '.yaml'):
return name + '.yaml'
else:
raise FileNotFoundError("Likelihood YAML file '{}' was not found".format(name))
self._ckm_scheme_name = ckm_scheme
except:
raise ValueError("CKM scheme '{}' is not defined.".format(ckm_scheme))
self.likelihoods = {}
self.fast_likelihoods = {}
self._custom_likelihoods_dict = custom_likelihoods or {}
self.custom_likelihoods = {}
self._load_likelihoods(include_likelihoods=include_likelihoods,
exclude_likelihoods=exclude_likelihoods)
self._Nexp = Nexp
if exp_cov_folder is not None:
self.load_exp_covariances(exp_cov_folder)
self._sm_cov_loaded = False
try:
if sm_cov_folder is None:
self.load_sm_covariances(get_datapath('smelli', 'data/cache'))
else:
self.load_sm_covariances(sm_cov_folder)
self._sm_cov_loaded = True
self.make_measurement()
except (KeyboardInterrupt, SystemExit):
raise
except:
warnings.warn("There was a problem loading the SM covariances. "
"Please recompute them with `make_measurement`.")
self._log_likelihood_sm = None
self._obstable_sm = None