Skip to content

Commit

Permalink
Fix ekobox/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Jul 24, 2023
1 parent e61c8e6 commit e40a718
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ekobox/cli/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def subcommand(ctx, path: pathlib.Path):
@click.pass_obj
def sub_mu2(operator: EKO):
"""Check operator's mu2grid."""
rich.print_json(data=operator.mu2grid.tolist())
rich.print_json(data=operator.mu2grid)


@subcommand.command("cards")
Expand Down
16 changes: 8 additions & 8 deletions src/ekobox/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def subcommand(paths: Sequence[pathlib.Path]):
else:
output = operator.parent / OUTPUT

theory = yaml.safe_load(theory.read_text(encoding="utf-8"))
if "order" in theory:
theory = TheoryCard.from_dict(theory)
operator = yaml.safe_load(operator.read_text(encoding="utf-8"))
if "configs" in operator:
operator = OperatorCard.from_dict(operator)

eko.solve(theory, operator, path=output)
tc = yaml.safe_load(theory.read_text(encoding="utf-8"))
if "order" in tc:
tc = TheoryCard.from_dict(tc)
oc = yaml.safe_load(operator.read_text(encoding="utf-8"))
if "configs" in oc:
oc = OperatorCard.from_dict(oc)

eko.solve(tc, oc, path=output)
4 changes: 3 additions & 1 deletion src/ekobox/cli/runcards.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import logging
import pathlib

import numpy as np

from .. import cards
from . import library as lib
from .base import command
Expand Down Expand Up @@ -34,6 +36,6 @@ def sub_example(destination: pathlib.Path):
cards.dump(theory.raw, path=destination / "theory.yaml")
operator = cards.example.operator()
operator.mu0 = 1.65
operator.mu2grid = [1e5]
operator.mugrid = [(np.sqrt(1e5), 5)]
cards.dump(operator.raw, path=destination / "operator.yaml")
_logger.info(f"Runcards generated to '{destination}'")

2 comments on commit e40a718

@felixhekhorn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alecandido let me repeat myself once more: all this ekobox/cli is dead code - we should drop it ... if ever we need it, we can recover it (also for the sake of #192)

@alecandido
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it's not creating any harm, and it has the increased benefit of exposing the simplest operation (solve) to the CLI.

If you don't care about the coverage, because it's not well-maintained, just whitelist ekobox.cli in coverage.

Please sign in to comment.