Main simulation wrapper
    Load the configuration, run the engine and return the analyze.
515789
def intuition(args):
    '''
    
    '''

    # Use the provided context builder to fill:
    #   - config: General behavior
    #   - strategy: Modules properties
    #   - market: The universe we will trade on
    with setup.Context(args['context']) as context:

        # Backtest or live engine.
        # Registers configuration and setups data client
        simulation = Simulation()

        # Intuition building blocks
        modules = context['config']['modules']

        # Prepare benchmark, timezone, trading calendar
        simulation.configure_environment(
            context['config']['index'][-1],
            context['market'].benchmark,
            context['market'].timezone)

        # Wire togetether modules and initialize them
        simulation.build(args['session'],
                         modules,
                         context['strategy'])

        # Build data generator
        # NOTE How can I use several sources ?
        data = {'universe': context['market'],
                'index': context['config']['index']}
        # Add user settings
        data.update(context['strategy']['data'])
        # Load backtest and / or live module(s)
        if 'backtest' in modules:
            data['backtest'] = utils.intuition_module(modules['backtest'])
        if 'live' in modules:
            data['live'] = utils.intuition_module(modules['live'])

        # Run the simulation and return an intuition.core.analyzes object
        return simulation(datafeed.HybridDataFactory(**data), args['bot'])
180975
def main():
    
    setup_main()
    config = ConfigData(clean=True)
    try:
        config.upload()
    finally:
        config.clean_after_if_needed()
36297
def run_analysis
      @filesPathProject = get_project_file(@configurationInfo[:source])
      unless @filesPathProject
        message = "Problem on source path: #{@configurationInfo[:source]}"
        Util::LoggerKuniri.error(message)
        return -1
      end
      @parser = Parser::Parser.new(@filesPathProject,
                                   @configurationInfo[:language])
      Util::LoggerKuniri.info('Start parse...')
      begin
        @parser.start_parser
      rescue Error::ConfigurationFileError => e
        puts e.message
      end
    end
