Ejemplo n.º 1
0
def main():
    """Main command-line interface"""
    parser = create_parser()
    args = parser.parse_args()

    config_logger(
        stream=True,
        stream_level=args.verbose,
        file=True,
        log_path=get_log_dir(),
    )
    logger.debug(args)

    module = importlib.import_module('andes.main')

    if args.command in ('plot', 'doc'):
        pass
    elif args.command == 'run' and args.no_preamble is True:
        pass
    else:
        preamble()

    if args.command is None:
        parser.parse_args(sys.argv.append('--help'))

    else:
        func = getattr(module, args.command)
        return func(cli=True, **vars(args))
Ejemplo n.º 2
0
def main():
    """
    Main command-line interface
    """

    parser = create_parser()
    args = parser.parse_args()

    if args.version is True:
        print(get_versions()['version'])
        return

    # Set up logging
    config_logger(
        stream=True,
        stream_level=args.verbose,
        file=True,
        log_path=get_log_dir(),
    )
    logger.debug(args)

    module = importlib.import_module('andes.main')

    if args.command in ('plot', 'doc'):
        pass
    elif args.command == 'run' and args.no_preamble is True:
        pass
    else:
        preamble()

    # Run the command
    if args.command is None:
        parser.parse_args(sys.argv.append('--help'))

    else:
        cmd = args.command
        for fullcmd, aliases in command_aliases.items():
            if cmd in aliases:
                cmd = fullcmd

        func = getattr(module, cmd)
        return func(cli=True, **vars(args))
Ejemplo n.º 3
0
def main():
    """Main command-line interface"""
    parser = create_parser()
    args = parser.parse_args()

    config_logger(log_path=get_log_dir(),
                  file=True,
                  stream=True,
                  stream_level=args.verbose)
    preamble()
    logger.debug(args)

    module = importlib.import_module('andes.main')

    if args.command is None:
        parser.parse_args(sys.argv.append('--help'))

    else:
        func = getattr(module, args.command)
        func(**vars(args))
Ejemplo n.º 4
0
"""
Andes plotting tool
"""

import logging
import os
import re
from distutils.spawn import find_executable

from andes.utils.misc import is_notebook
from andes.core.var import Algeb, State
from andes.main import config_logger
from andes.shared import np, mpl, plt

config_logger(log_file=None)
logger = logging.getLogger(__name__)


class TDSData(object):
    """
    A time-domain simulation data container for loading, extracing and
    plotting data
    """
    def __init__(self, file_name_full=None, mode='file', dae=None, path=None):
        # paths and file names
        self._mode = mode
        self.file_name_full = file_name_full
        self.dae = dae
        self._path = path if path else os.getcwd()
        self.file_name = None
        self._npy_file = None