def __enter__(self): """Load observable file in memory, using `with obs`. Note: Except random bugs due to APPLGrid poor implementation when loading several observables in the same process. In particular,pdf convolutions of grids made with AMCFast will not work.""" global _selected_grid if _selected_grid == self.filename: return if _selected_grid is not None: raise RuntimeError("Contrdicting observable scope. " "Was %s and trying to enter %s" % (_selected_grid, self.filename)) with contextlib.ExitStack() as stack: if not logging.getLogger().isEnabledFor(logging.DEBUG): stack.enter_context(supress_stdout()) applwrap.initobs(self.filename) _selected_grid = self.filename
def test_bad_values(self): with self.assertRaises(ValueError): applwrap.initobs("patata") with self.assertRaises(ValueError): applwrap.initpdf("patata")