Skip to content

Instantly share code, notes, and snippets.

View mwormleonhard's full-sized avatar

Martin Worm-Leonhard mwormleonhard

View GitHub Profile
@mwormleonhard
mwormleonhard / lowResMass.py
Created July 14, 2016 17:24
Script for downsampling of accurate mass data before peak alignment
# -*- coding: utf-8 -*-
"""
Created on 2016-03-05
@author: Martin Worm-Leonhard
----------------------------------------------------------------------------
"THE BEER-WARE LICENSE" (Revision 42):
<mwormleonhard@gmail.com> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return. Martin Worm-Leonhard
@mwormleonhard
mwormleonhard / gameoflife.R
Last active August 29, 2015 13:57
Conway
new.empty.grid <- function(size=1000) {
return(matrix(data=0, nrow=size, ncol=size))
}
new.random.grid <- function(size=1000) {
return(matrix(data=sample(c(0,1), size^2, replace=TRUE), nrow=size, ncol=size))
}
iterate <- function(inputmatrix) {
nextgen <- inputmatrix
@mwormleonhard
mwormleonhard / ln2approx.R
Last active December 17, 2015 04:29
test
ln2i <-function(num_iters) { ## Iterative version
i <- 2
s <- 1
while (i < num_iters) {
ifelse(i%%2==0, s <- s - 1/i, s <- s + 1/i)
i <- i + 1
}
return(s)
}