Skip to content

Instantly share code, notes, and snippets.

View longw010's full-sized avatar

Long Wang longw010

View GitHub Profile
@longw010
longw010 / Extraction.py
Created January 15, 2018 04:20
Extract heart rate from a video
import numpy as np
import cv2
class Extraction(object):
"""
Extract the index of frames based on heart rate curve.
Two steps: 1. get heart rate curve 2. extract the index of frame
Note that the heart rate is relative value in the unit of pixel.
Usage:
@longw010
longw010 / model2.py
Last active January 10, 2018 16:02
Apply gradient descent to optimize the objective function of model2
import time
from utils import *
import argparse
# set a random seed to make experiments reproducible
np.random.seed(10)
# create parser
def create_parser():
@longw010
longw010 / model1.py
Created January 10, 2018 15:56
Apply gradient descent to optimize the objective function of model 1
import argparse
import time
from utils import *
# set a random seed to make experiments reproducible
np.random.seed(10)
# create parser
def create_parser():
@longw010
longw010 / coordinate2pdb.py
Last active January 9, 2018 15:51
Generate a valid PDB file from the coordinates
def posi2pdb(pdb_filename, posi_filename):
"""
The function is used to generate a valid PDB file from the coordinates.
Inputs:
pdb_filename: the output name for pdb file
posi_filename: the input name for file with the coordinates
"""
# load file