magnus.cli

cli.py

Command-line calculator for Mag$nu$s: computes a single neutrino oscillation probability (or probability matrix) from the command line, without writing any Python. Wraps the same osc_prob_{2,3,4,5}nu_* functions used by the Python API (see magnus.oscprob and Command-Line Calculator), dispatching to the right one based on --flavors, --environment, and --scenario.

Installed as the magnus console script (see [project.scripts] in pyproject.toml) and also runnable as python -m magnus.

Routine listings

  • main - Entry point: parses argv, dispatches, prints the result

  • build_parser - Builds the argparse.ArgumentParser

  • FLAVOR_NAME_TO_INDEX - Maps flavor names (e, mu, tau, s, s1, s2)

    to their globaldefs index

  • ENERGY_UNITS, LENGTH_UNITS - Unit-name to \(\text{eV}\) / \(\text{eV}^{-1}\)

    conversion factors

Attributes

ENERGY_UNITS

LENGTH_UNITS

FLAVOR_NAME_TO_INDEX

FLAVOR_LABELS

ALWAYS_FORWARD

Functions

build_parser(→ argparse.ArgumentParser)

Builds the magnus command-line argument parser.

main(→ int)

Entry point for the magnus console script / python -m magnus.

Module Contents

magnus.cli.ENERGY_UNITS[source]
magnus.cli.LENGTH_UNITS[source]
magnus.cli.FLAVOR_NAME_TO_INDEX[source]
magnus.cli.FLAVOR_LABELS[source]
magnus.cli.ALWAYS_FORWARD[source]
magnus.cli.build_parser() argparse.ArgumentParser[source]

Builds the magnus command-line argument parser.

Added in version 1.0.0.

Returns:

The top-level parser, with the prob subcommand attached.

Return type:

argparse.ArgumentParser

magnus.cli.main(argv=None) int[source]

Entry point for the magnus console script / python -m magnus.

Added in version 1.0.0.

Parameters:

argv (list of str, optional) – Arguments to parse instead of sys.argv[1:] (mainly for testing).

Returns:

Process exit code (0 on success).

Return type:

int