1123582
def main(args=None):
    """"""
    if args is None:
        args = sys.argv[1:]

    print("This is the main routine.")
    print("It should do something interesting.")
    #################################################################################################################

    parser = ArgumentParser(description='Analysis and visualisation tool for protein ligand interactions. Requires rdkit, shapely, MDAnalysis.')
    parser.add_argument('-cfg', '--config', dest = 'config', default=None, help='Configuration file')
    parser.add_argument('-t', '--topology', dest = 'topology', default=None, help='Topology file')
    parser.add_argument('-x', '--trajectory', dest = "trajectory", nargs="*", default=[], help='Trajectory file(s)')
    parser.add_argument('-o', '--outname', dest = "output_name", help='Name for output folder and file')
    parser.add_argument('-c', '--cutoff', dest = "cutoff", default = 3.5, help='Cutoff distance in angstroms.')
    parser.add_argument('-ac', '--analysis_cutoff', dest = "analysis_cutoff", default=0.3, help='Analysis cutoff - a feature has to appear for at least a fraction of the simulation to be plotted.')

    args = parser.parse_args()

    ####################################################################################################################



    if args.config!=None:
        #If config file exists, args.will be ingnored
        print "#####################################################################"
        print "WARNING"
        print "The arguments from command line will be ignored,"
        print "if you want to make changes, do so in the configuration file."
        print "  "
        print "  "
        print "######################################################################"
        with open(args.config, "r") as ymlfile:
            cfg = yaml.load(ymlfile)
        ## Check config file input - mainly topology and output file, also handling bad input

        lintools = Lintools(cfg['input']['topology'],cfg['input']['trajectory'],cfg['input']['mol file'],cfg['input']['ligand'],cfg['input']['offset'],float(cfg['input']['distance cutoff']),cfg['input']['traj start'],cfg['input']['traj end'],cfg['input']['traj skip'],cfg['input']['analysis cutoff'],cfg['input']['diagram type'],cfg['input']['output name'],cfg=True)
        lintools.save_files()
        lintools.data_input_and_res_time_analysis()
        lintools.analysis_of_prot_lig_interactions()
        lintools.plot_residues(cfg['representation']['clock color scheme'])
        lintools.write_config_file(args.config)
        lintools.draw_figure(cfg['representation']['data to show in color'], cfg['representation']['data to show as size'], cfg['representation']['data to show as cloud'], cfg['representation']['rotatable bonds'],cfg['representation']['cloud color scheme'], cfg['representation']['atom color scheme'])
        lintools.remove_files()
    else:
        assert len(args.topology) >0, "No topology file provided for analysis."
        assert len(args.output_name)>0,"No output name provided."
        def find_ligand_name():
            """Users select a ligand to analyse from a numbered list."""
            gro = MDAnalysis.Universe(args.topology)
            list_of_non_ligands=["SOL","NA","CL","HOH","ARG","LYS","HIS","ASP","GLU","SER","THR", "ASN","GLN","PHE","TYR","TRP","CYS","GLY","PRO","ALA","VAL","ILE","LEU","MET"]
            potential_ligands={}
            i=0
            for residue in gro.residues:
                if residue.atoms.resnames[0] not in list_of_non_ligands:
                    try:
                        if residue.atoms.altLocs[0]==str("") or  residue.atoms.altLocs[0]==None:
                            potential_ligands[i]=residue.atoms
                        else:
                            #Deal with ligands that have alternative locations
                            altloc = str(residue.atoms.altLocs[1])
                            resid = residue.atoms.resids[0]
                            new_residue = residue.select_atoms("resid "+str(resid)+" and altloc "+str(altloc))
                            potential_ligands[i] = new_residue
                    except Exception as e:
                        potential_ligands[i]=residue.atoms
                    i+=1


            print "# Nr  # Name   # Resnumber  # Chain ID"
            for lig in potential_ligands:
                print lig, potential_ligands[lig].resnames[0], potential_ligands[lig].resids[0], potential_ligands[lig].segids[0]

            while True:
                raw = raw_input( "Choose a ligand to analyse:")
                try:
                    if int(raw) in [x[0] for x in enumerate(potential_ligands.keys())] :
                        break
                    else:
                        print "Error. No such group "+str(raw)
                except ValueError:
                    print "Error. No such group "+str(raw)
                    pass
            ligand_name=potential_ligands[int(raw)]
            return "resid "+str(ligand_name.resids[0])+" and segid "+str(ligand_name.segids[0])

        def find_diagram_type():
            """User selects diagram type for the residue plots."""
            available_diagrams={1:"amino", 2:"domains",3:"clock"}
            for diagram in available_diagrams:
                print diagram, " : ", available_diagrams[diagram]
            while True:
                raw_d = raw_input( "Choose diagram type:")
                try:
                    if int(raw_d)-1 in [x[0] for x in enumerate(available_diagrams.keys())] :
                        break
                    else:
                        print "Error. No such group "+str(raw_d)
                except ValueError:
                    print "Error. No such group "+str(raw_d)
                    pass
            diagram_type=available_diagrams[int(raw_d)]
            return diagram_type


        ligand_name = find_ligand_name()
        diagram_type = find_diagram_type()

        lintools = Lintools(args.topology,args.trajectory,None,ligand_name,0,args.cutoff,[None],[None],[None],float(args.analysis_cutoff),diagram_type,args.output_name,cfg=False)
        lintools.save_files()
        lintools.data_input_and_res_time_analysis()
        lintools.analysis_of_prot_lig_interactions()
        lintools.plot_residues()
        lintools.write_config_file(None)
        lintools.draw_figure()
        lintools.remove_files()
1051050
def main(arguments=None):
    ''''''
    if arguments is None:
        arguments = sys.argv[1:]

    server_parameters = get_server_parameters(arguments)
    config = get_config(server_parameters.config_path, server_parameters.use_environment)
    configure_log(config, server_parameters.log_level.upper())

    validate_config(config, server_parameters)

    importer = get_importer(config)

    with get_context(server_parameters, config, importer) as context:
        application = get_application(context)
        server = run_server(application, context)
        setup_signal_handler(server, config)
        logging.debug('thumbor running at %s:%d' % (context.server.ip, context.server.port))
        tornado.ioloop.IOLoop.instance().start()
