当前位置: 首页>>代码示例>>Python>>正文


Python attrib.attr方法代码示例

本文整理汇总了Python中nose.plugins.attrib.attr方法的典型用法代码示例。如果您正苦于以下问题:Python attrib.attr方法的具体用法?Python attrib.attr怎么用?Python attrib.attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nose.plugins.attrib的用法示例。


在下文中一共展示了attrib.attr方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_tutorials

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def test_tutorials():
    with TemporaryDirectory() as tmp:
        tmp_path = Path(tmp)

        # Copy tutorial file resources
        for f_path in _TUTORIAL_FILES:
            src = _TUTORIALS_ROOT / f_path
            dest = tmp_path / f_path
            dest.parent.mkdir(parents=True, exist_ok=True)
            if src.is_dir():
                shutil.copytree(src, dest)
            else:
                shutil.copy(src, dest)

        # Emit a test for each notebook
        for nb_path in notebooks_in_path(_TUTORIALS_ROOT):
            rel_path = nb_path.relative_to(_TUTORIALS_ROOT)
            workdir = tmp_path / rel_path.parent
            workdir.mkdir(parents=True, exist_ok=True)
            description = "Running notebook {}".format(rel_path)
            yield attr(description=description)(run_notebook), nb_path, workdir 
开发者ID:pyGSTio,项目名称:pyGSTi,代码行数:23,代码来源:testTutorials.py

示例2: test_mutate_from_alanine

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def test_mutate_from_alanine():
    """
    generate alanine dipeptide system (vacuum) and mutating to every other amino acid as a sanity check...
    """
    #TODO: run the full pipeline for all of the aminos; at the moment, large perturbations (i.e. to ARG have the potential of
    #      generating VERY large nonbonded energies, to which numerical precision cannot achieve a proper threshold of 1e-6.
    #      in the future, we can look to use sterics or something fancy.  At the moment, we recommend conservative transforms
    #      or transforms that have more unique _old_ atoms than new
    aminos = ['ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE','LEU','LYS','MET','PHE','SER','THR','TRP','TYR','VAL']
    attempt_full_pipeline_aminos = ['CYS', 'ILE', 'SER', 'THR', 'VAL'] #let's omit rings and large perturbations for now

    ala, system_generator = generate_atp()

    for amino in aminos:
        if amino in attempt_full_pipeline_aminos:
            _ = generate_dipeptide_top_pos_sys(ala.topology, amino, ala.system, ala.positions, system_generator, conduct_htf_prop = True)
        else:
            _ = generate_dipeptide_top_pos_sys(ala.topology, amino, ala.system, ala.positions, system_generator, conduct_geometry_prop = False)

#@attr('advanced') 
开发者ID:choderalab,项目名称:perses,代码行数:22,代码来源:test_topology_proposal.py

示例3: test_run_point_mutation_propose

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def test_run_point_mutation_propose():
    """
    Propose a random mutation in insulin
    """
    import perses.rjmc.topology_proposal as topology_proposal

    pdbid = "2HIU"
    topology, positions = load_pdbid_to_openmm(pdbid)
    modeller = app.Modeller(topology, positions)
    for chain in modeller.topology.chains():
        pass

    modeller.delete([chain])

    max_point_mutants = 1
    chain_id = 'A'

    system_generator = create_simple_protein_system_generator()
    system = system_generator.create_system(modeller.topology)

    pm_top_engine = topology_proposal.PointMutationEngine(modeller.topology, system_generator, chain_id, max_point_mutants=max_point_mutants)
    pm_top_proposal = pm_top_engine.propose(system, modeller.topology)

#@attr('advanced') 
开发者ID:choderalab,项目名称:perses,代码行数:26,代码来源:test_topology_proposal.py

示例4: exampletest_single

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def exampletest_single(example_dir):
    init_pwd = os.getcwd()
    os.chdir(_path('examples/') + example_dir)
    print(os.getcwd())
    sys.path.append(os.getcwd())
    try:
        s = __import__('solve')
        s = reload(s)
        s.test()
    finally:
        sys.path.pop()
        os.chdir(init_pwd)

## BEGIN EXAMPLE TESTS
#@attr(speed='slow')
#def test_9447_nobranch(): exampletest_single('9447_nobranch') # hours? also broken right now 
开发者ID:angr,项目名称:angr-doc,代码行数:18,代码来源:test_examples.py

示例5: _test_notebooks_in_path

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def _test_notebooks_in_path(root_path):
    with TemporaryDirectory() as tmp:
        tmp_path = Path(tmp)
        for nb_path in notebooks_in_path(root_path):
            rel_path = nb_path.relative_to(root_path)
            workdir = tmp_path / rel_path.parent
            workdir.mkdir(parents=True, exist_ok=True)
            description = "Running notebook {}".format(rel_path)
            yield attr(description=description)(run_notebook), nb_path, workdir 
