This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pytest | |
import hypothesis | |
from hypothesis import given, settings | |
from hypothesis import strategies as st | |
from hypothesis.extra import numpy as hynp | |
@settings(max_examples=5) | |
@given(st.floats(min_value=0, max_value=1, width=64), | |
st.integers(np.finfo(np.double).minexp, np.finfo(np.double).maxexp - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
trials = 20 | |
pass_counts = 0 | |
fail_counts = 0 | |
for i in range(trials): | |
print("trial number:", i) | |
try: | |
o = subprocess.check_output('python runtests.py -t "numpy/testing/tests/test_utils.py" -- -n 4', shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MDAnalysis | |
import numpy as np | |
from scipy.spatial.distance import euclidean | |
u = MDAnalysis.Universe('split_rhombic_small.gro') | |
residue = u.atoms.residues[0] | |
residue_centroid_no_pbc = residue.atoms.centroid(pbc=False) | |
residue_centroid = residue.atoms.centroid(pbc=True) | |
head_centroid_distance = euclidean(residue.atoms.positions[0], | |
residue_centroid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Module to assess and adjust URLs / links in MDA project documentation after recent move to github.''' | |
import os | |
import subprocess | |
for dirname, dirnames, filenames in os.walk('/Users/treddy/python_modules/MDAnalysis/MDA_dev/mdanalysis/'): | |
# print path to all filenames. | |
#for filename in filenames: | |
#print os.path.join(dirname, filename) | |
#print all lines from .py files with OLD HOMEPAGE URLs in them: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if you don't have the Julia PyCall library you can install it with Pkg.add("PyCall") as the first line in this code | |
using PyCall | |
@pyimport MDAnalysis | |
#careful with dotted imports--need simpler module name representation for usage in Julia | |
@pyimport MDAnalysis.tests.datafiles as MDT | |
#can now use MDAnalysis seamlessly and leverage some of the powerful features of the Julia numerical computing language | |
u = MDAnalysis.Universe(MDT.GRO,MDT.XTC) #although this works very naturally, many MDA methods currently require pycall invocation | |
all_atom_selection = pycall(u["selectAtoms"],PyAny,"all") #double quotes only for the "all" string--single quotes are character literals in Julia |