Skip to content

Instantly share code, notes, and snippets.

Avatar

Raibatak Das dododas

  • Boston, MA, USA
View GitHub Profile
@dododas
dododas / random-walk-1.pde
Last active Mar 15, 2016
Particles performing Brownian random walk - processing
View random-walk-1.pde
// processing script to simulate Brownian random motion
int n_particles = 200; // number of particles
// prepare arrays to store particle coordinates
float[] x = new float[n_particles];
float[] y = new float[n_particles];
void setup() {
size(512, 512);
@dododas
dododas / computeDmle.R
Last active Feb 2, 2016
Maximum likelihood diffusion coefficient calculation for single particle tracks
View computeDmle.R
# Estimate per-step and per-trajectory diffusion coefficients from SPT data
#
# Created by: Raibatak Das
# Jan 2016
library(readxl)
library(dplyr)
# Function to compute per-step diffusion coefficients
singlestepDmle = function(frame, x, y, pxl, dt){
@dododas
dododas / birthdayMC.R
Last active Mar 9, 2017
Monte Carlo simulation for a non-standard birthday problem
View birthdayMC.R
# Monte Carlo simulation to compute the probability that in a random sample of
# 50 individuals, 4 share a birthday and the other 46 have distinct birthdays
bdayOneTrial = function(){
# Simulate a single trial
bdays = sample.int(365, size=50, replace=T)
counts = as.data.frame(table(bdays))
sorted.counts = sort(counts$Freq, decreasing=T)
success = sorted.counts[1]==4 && sorted.counts[2]==1
return(success)
@dododas
dododas / logseq.py
Last active Nov 1, 2015
Python generator for the sequence 1, 2,.., 9, 10, 20,.., 90, 100, 200,..,.
View logseq.py
#!/usr/bin/env python3
'''
A python generator for the sequence 1, 2,.., 9, 10, 20,.., 90, 100, 200,.. up to n_max
Created by: Raibatak Das
'''
from math import floor, log10
def logseq(n_max):