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
#!/usr/bin/awk -f | |
BEGIN { | |
num_atoms = 0; | |
if (ARGC < 3) { | |
print "Usage: plot-contact-map.awk PDBFILE THRESHOLD" > "/dev/stderr"; | |
error_exit = 1; | |
exit 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
#!/usr/bin/awk -f | |
BEGIN { | |
gnuplot = "gnuplot -p"; | |
print "set terminal wxt noraise" | gnuplot; | |
print "set view equal xyz" | gnuplot; | |
print "set linetype 1 linecolor palette z linewidth 5" | gnuplot; | |
print "unset tics" | gnuplot; | |
print "unset border" | gnuplot; |
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
"""Quick and dirty sampling of small rotation matrices.""" | |
import numpy as np | |
from scipy.linalg import expm | |
from scipy.spatial.transform import Rotation | |
n: int = 3 # Dimensions | |
epsilon: float = 1e-2 # Amplitude of the rotation |
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 | |
from sklearn.gaussian_process import GaussianProcessRegressor | |
def gradient(gpr: GaussianProcessRegressor, Xstar: np.ndarray) -> np.ndarray: | |
"""Evaluate the gradient of a Gaussian process at a given point.""" | |
X = gpr.X_train_ | |
m, n = Xstar.shape[0], X.shape[0] | |
assert Xstar.shape[1] == X.shape[1] | |
Xstar_minus_X = Xstar[:, np.newaxis, :] - X[np.newaxis, :, :] |
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
//$fn = 90; | |
diameter = 30.5; | |
spacing = 2; | |
width = 4 * spacing + 3 * diameter; | |
depth = 2 * spacing + diameter; | |
height = 20 + spacing; | |
difference() { | |
scale([0.94, 0.85, 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 numpy as np | |
from scipy.stats import rv_continuous | |
import matplotlib.pyplot as plt | |
class double_well_gen(rv_continuous): | |
def _pdf(self, x, mu, sigma): | |
sigma2 = sigma**2 | |
return ((np.exp(-(x - mu)**2 / (2.0 * sigma2)) | |
+ np.exp(-(x + mu)**2 / (2.0 * sigma2))) |
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
from typing import Tuple | |
import numpy as np | |
import scipy.spatial | |
DEFAULT_NUM_EIGENPAIRS: int = 10 + 1 | |
def diffusion_maps(points: np.ndarray, epsilon2: float, |
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
(defun switch-to-python-buffer () | |
"Switch to Python shell buffer quickly." | |
(interactive) | |
(let ((python-buffer (get-buffer "*Python*"))) | |
(if python-buffer | |
(switch-to-buffer python-buffer) | |
(run-python)))) | |
(global-set-key (kbd "C-c z") 'switch-to-python-buffer) | |
(global-set-key (kbd "C-c C-z") 'switch-to-python-buffer) |
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 | |
from sklearn.decomposition import PCA | |
from scipy.spatial.distance import pdist | |
def get_points_from_square(num_points: int, ambient_dim: int) -> np.ndarray: | |
"""Get points from a grid of a linear manifold (a square in this case) endowed with the Euclidean metric. | |
""" | |
aux = np.linspace(-1, 1, int(np.sqrt(num_points))) |
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
/*[ Radius of big circle ]*/ | |
r0 = 150; | |
/*[ Radius of tube ]*/ | |
r1 = 8; // r0/10.0; | |
/*[ Tolerance ]*/ | |
rtol = 0.2; | |
module joint(r) { |