367946
def run_analysis(self, argv):
        """"""
        args = self._parser.parse_args(argv)

        if not HAVE_ST:
            raise RuntimeError(
                "Trying to run fermipy analysis, but don't have ST")

        workdir = os.path.dirname(args.config)
        _config_file = self._clone_config_and_srcmaps(args.config, args.seed)

        gta = GTAnalysis(_config_file, logging={'verbosity': 3},
                         fileio={'workdir_regex': '\.xml$|\.npy$'})
        gta.load_roi(args.roi_baseline)

        simfile = os.path.join(workdir, 'sim_%s_%s.yaml' %
                               (args.sim, args.sim_profile))

        mcube_file = "%s_%s_%06i" % (args.sim, args.sim_profile, args.seed)
        sim_config = utils.load_yaml(simfile)

        injected_source = sim_config.get('injected_source', None)
        if injected_source is not None:
            src_dict =  injected_source['source_model']
            src_dict['ra'] = gta.config['selection']['ra']
            src_dict['dec'] = gta.config['selection']['dec']
            injected_name = injected_source['name']
            gta.add_source(injected_name, src_dict)
            gta.write_model_map(mcube_file)
            mc_spec_dict = dict(true_counts=gta.model_counts_spectrum(injected_name),
                                energies=gta.energies,
                                model=src_dict)
            mcspec_file = os.path.join(workdir,
                                       "mcspec_%s_%06i.yaml" % (mcube_file, args.seed))
            utils.write_yaml(mc_spec_dict, mcspec_file)
        else:
            injected_name = None

        gta.write_roi('sim_baseline_%06i' % args.seed)

        test_sources = []
        for profile in args.profiles:
            profile_path = os.path.join(workdir, 'profile_%s.yaml' % profile)
            test_source = load_yaml(profile_path)
            test_sources.append(test_source)
            first = args.seed
            last = first + args.nsims
            for seed in range(first, last):
                self._run_simulation(gta, args.roi_baseline,
                                     injected_name, test_sources, first, seed,
                                     non_null_src=args.non_null_src)
45494
def run_analysis(ast, vm, report)
      classes = configuration.analysis_classes.select do |const|
        const.analyze?(ast, vm)
      end

      classes.each do |const|
        instance = const.new(
          :vm     => vm,
          :report => report,
          :config => configuration
        )

        instance.iterate(ast)
      end
    end
1225301
def run_analysis(self, argv):
        """"""
        args = self._parser.parse_args(argv)

        name_keys = dict(target_type=args.ttype,
                         target_name=args.target,
                         sim_name=args.sim,
                         fullpath=True)

        orig_dir = NAME_FACTORY.targetdir(**name_keys)
        dest_dir = NAME_FACTORY.sim_targetdir(**name_keys)
        self.copy_target_dir(orig_dir, dest_dir,
                             args.roi_baseline, args.extracopy)
1171800
def run(self, **kwargs):
        
        from calculate import compute
        self.app_main(**kwargs)

        # get the default output name
        output = osp.join(self.exp_config['expdir'], 'output.dat')

        # save the paths in the configuration
        self.exp_config['output'] = output

        # run the model
        data = np.loadtxt(self.exp_config['infile'])
        out = compute(data)
        # save the output
        self.logger.info('Saving output data to %s', osp.relpath(output))
        np.savetxt(output, out)

        # store some additional information in the configuration of the
        # experiment
        self.exp_config['mean'] = mean = float(out.mean())
        self.exp_config['std'] = std = float(out.std())
        self.logger.debug('Mean: %s, Standard deviation: %s', mean, std)
959386
def start(cls, ev=None):
        
        ViewController.log_view.add("Beginning AnalysisRunner request..")

        # reset all inputs
        ViewController.reset_bars()

        # read the urlbox
        url = ViewController.url.strip()

        # make sure, that `url` was filled
        if not url:
            ViewController.urlbox_error.show("URL musí být vyplněna.")
            return

        if is_issn(url):
            ViewController.url_progressbar.hide()
            ViewController.url = ""
            ViewController.issn = url
            AlephISSNReaderAdapter.start()
            return

        ViewController.urlbox_error.hide()

        # normalize the `url`
        if not (url.startswith("http://") or url.startswith("https://")):
            url = "http://" + url
            ViewController.url = url  # store normalized url back to input

        make_request(
            url=join(settings.API_PATH, "analyze"),
            data={'url': url},
            on_complete=cls.on_complete
        )
