This file contains hidden or 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
// Compile with make | |
// Change the comp variable to gcc or clang | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <time.h> | |
#include <string.h> | |
#include <gsl/gsl_rng.h> |
This file contains hidden or 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
prog = logstoch | |
source = stoch.c | |
comp = gcc | |
flags = -lgsl -lgslcblas -O3 -DHAVE_INLINE | |
$(prog): $(source) | |
$(comp) $(source) -o $(prog) $(flags) |
This file contains hidden or 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
pdyn = function(N, r, K, t) | |
{ | |
for(i in c(1:(t-1))) N[i+1] = N[i] + r*N[i]*(1-N[i]/K) | |
return(N) | |
} | |
getNs = function(N, r, K, t, record) | |
{ | |
N = pdyn(N, r, K, t) | |
Ns = unique(N[(length(N)-record):length(N)]) |
This file contains hidden or 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
#!/bin/bash/env python2 | |
# -*- coding: utf-8 -*- | |
zotdb = "zot.sqlite" | |
import json | |
import sys | |
import sqlite3 as lite | |
def count(array): | |
counts = {} |
This file contains hidden or 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/python | |
### Blast a list of fasta files | |
### Returns the results and measure similarity IGNORING gaps | |
### | |
### Tim Poisot - [email protected] | |
### May 20, 2013 | |
### This code is in the public domain | |
from Bio.Blast import NCBIXML |
This file contains hidden or 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
// clang nb-sp.c -o nb -lgsl -lgslcblas -O3 -DHAVE_INLINE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <time.h> | |
#include <sys/time.h> | |
#include <string.h> | |
#include <gsl/gsl_rng.h> | |
#include <gsl/gsl_randist.h> |
This file contains hidden or 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 | |
import scipy as sp | |
import matplotlib.pyplot as plt | |
from progressbar import * | |
# Simulation time | |
SimTime = 500 | |
# A spatial version of the NB model | |
# Make a movie with |
This file contains hidden or 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
[Desktop Entry] | |
Name=Zotero Standalone | |
Exec=/usr/local/bin/Zotero_linux-x86_64/zotero | |
Icon=/usr/local/bin/Zotero_linux-x86_64/chrome/icons/default/default48.png | |
Type=Application | |
Categories=Education; |
This file contains hidden or 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
// gcc niche.c -o nm -lgsl -lgslcblas -O3 -DHAVE_INLINE | |
// clang niche.c -o nm -lgsl -lgslcblas -O3 -DHAVE_INLINE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <time.h> | |
#include <string.h> | |
#include <gsl/gsl_rng.h> | |
#include <gsl/gsl_randist.h> |
This file contains hidden or 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
def niche_foodweb(S, C): | |
G = nx.DiGraph() | |
G.add_nodes_from([n for n in xrange(S)]) | |
## Step 1 - create random species | |
for n in G: | |
G.node[n]['n'] = np.round(np.random.uniform(),2) | |
G.node[n]['r'] = np.random.beta(1, 1/float(2*C)-1) * G.node[n]['n'] | |
G.node[n]['c'] = np.random.uniform(G.node[n]['r']/float(2),G.node[n]['n']) | |
## Step 2 - smallest species are basal | |
Smallest = np.min([G.node[n]['n'] for n in G]) |