Exemplo n.º 1
0
    def test_addLogLevelOptionToArgs(self):
        for level_name in Logging.getLogLevels():
            parser = argparse.ArgumentParser()
            with self.assertRaises(exceptions.SystemExit):
                parser.parse_args(['--log_level', level_name])

            Logging.addLogLevelOptionToArgs(parser)

            with self.assertRaises(exceptions.SystemExit):
                parser.parse_args(['--log_level'])

            parser.parse_args(['--log_level', level_name])
Exemplo n.º 2
0
    def test_addLogLevelOptionToArgs(self):
        for level_name in Logging.getLogLevels():
            parser = argparse.ArgumentParser()
            with self.assertRaises(exceptions.SystemExit):
                parser.parse_args(['--log_level', level_name])

            Logging.addLogLevelOptionToArgs(parser)

            with self.assertRaises(exceptions.SystemExit):
                parser.parse_args(['--log_level'])

            parser.parse_args(['--log_level', level_name])
Exemplo n.º 3
0
from gnomon import GeneratorAction
from gnomon import TrackingAction
from gnomon.DetectorConstruction import VlenfDetectorConstruction
from gnomon.Configuration import RUNTIME_CONFIG as rc
from gnomon import Logging

from scipy.stats import uniform

log = None  # Logger for this file


if __name__ == "__main__":
    desc = 'Simulate the NuSTORM experiment magnetized iron detectors'
    parser = argparse.ArgumentParser(description=desc)

    Logging.addLogLevelOptionToArgs(parser)  # adds --log_level

    Configuration.populate_args(parser)
    parser.add_argument('--name', '-n', help='DB in CouchDB for output',
                        type=str, required=True)
    parser.add_argument('--run', '-r', help='run number',
                        type=int, required=True)

    args = parser.parse_args()

    config_class = Configuration.DEFAULT(args.name, args.run,
                                         overload=vars(args))
    Configuration.GLOBAL_CONFIG = config_class.get_configuration_dict()

    Logging.setupLogging(args.log_level, args.name)
    log = logging.getLogger('root').getChild('simulate')