Skip to content

Instantly share code, notes, and snippets.

View leeping's full-sized avatar

Lee-Ping Wang leeping

View GitHub Profile
@leeping
leeping / low_pass_smoothing.py
Created March 26, 2019 17:20
Low-pass smoothing function
def low_pass_smoothing(all_raw_time_series, sigma, dt_fs):
''' uses Butterworth filter for low-pass smoothing
'''
traj_length = all_raw_time_series.shape[1]
conversion = 33355.0/dt_fs
order = 6
# Frequency cutoff in units of inverse timestep
low_cutoff = float(sigma)/conversion * (2.0 - 2.0/traj_length)
# # sigma will be in units of cm-1, but function needs input of seconds
@leeping
leeping / measure_min_image.py
Created February 24, 2017 19:06
Find the closest contact between a protein and its periodic images in an MD trajectory
#!/usr/bin/env python
import mdtraj as md
import time
import numpy as np
from copy import deepcopy
import itertools
import sys
t0 = time.time()
@leeping
leeping / fill.py
Created November 12, 2016 17:29
Short Python scripts for CPMonitor
#!/usr/bin/env python
"""
Currently the Monitor code has a bug where certain frames are not being written to disk.
I'm currently doing something that requires comparing the Monitor trajectory to a "standard" trajectory,
which means I need to either delete the "standard" frames or fill in the missing ones.
I thought it would be easier to fill in the missing ones, so that I may continue assuming that frames are spaced by the time step.
So this small script detects where frames are missing and fills them in by averaging the previous and current frame:
"""
@leeping
leeping / torque_submit_workers_lp
Created September 5, 2013 17:04
LP's custom torque_submit_workers script
#!/bin/sh
show_help()
{
echo "Use: torque_submit_workers [options] <servername> <port> <num-workers>"
echo "where options are:"
echo " -M <name> Name of the preferred master for worker."
echo " -N <name> Same as -M (backwards compatibility)."
echo " -c <num> Set the number of cores each worker should use (0=auto). (default=1)"
echo " -C <catalog> Set catalog server to <catalog>. <catalog> format: HOSTNAME:PORT."
@leeping
leeping / conf.pdb
Last active July 5, 2023 14:28
General purpose OpenMM NPT/NVT script
CRYST1 30.571 30.571 30.571 90.00 90.00 90.00 P 1 1
ATOM 1 S dms 1 3.840 13.360 6.210
ATOM 2 C dms 1 2.690 11.920 6.530
ATOM 3 H dms 1 3.240 11.020 6.240
ATOM 4 H1 dms 1 2.310 11.790 7.540
ATOM 5 H2 dms 1 1.810 12.070 5.890
ATOM 6 C1 dms 1 5.350 12.830 7.030
ATOM 7 H3 dms 1 5.290 11.770 7.310
ATOM 8 H4 dms 1 6.200 13.040 6.390
ATOM 9 H5 dms 1 5.420 13.310 8.000