Skip to content

Instantly share code, notes, and snippets.

View benjeffery's full-sized avatar

Ben Jeffery benjeffery

View GitHub Profile
regions <--- THIS NEEDS POPULATING!
id
lat
lng
name
description
num_samples
countries
id
This file has been truncated, but you can view the full file.
{"population":{"0":"WAF","1":"WAF","2":"WAF","3":"WAF","4":"WAF","5":"WAF","6":"WAF","7":"WAF","8":"WAF","9":"WAF","10":"WAF","14":"WAF","15":"WAF","17":"WAF","18":"WAF","19":"WAF","20":"WAF","21":"WAF","22":"WAF","25":"WAF","27":"WAF","30":"WAF","31":"WAF","33":"WAF","34":"WAF","37":"WAF","39":"WAF","40":"WAF","41":"WAF","44":"WAF","45":"WAF","46":"WAF","47":"WAF","48":"WAF","50":"WAF","51":"WAF","52":"WAF","53":"WAF","55":"WAF","56":"WAF","57":"WAF","58":"WAF","59":"WAF","60":"WAF","61":"WAF","63":"WAF","65":"WAF","66":"WAF","71":"WAF","76":"WAF","78":"WAF","79":"WAF","81":"WAF","82":"WAF","86":"WAF","89":"WAF","90":"WAF","91":"WAF","92":"WAF","93":"WAF","94":"WAF","95":"WAF","96":"WAF","98":"WAF","99":"WAF","101":"WAF","102":"WAF","104":"WAF","105":"WAF","106":"WAF","107":"WAF","108":"WAF","109":"WAF","112":"WAF","113":"WAF","114":"WAF","115":"WAF","116":"WAF","117":"WAF","118":"WAF","119":"WAF","125":"WAF","127":"WAF","131":"WAF","132":"WAF","134":"WAF","135":"WAF","136":"WAF","137":"WAF","139":"WAF","140
@benjeffery
benjeffery / bench_traversals.py
Created October 24, 2019 21:51
Benchmark node traversals
import itertools
import sys
from time import perf_counter
from matplotlib import pyplot
from scipy import stats
import numpy as np
import tqdm
sys.path.append('/home/benj/projects/tskit/python')
import tskit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/home/benj/projects/tskit/c/build/../tskit/convert.c:26:1: warning: #includes are not sorted properly [llvm-include-order]
#include <stdio.h>
^ ~~~~~~~~~
<assert.h>
/home/benj/projects/tskit/c/build/../tskit/convert.c:26:1: warning: #includes are not sorted properly [llvm-include-order]
#include <stdio.h>
^ ~~~~~~~~~
<assert.h>
/home/benj/projects/tskit/c/build/../tskit/core.c:26:1: warning: #includes are not sorted properly [llvm-include-order]
#include <stdio.h>
id site node time derived_state parent metadata
0 0 48 2.0800060772564484 1 -1
1 0 48 2.0572024992858435 0 0
2 0 31 1.5647409985500718 1 1
3 0 31 1.0950830757849048 0 2
4 0 23 0.46366628550498323 1 3
5 0 23 0.3019074179902289 0 4
6 0 7 0.0934323669836497 1 5
7 0 7 0.04671618349182485 0 6
8 0 5 0.0934323669836497 1 5
@benjeffery
benjeffery / covid_testing_alarm.py
Last active January 28, 2021 12:28
UK Covid testing alarm
import datetime
import time
import requests
import playsound #You might need to install pygobject if you get an error about missing "gi" module for this.
playsound.playsound("ding.mp3") #You'll need a file here that is noisy
while True:
try:
r = requests.post(
"https://ads-prd-gov-1-sp.test-for-coronavirus.service.gov.uk/testcentres/availabilityquery",
@benjeffery
benjeffery / main.md
Last active September 23, 2020 15:05

The default repos of all the tskit-dev repos is changing from master to "main" at 1200UTC on 20200928. (Monday)

The following repos are affected:

  • administrative
  • containers
  • .github
  • kastore
  • msprime
  • msprime-1.0-paper
import math
import numpy as np
import msprime
seed = 1102
divergence_time = 50
####Variables####
# These are the DIPLOID counts
sequence_length = 100000
Ne_A = 10000
static PyObject *
IndividualTable_extend(IndividualTable *self, PyObject *args, PyObject *kwds)
{
PyObject *ret = NULL;
IndividualTable *other = NULL;
PyObject *obj_row_indexes = Py_None;
PyArrayObject *row_indexes = NULL;
tsk_id_t *row_indexes_data = NULL;
tsk_size_t num_rows = 0;
int err;