Beispiel #1
0
 def _load_likelihoods(self,
                       include_likelihoods=None,
                       exclude_likelihoods=None):
     if include_likelihoods is not None and exclude_likelihoods is not None:
         raise ValueError("include_likelihoods and exclude_likelihoods "
                          "should not be specified simultaneously.")
     for fn in self._fast_likelihoods_yaml:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         with open(self._get_likelihood_path(fn), 'r') as f:
             L = FastLikelihood.load(f)
         self.fast_likelihoods[fn] = L
     for fn in self._likelihoods_yaml:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         if self.eft != 'SMEFT' and fn in ['likelihood_ewpt.yaml',
                                           'likelihood_zlfv.yaml',]:
             continue
         with open(self._get_likelihood_path(fn), 'r') as f:
             L = Likelihood.load(f)
         self.likelihoods[fn] = L
     for name, observables in self._custom_likelihoods_dict.items():
         L = CustomLikelihood(self, observables)
         self.custom_likelihoods['custom_' + name] = L
Beispiel #2
0
 def _load_likelihoods(self,
                       include_likelihoods=None,
                       exclude_likelihoods=None):
     if include_likelihoods is not None and exclude_likelihoods is not None:
         raise ValueError("include_likelihoods and exclude_likelihoods "
                          "should not be specified simultaneously.")
     for argument_name, argument in [
         ('exclude_likelihoods', exclude_likelihoods),
         ('include_likelihoods', include_likelihoods)
     ]:
         if argument:
             unknown_likelihoods = set(argument) - set(
                 self._fast_likelihoods_yaml + self._likelihoods_yaml)
             if unknown_likelihoods:
                 raise ValueError(
                     "{} contains unknown likelihoods: {}".format(
                         argument_name, unknown_likelihoods))
     # load ckm parameters for given CKM scheme
     par_ckm_file = 'par_ckm_{}.yaml'.format(self._ckm_scheme_name)
     with open(self._get_yaml_path(par_ckm_file), 'r') as f:
         par_ckm_dict = flavio.io.yaml.load_include(f)
     for fn in self._fast_likelihoods_yaml:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         with open(self._get_yaml_path(fn), 'r') as f:
             yaml_dict = flavio.io.yaml.load_include(f)
             if not self.fix_ckm:
                 yaml_dict['par_obj'] = par_ckm_dict
             L = FastLikelihood.load_dict(yaml_dict)
         self.fast_likelihoods[fn] = L
     for fn in self._likelihoods_yaml:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         if self.eft != 'SMEFT' and fn in [
                 'likelihood_ewpt.yaml',
                 'likelihood_eeww.yaml',
                 'likelihood_zlfv.yaml',
                 'likelihood_higgs.yaml',
         ]:
             continue
         with open(self._get_yaml_path(fn), 'r') as f:
             L = Likelihood.load(f)
         self.likelihoods[fn] = L
     for name, observables in self._custom_likelihoods_dict.items():
         L = CustomLikelihood(self, observables)
         self.custom_likelihoods['custom_' + name] = L
Beispiel #3
0
 def _load_likelihoods(self,
                       include_likelihoods=None,
                       exclude_likelihoods=None):
     if include_likelihoods is not None and exclude_likelihoods is not None:
         raise ValueError("include_likelihoods and exclude_likelihoods "
                          "should not be specified simultaneously.")
     for fn in [
             'fast_likelihood_quarks.yaml', 'fast_likelihood_leptons.yaml'
     ]:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         with open(get_datapath('smelli', 'data/yaml/' + fn), 'r') as f:
             L = FastLikelihood.load(f)
         self.fast_likelihoods[fn] = L
     for fn in [
             'likelihood_ewpt.yaml',
             'likelihood_lept.yaml',
             'likelihood_rd_rds.yaml',
             'likelihood_lfu_fccc.yaml',
             'likelihood_lfu_fcnc.yaml',
             'likelihood_bcpv.yaml',
             'likelihood_bqnunu.yaml',
             'likelihood_lfv.yaml',
             'likelihood_zlfv.yaml',
     ]:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         if self.eft != 'SMEFT' and fn in [
                 'likelihood_ewpt.yaml',
                 'likelihood_zlfv.yaml',
         ]:
             continue
         with open(get_datapath('smelli', 'data/yaml/' + fn), 'r') as f:
             L = Likelihood.load(f)
         self.likelihoods[fn] = L
