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, --scenario and --density-profile.
Installed as the magnus console script (see [project.scripts]
in pyproject.toml) and also runnable as python -m magnus. Its one
subcommand, prob, is the default: magnus --flavors 3 ... runs
magnus prob --flavors 3 ... (issue #138).
Routine listings
main - Entry point: parses argv, dispatches, prints the result
build_parser - Builds the argparse.ArgumentParser
SUBCOMMANDS - The subcommands build_parser registers; the first is the default
- 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
FLAVOR_LABELS - Row and column names used by the printed table
ALWAYS_FORWARD - Numerics keywords forwarded to every wrapper
- DENSITY_PROFILES - Values
--density-profileaccepts: ‘constant’, ‘exp’, andevery tabulated solar model in
magnus.solarmodels
Attributes
Module-level constant |
Functions
|
Builds the |
|
Entry point for the |
Module Contents
- magnus.cli.DENSITY_PROFILES = ('constant', 'exp', 'BP2000', 'BP04', 'BS05-OP', 'BS05-AGS-OP', 'B16-GS98', 'B16-AGSS09met',...[source]
- magnus.cli.SUBCOMMANDS = ('prob',)[source]
Module-level constant
The subcommands
build_parser()registers. The first,prob, is the default: a command line that names none runs it (issue #138).Added in version 1.2.0.
- magnus.cli.build_parser() argparse.ArgumentParser[source]
Builds the
magnuscommand-line argument parser.Added in version 1.0.0.
- Returns:
argparse.ArgumentParser – The top-level parser, with the
probsubcommand attached (also kept as itsdefault_subparserattribute). Its epilog says thatprobis the default subcommand, whichmain()supplies when none is given, and its-hprints the help ofprobafter its own... versionchanged:: 1.2.0 – The epilog names
probas the default subcommand, andmagnus -halso prints the options ofprob(issue #138)... versionchanged:: 1.2.0 – The –magnus-exp-order help states that ‘gl’ takes the even orders from 2 to 8 (issue #160 §5).
- magnus.cli.main(argv=None) int[source]
Entry point for the
magnusconsole script /python -m magnus.A command line that names no subcommand runs
prob, the only one:magnus --flavors 3 ...ismagnus prob --flavors 3 ....Added in version 1.0.0.
Changed in version 1.2.0:
probis optional (issue #138).- Parameters:
argv (list of str, optional) – Arguments to parse instead of
sys.argv[1:](mainly for testing).- Returns:
Always 0. Every failure leaves through
SystemExitinstead, so this function has no non-zero return.- Return type:
- Raises:
SystemExit – Exit code 2 for an argparse error or a value the library rejects, and 1 for a combination of flags that
_env_kwargsor_wrapper_namerefuses.