Esempio n. 1
0
    def nest(self, parameter_s='', local_ns=None):
        """ Start the MultiNest analysis and handle data interaction and IO """
        from shell_colors import red

        if local_ns.has_key('default'):
            system = local_ns['default']
            core.do_multinest(system)
        else:
            msg = red('ERROR: ') + 'Set a default system or provide a system '+\
                                   'name with the -n option'
            clogger.fatal(msg)
            return
Esempio n. 2
0
    def nest(self, parameter_s='', local_ns=None):
        """ Start the MultiNest analysis and handle data interaction and IO """
        from shell_colors import red

        try:
            args = parse_arg_string('nest', parameter_s)
        except DocoptExit:
            print nest_usage.lstrip()
            return
        except SystemExit:
            return
        # print args

        if 'default' in local_ns:
            system = local_ns['default']
        else:
            msg = red('ERROR: ') + 'Set a default system or provide a system '+\
                                   'name with the -n option'
            clogger.fatal(msg)
            return

        user = args['-u']
        resume = args['-r']
        verbose = args['-v']
        gp = args['--gp']
        jitter = args['--jitter']
        if gp and jitter:
            msg = red('ERROR: ') + '--gp and --jitter are incompatible'
            clogger.fatal(msg)
            return
        doplot = not args['--noplot']
        saveplot = args['--saveplot']
        dofeedback = args['--feed']
        doMAPfeedback = args['--MAPfeed']
        maxp = int(args['--maxp'])
        restart = args['--restart']
        nml_path = args['--nml']

        startp = args['--startp']
        if startp is not None:
            startp = [int(i) for i in startp.split(',')]
        else:
            startp = []

        try: 
            ncpu = int(args['--ncpu'])
        except TypeError:
            ncpu = None

        train_quantity = args['--train'] if bool(args['--train']) else None
        skip_train_mcmc = args['--skip-mcmc']
        lin_quantity = args['--lin'] if bool(args['--lin']) else None

        if bool(args['--train']) and not system.is_in_extras(train_quantity):
            msg = red('ERROR: ') + 'The name "%s" is not available in extras.\n' % train_quantity
            clogger.fatal(msg)
            return

        core.do_multinest(system, user, gp, jitter, maxp=maxp,
                          resume=resume, ncpu=ncpu, verbose=verbose,
                          training=train_quantity, skip_train_mcmc=skip_train_mcmc, lin=lin_quantity, 
                          doplot=doplot, saveplot=saveplot, feed=dofeedback, MAPfeed=doMAPfeedback,
                          restart=restart, nml=nml_path, startp=startp)