Beispiel #4
0
 def _load_likelihoods(self,
                       include_likelihoods=None,
                       exclude_likelihoods=None):
     if include_likelihoods is not None and exclude_likelihoods is not None:
         raise ValueError("include_likelihoods and exclude_likelihoods "
                          "should not be specified simultaneously.")
     for argument_name, argument in [
         ('exclude_likelihoods', exclude_likelihoods),
         ('include_likelihoods', include_likelihoods)
     ]:
         if argument:
             unknown_likelihoods = set(argument) - set(
                 self._fast_likelihoods_yaml + self._likelihoods_yaml)
             if unknown_likelihoods:
                 raise ValueError(
                     "{} contains unknown likelihoods: {}".format(
                         argument_name, unknown_likelihoods))
     # load ckm parameters for given CKM scheme
     par_ckm_file = 'par_ckm_{}.yaml'.format(self._ckm_scheme_name)
     with open(self._get_yaml_path(par_ckm_file), 'r') as f:
         par_ckm_dict = flavio.io.yaml.load_include(f)
     for fn in self._fast_likelihoods_yaml:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         with open(self._get_yaml_path(fn), 'r') as f:
             yaml_dict = flavio.io.yaml.load_include(f)
             if not self.fix_ckm:
                 yaml_dict['par_obj'] = par_ckm_dict
             try:
                 L = FastLikelihood.load_dict(yaml_dict)
                 meas_yaml = set(yaml_dict['include_measurements'])
                 meas_loaded = set(
                     L.full_measurement_likelihood.get_measurements)
                 meas_missing = meas_yaml - meas_loaded
             except AssertionError as e:
                 to_upgrade = 'smelli' if _flavio_up_to_date else 'flavio'
                 raise AssertionError(
                     '{}. Please upgrade {} to the latest version.'.format(
                         e, to_upgrade))
             if meas_missing:
                 to_upgrade = 'smelli' if _flavio_up_to_date else 'flavio'
                 raise AssertionError(
                     'The measurements {} have not been found. Please upgrade {} to the latest version.'
                     .format(meas_missing, to_upgrade))
         self.fast_likelihoods[fn] = L
     for fn in self._likelihoods_yaml:
         if include_likelihoods is not None and fn not in include_likelihoods:
             continue
         if exclude_likelihoods is not None and fn in exclude_likelihoods:
             continue
         if self.eft != 'SMEFT' and fn in [
                 'likelihood_ewpt.yaml',
                 'likelihood_eeww.yaml',
                 'likelihood_zlfv.yaml',
                 'likelihood_higgs.yaml',
         ]:
             continue
         with open(self._get_yaml_path(fn), 'r') as f:
             yaml_dict = flavio.io.yaml.load_include(f)
             try:
                 L = Likelihood.load_dict(yaml_dict)
                 meas_yaml = set(yaml_dict['include_measurements'])
                 meas_loaded = set(
                     L.measurement_likelihood.get_measurements)
                 meas_missing = meas_yaml - meas_loaded
             except AssertionError as e:
                 to_upgrade = 'smelli' if _flavio_up_to_date else 'flavio'
                 raise AssertionError(
                     '{}. Please upgrade {} to the latest version.'.format(
                         e, to_upgrade))
             if meas_missing:
                 to_upgrade = 'smelli' if _flavio_up_to_date else 'flavio'
                 raise AssertionError(
                     'The measurements {} have not been found. Please upgrade {} to the latest version.'
                     .format(meas_missing, to_upgrade))
         self.likelihoods[fn] = L
     for name, observables in self._custom_likelihoods_dict.items():
         L = CustomLikelihood(self, observables)
         self.custom_likelihoods['custom_' + name] = L