开发者ID:pyGSTio,项目名称:pyGSTi,代码行数:11,代码来源:notebookstestcase.py

示例6: attr

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def attr(tag):
        def func(f):
            return f
        return func 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:6,代码来源:unittest_tools.py

示例7: test_corrcoef

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def test_corrcoef():
    prng = RandomState(42)
    x = prng.rand(10)
    y = x
    group = prng.randint(3, size=10)
    res1 = corrcoef(x, y, group)
    res2 = corrcoef(x, y, group)
    assert_equal(res1, res2)


#@attr('slow') 
开发者ID:statlab,项目名称:permute,代码行数:13,代码来源:test_stratified.py

示例8: test_propose_self

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def test_propose_self():
    """
    Propose a mutation to remain at WT in insulin
    """
    import perses.rjmc.topology_proposal as topology_proposal

    pdbid = "2HIU"
    topology, positions = load_pdbid_to_openmm(pdbid)
    modeller = app.Modeller(topology, positions)
    for chain in modeller.topology.chains():
        pass

    modeller.delete([chain])

    system_generator = create_simple_protein_system_generator()

    system = system_generator.create_system(modeller.topology)
    chain_id = 'A'

    for chain in modeller.topology.chains():
        if chain.id == chain_id:
            residues = chain._residues
    mutant_res = np.random.choice(residues[1:-1])
    allowed_mutations = [(mutant_res.id,mutant_res.name)]

    pm_top_engine = topology_proposal.PointMutationEngine(modeller.topology, system_generator, chain_id, allowed_mutations=allowed_mutations)
    pm_top_proposal = pm_top_engine.propose(system, modeller.topology)
    assert pm_top_proposal.old_topology == pm_top_proposal.new_topology
    assert pm_top_proposal.old_system == pm_top_proposal.new_system
    assert pm_top_proposal.old_chemical_state_key == pm_top_proposal.new_chemical_state_key

#@attr('advanced') 
开发者ID:choderalab,项目名称:perses,代码行数:34,代码来源:test_topology_proposal.py

示例9: test_specify_allowed_mutants

# 需要导入模块: from nose.plugins import attrib [as 别名]
# 或者: from nose.plugins.attrib import attr [as 别名]
def test_specify_allowed_mutants():
    """
    Make sure proposals can be made using optional argument allowed_mutations

    This test has three possible insulin systems: wild type, Q5E, and Q5N/Y14F
    """
    chain_id = 'A'
    allowed_mutations = [('5','GLU'),('5','ASN'),('14','PHE')]
    import perses.rjmc.topology_proposal as topology_proposal

    pdbid = "2HIU"
    topology, positions = load_pdbid_to_openmm(pdbid)
    modeller = app.Modeller(topology, positions)
    for chain in modeller.topology.chains():
        pass

    modeller.delete([chain])

    system_generator = create_simple_protein_system_generator()

    system = system_generator.create_system(modeller.topology)
    chain_id = 'A'

    for chain in modeller.topology.chains():
        if chain.id == chain_id:
            residues = chain._residues
    mutant_res = np.random.choice(residues[1:-1])

    pm_top_engine = topology_proposal.PointMutationEngine(modeller.topology, system_generator, chain_id, allowed_mutations=allowed_mutations)


    ntrials = 10
    for trian in range(ntrials):
        pm_top_proposal = pm_top_engine.propose(system, modeller.topology)
        # Check to make sure no out-of-bounds atoms are present in new_to_old_atom_map
        natoms_old = pm_top_proposal.n_atoms_old
        natoms_new = pm_top_proposal.n_atoms_new
        if not set(pm_top_proposal.new_to_old_atom_map.values()).issubset(range(natoms_old)):
            msg = "Some old atoms in TopologyProposal.new_to_old_atom_map are not in span of old atoms (1..%d):\n" % natoms_old
            msg += str(pm_top_proposal.new_to_old_atom_map)
            raise Exception(msg)
        if not set(pm_top_proposal.new_to_old_atom_map.keys()).issubset(range(natoms_new)):
            msg = "Some new atoms in TopologyProposal.new_to_old_atom_map are not in span of old atoms (1..%d):\n" % natoms_new
            msg += str(pm_top_proposal.new_to_old_atom_map)
            raise Exception(msg)

#@attr('advanced') 
开发者ID:choderalab,项目名称:perses,代码行数:49,代码来源:test_topology_proposal.py


注:本文中的nose.plugins.attrib.attr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。