diff --git a/benchmarks/bench_cli.py b/benchmarks/bench_cli.py index fb6aed62..a4460759 100644 --- a/benchmarks/bench_cli.py +++ b/benchmarks/bench_cli.py @@ -81,7 +81,7 @@ def benchmark_compare_cli(lhapdf_path, test_files, test_pdf): with lhapdf_path(test_pdf): result = runner.invoke( command, - ["compare", str(grid_path), str(fk_path), "2", "0", "NNPDF40_nlo_as_01180"], + ["compare", str(fk_path), str(grid_path), "2", "0", "NNPDF40_nlo_as_01180"], ) assert "yll left" in result.output @@ -95,7 +95,7 @@ def benchmark_convolve_cli(test_files, tmp_path): runner = CliRunner() result = runner.invoke( command, - ["convolve", str(grid_path), str(fk_path), "2", "0", str(eko_path)], + ["convolve", str(fk_path), str(grid_path), "2", "0", str(eko_path)], ) assert "Optimizing for Nf6Ind" in result.output diff --git a/docs/source/overview/running.rst b/docs/source/overview/running.rst index fe2bb123..ef1ee4b7 100644 --- a/docs/source/overview/running.rst +++ b/docs/source/overview/running.rst @@ -50,7 +50,7 @@ Then you can convolve the |EKO| with the grids by running:: Note that you can also convolve a single grid with a single eko (obtaining a single FK table) by running:: - pineko convolve GRID FKTABLE MAX_AS MAX_AL OP_PATH_1 OP_PATH_2 + pineko convolve FKTABLE GRID MAX_AS MAX_AL OP_PATH_1 OP_PATH_2 If necessary it is possible to specify the values of the *renormalization* and *factorization* scale variations with the options ``--xir`` and ``--xif``. @@ -91,7 +91,7 @@ Comparing grids and FK tables With the command ``pineko compare`` it is possible to compare the predictions as provided by the grid (convolved with a |PDF|) with the predictions as provided by the |FK| table. This is done like - pineko compare GRID FKTABLE MAX_AS MAX_AL PDF_1 PDF_2 + pineko compare FKTABLE GRID MAX_AS MAX_AL PDF_1 PDF_2 again eventually specifying the values of *renormalization* and *factorization* scales with the appropriate options. diff --git a/src/pineko/cli/compare.py b/src/pineko/cli/compare.py index f018dc1a..ac711316 100644 --- a/src/pineko/cli/compare.py +++ b/src/pineko/cli/compare.py @@ -9,14 +9,14 @@ @command.command("compare") -@click.argument("pineappl_path", type=click.Path(exists=True)) @click.argument("fktable_path", type=click.Path()) +@click.argument("grid_path", type=click.Path(exists=True)) @click.argument("max_as", type=int) @click.argument("max_al", type=int) @click.argument("pdfs", type=click.STRING, nargs=-1) @click.option("--xir", default=1.0, help="renormalization scale variation") @click.option("--xif", default=1.0, help="factorization scale variation") -def subcommand(pineappl_path, fktable_path, max_as, max_al, pdfs, xir, xif): +def subcommand(fktable_path, grid_path, max_as, max_al, pdfs, xir, xif): """Compare process level PineAPPL grid and derived FK Table. The comparison between the grid stored at PINEAPPL_PATH, and the FK table @@ -29,7 +29,7 @@ def subcommand(pineappl_path, fktable_path, max_as, max_al, pdfs, xir, xif): XIR and XIF represent the renormalization and factorization scale in the grid respectively. """ - pine = pineappl.grid.Grid.read(pineappl_path) + pine = pineappl.grid.Grid.read(grid_path) fk = pineappl.fk_table.FkTable.read(fktable_path) pdf1 = pdfs[0] pdf2 = pdfs[1] if len(pdfs) == 2 else None diff --git a/src/pineko/cli/convolve.py b/src/pineko/cli/convolve.py index 2f91072a..45853d08 100644 --- a/src/pineko/cli/convolve.py +++ b/src/pineko/cli/convolve.py @@ -10,8 +10,8 @@ @command.command("convolve") -@click.argument("grid_path", type=click.Path(exists=True)) @click.argument("fktable", type=click.Path()) +@click.argument("grid_path", type=click.Path(exists=True)) @click.argument("max_as", type=int) @click.argument("max_al", type=int) @click.argument("op_paths", type=click.Path(exists=True), nargs=-1) @@ -34,8 +34,8 @@ show_default=True, ) def subcommand( - grid_path, fktable, + grid_path, max_as, max_al, op_paths, @@ -72,7 +72,8 @@ def subcommand( rich.print( rich.panel.Panel.fit("Computing ...", style="magenta", box=rich.box.SQUARE), f" {grid_path}\n", - f"+ {op_paths}\n", + f"+ {op_paths[0]}\n", + f"+ {op_paths[1]}\n" if n_ekos > 1 else "", f"= {fktable}\n", f"with max_as={max_as}, max_al={max_al}, xir={xir}, xif={xif}", f"min_as: {min_as}" if min_as is not None else "", diff --git a/src/pineko/comparator.py b/src/pineko/comparator.py index 94cec74f..949297e9 100644 --- a/src/pineko/comparator.py +++ b/src/pineko/comparator.py @@ -35,15 +35,12 @@ def compare(pine, fktable, max_as, max_al, pdf1, xir, xif, pdf2=None): import lhapdf # pylint: disable=import-error,import-outside-toplevel pdfset1 = lhapdf.mkPDF(pdf1, 0) - pdgid1 = int(pdfset1.set().get_entry("Particle")) - if pdf2 is not None: pdfset2 = lhapdf.mkPDF(pdf1, 0) - pdgid2 = int(pdfset2.set().get_entry("Particle")) else: pdfset2 = pdfset1 - pdgid2 = pdgid1 + # TODO: This should probably changed in the future to use the Grid::convolutions try: parton1 = pine.key_values()["convolution_particle_1"] parton2 = pine.key_values()["convolution_particle_2"] @@ -56,9 +53,9 @@ def compare(pine, fktable, max_as, max_al, pdf1, xir, xif, pdf2=None): if hadronic: before = np.array( pine.convolve_with_two( - pdg_id1=pdgid1, + pdg_id1=parton1, xfx1=pdfset1.xfxQ2, - pdg_id2=pdgid2, + pdg_id2=parton2, xfx2=pdfset2.xfxQ2, alphas=pdfset1.alphasQ2, order_mask=order_mask, @@ -66,19 +63,19 @@ def compare(pine, fktable, max_as, max_al, pdf1, xir, xif, pdf2=None): ) ) after = np.array( - fktable.convolve_with_two(pdgid1, pdfset1.xfxQ2, pdgid2, pdfset2.xfxQ2) + fktable.convolve_with_two(parton1, pdfset1.xfxQ2, parton2, pdfset2.xfxQ2) ) else: before = np.array( pine.convolve_with_one( - pdgid1, + parton1, pdfset1.xfxQ2, pdfset1.alphasQ2, order_mask=order_mask, xi=((xir, xif),), ) ) - after = np.array(fktable.convolve_with_one(pdgid1, pdfset1.xfxQ2)) + after = np.array(fktable.convolve_with_one(parton1, pdfset1.xfxQ2)) df = pd.DataFrame() # add bin info diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index 02c4e51f..d0779b00 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -57,15 +57,16 @@ def get_ekos_convolution_type(kv): kv: dict pineappl grid metadata """ + # TODO: This should probably changed in the future to use the Grid::convolutions if "convolution_type_1" in kv: conv_type_1 = kv["convolution_type_1"] - # TODO: this case is now deprecated and should be remved from yadism and pinefarm + # TODO: polarized is now deprecated, needed for compatibility elif "polarized" in kv and kv["polarized"]: conv_type_1 = "PolPDF" else: conv_type_1 = "UnpolPDF" - # TODO: initial_state_2 is now deprecated, needed for comatibility + # TODO: initial_state_2 is now deprecated, needed for compatibility if "convolution_particle_2" in kv: part_2 = kv["convolution_particle_2"] else: @@ -413,7 +414,7 @@ def prepare(operator, items): fktable.set_key_value("eko_operator_card", json.dumps(operators1.operator_card.raw)) if operators2 is not None: fktable.set_key_value( - "eko_operator_card_b", json.dumps(operators2.operator_card.raw) + "eko_operator_card_2", json.dumps(operators2.operator_card.raw) ) fktable.set_key_value("pineko_version", version.__version__)