Exemple #1
0
 def __init__(self, x, y, z, ex=None, ey=None):
     assert ex is None
     x = Coord(x, ex)
     y = Coord(y, ey)
     z = np.asarray(z, dtype=self.dtype)
     assert x.v.shape + y.v.shape == z.shape
     pin(locals())
Exemple #2
0
 def __init__(self, pdfset, values):
     assert isinstance(pdfset, PDFSet)
     if isinstance(values, PDFInput):
         inp = values
         values = AutoDict(self._from_input)
     else:
         assert isinstance(values, (Sequence, np.ndarray))
         assert len(pdfset) == len(values)
     pin(locals())
Exemple #3
0
 def __init__(self, v, e=None):
     v = np.asarray(v)
     assert v.ndim == 1
     if e is None:
         e = np.zeros_like(v, dtype=bool)
     else:
         e = np.asarray(e, dtype=bool)
         assert e.shape == v.shape
     e[0] = e[-1] = True
     pin(locals())
Exemple #4
0
 def __init__(
     self,
     label=None,
     xtitle=None,
     ytitle="Entries",
     binning=[],
     unit=None,
     metadata={},
     register=True,
 ):
     pin(locals())
Exemple #5
0
 def __init__(self, path, config=None):
     path = Path(path)
     if path.suffix == ".info" and path.is_file():
         config = parse_config(path, config)
         path = path.parent
     elif path.is_dir():
         config = parse_config(
             path.joinpath(path.name).with_suffix(".info"), config)
     else:
         raise ValueError("path not understood: %r" % path)
     _pdfs = CacheDict(self._make_pdf)
     pin(locals())
Exemple #6
0
 def __init__(self, analysis, category, variable, hists, config_inst, year):
     if not self._processes:
         raise Exception("Processes have to be defined!")
     if not issubclass(self._processes, IntEnum):
         raise Exception(
             f"{self.processes} has to be subclassed from <IntEnum>")
     # e.g.: category = "ee_2b"
     channel = category.split("_")[0]
     _nuisances_names = []
     _valid_processes = []
     _nuisances_renaming = {}
     _newhists = {}
     console = Console()
     pin(locals())
Exemple #7
0
 def auto(cls, model_path, **kwargs):
     if not isinstance(model_path, dict):
         model_path = dict(default=model_path)
     tmp = TemporaryDirectory(prefix="tf_server_ahoc")
     tmp_path = Path(tmp.name)
     dirs = {}
     for model, path in model_path.items():
         path = Path(path)
         if not path.is_dir():
             raise RuntimeError("%s: %s is not a dir" % (model, path))
         b = tmp_path.joinpath(model)
         dirs[model] = b.absolute().as_posix()
         if path.joinpath("saved_model.pb").is_file():
             b.mkdir()
             b = b.joinpath("1")
         b.symlink_to(path.absolute(), True)
     del model, path, b
     if len(dirs) > 1:
         mc = tmp_path.joinpath("model_config.txt.pb")
         kwargs["model_config_file"] = mc.absolute()
         with mc.open("w") as f:
             f.write(
                 str(
                     ModelServerConfig(model_config_list=ModelConfigList(
                         config=[
                             ModelConfig(name=key,
                                         base_path=value,
                                         model_platform="tensorflow")
                             for key, value in dirs.items()
                         ]))))
     else:
         ((kwargs["model_name"],
           kwargs["model_base_path"]), ) = dirs.items()
     kwargs.setdefault("grpc_socket_path",
                       tmp_path.joinpath("sock").absolute())
     self = cls.relieable(**kwargs)
     pin(locals(), cls)
     return self
Exemple #8
0
 def __init__(self, x, y, e=None):
     x = Coord(x, e)
     del e
     pin(locals())
Exemple #9
0
 def __init__(self, block, xfx):
     pin(locals())
Exemple #10
0
 def __init__(self, config):
     pin(locals())
     # assert None not in set(map(self.threshold, flavors))
     assert None not in set(map(self.mass, flavors))
Exemple #11
0
 def __init__(self, func):
     assert callable(func)
     pin(locals())
Exemple #12
0
 def __init__(self, pdf, x, q, pdgId, xfx, eq):
     assert xfx.ndim == 3
     assert xfx.shape == (len(pdgId), ) + x.shape + q.shape
     xfx = np.ascontiguousarray(xfx)
     pin(locals())
Exemple #13
0
 def __init__(self, path, config=None):
     self.name = path.name
     config, skip = self._parse_config(path, config)
     assert config["Format"] == "lhagrid1"
     blocks = list(self._merge_blocks(self._parse_blocks(path, skip)))
     pin(locals())
Exemple #14
0
 def __init__(self, path, config=None):
     path = Path(path)
     assert path.is_dir()
     config = parse_config(path.joinpath("lhapdf.conf"), config)
     pin(locals())
Exemple #15
0
 def __init__(self, address, **kwargs):
     if isinstance(address, BaseServer):
         self.server = address
         address = address.address
     pin(locals())