17591
def main(global_config, **settings):
    
    config = Configurator(settings=settings)

    includeme(config)
    return config.make_wsgi_app()
414809
def main(_):
  """"""
  utility.set_up_logging()
  if not FLAGS.config:
    raise KeyError('You must specify a configuration.')
  logdir = FLAGS.logdir and os.path.expanduser(os.path.join(
      FLAGS.logdir, '{}-{}'.format(FLAGS.timestamp, FLAGS.config)))
  try:
    config = utility.load_config(logdir)
  except IOError:
    config = tools.AttrDict(getattr(configs, FLAGS.config)())
    config = utility.save_config(config, logdir)
  for score in train(config, FLAGS.env_processes):
    tf.logging.info('Score {}.'.format(score))
627023
def main(global_settings, **settings):
    """"""
    my_session_factory = SignedCookieSessionFactory('itsaseekreet')
    # Add session engine
    config = Configurator(
        settings=settings,
        session_factory=my_session_factory
    )
    # Add static and templates
    config.add_static_view(name='static', path='static')
    config.include('pyramid_jinja2')
    config.add_jinja2_search_path('templates')
    config.include('ps_crud')

    # Setting up pyramid_sacrud
    config.include('pyramid_sacrud', route_prefix='admin')
    settings = config.get_settings()
    settings['pyramid_sacrud.models'] = (
        ('Docker', [Image(), ]),
    )

    # Make app
    config.scan('views')
    return config.make_wsgi_app()
102077
def main(args=None, transform_func=None):
    """"""
    args = get_args(args)

    utils.init_log(args.log_level)

    try:
        config = _get_config(args)
    except Dump2PolarionException as err:
        logger.fatal(err)
        return 1

    return dumper(args, config, transform_func=transform_func)
178058
def run_main(args: argparse.Namespace, do_exit=True) -> None:
    
    if args.init:
        generate()
        return None  # exit after generate instead of starting to lint

    handler = CheckHandler(
        file=args.config_file, out_json=args.json, files=args.files)

    for style in get_stylers():
        handler.run_linter(style())

    for linter in get_linters():
        handler.run_linter(linter())

    for security in get_security():
        handler.run_linter(security())

    for tool in get_tools():
        tool = tool()

        # Only run pypi if everything else passed
        if tool.name == "pypi" and handler.status_code != 0:
            continue

        handler.run_linter(tool)

    if do_exit:
        handler.exit()
    return handler.status_code
1120256
def main():
    """"""
    __async__ = True
    logging.basicConfig(format="%(levelname)-10s %(message)s",
                        level=logging.DEBUG)

    if len(sys.argv) != 2:
        logging.error("Must specify configuration file")
        sys.exit()
    config = configparser.ConfigParser()
    config.read(sys.argv[1])

    password = config.get('default', 'password')
    if __async__:
        client = Client(config.get('default', 'host'),
                        config.getint('default', 'port'), password, _callback)
    else:
        client = Client(config.get('default', 'host'),
                        config.getint('default', 'port'),
                        password)
        status = client.messages()
        msg = status[0]
        print(msg)
        print(client.mp3(msg['sha'].encode('utf-8')))
    while True:
        continue
1258526
def main(global_config, **settings):
    """"""
    engine = engine_from_config(settings, "sqlalchemy.")

    DBSession.configure(bind=engine)

    Base.metadata.bind = engine

    config = Configurator(settings=settings)

    config.include("pyramid_jinja2")

    config.include("pyramid_debugtoolbar")

    config.add_route("home", "/")

    config.add_route("data", "/data")

    config.add_route("data_advanced", "/data_advanced")

    config.add_route("data_yadcf", "/data_yadcf")

    config.add_route("dt_110x", "/dt_110x")

    config.add_route("dt_110x_custom_column", "/dt_110x_custom_column")

    config.add_route("dt_110x_basic_column_search",
                     "/dt_110x_basic_column_search")

    config.add_route("dt_110x_advanced_column_search",
                     "/dt_110x_advanced_column_search")

    config.add_route("dt_110x_yadcf", "/dt_110x_yadcf")

    config.scan()

    json_renderer = JSON()

    json_renderer.add_adapter(date, date_adapter)

    config.add_renderer("json_with_dates", json_renderer)

    config.add_jinja2_renderer('.html')

    return config.make_wsgi_app()