Skip to content

Instantly share code, notes, and snippets.

View andrewfowlie's full-sized avatar

Andrew Fowlie andrewfowlie

View GitHub Profile
@andrewfowlie
andrewfowlie / install_multinest.bash
Last active July 18, 2023 01:53
Install MultiNest
git clone https://github.com/farhanferoz/MultiNest.git
cd MultiNest_v3.12_CMake/multinest/
mkdir build
cd build
cmake ..
make all
sudo make install
function git_branch_search_stale {
echo "ahead | behind | branch name"
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/remotes | \
while read remote
do
git rev-list --left-right origin/master...${remote} -- 2>/dev/null >/tmp/git_upstream_status_delta || continue
BEHIND=$(grep -c '^<' /tmp/git_upstream_status_delta)
AHEAD=$(grep -c '^>' /tmp/git_upstream_status_delta)
echo "$AHEAD $BEHIND $remote"
done | \
@andrewfowlie
andrewfowlie / rotation.py
Created November 6, 2017 00:59
Figure showing DM velocity curve
"""
Rotation velocity of DM
=======================
"""
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
@andrewfowlie
andrewfowlie / pie.py
Created November 6, 2017 00:58
Pie chart showing fraction of DM in universe
"""
Pie chart of Bayes factor
=========================
"""
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
@andrewfowlie
andrewfowlie / freeze_out.py
Created November 6, 2017 00:57
Figure for WIMP freeze out
"""
WIMP miracle
============
"""
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
@andrewfowlie
andrewfowlie / shadow.sty
Created September 13, 2017 01:11
LaTeX package for using tikz to put a shadow around an image
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{shadow}[2017/09/13 shadow]
% code adapted from http://tex.stackexchange.com/a/11483/3954
\usepackage{tikz}
\usetikzlibrary{shadows,calc}
@andrewfowlie
andrewfowlie / highlight.sty
Last active May 3, 2020 07:33
LaTeX package for highlighting text that looks like a hand-drawn highlighter pen
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{highlight}[2017/09/13 Highlight]
% All credit to https://tex.stackexchange.com/a/6029/35729
\usepackage{soul}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}
@andrewfowlie
andrewfowlie / evidence.py
Created September 12, 2017 01:39
Illustration of Bayesian evidence and Occam's razor
"""
Plot evidences for simple and complicated models
================================================
by Andrew Fowlie.
"""
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
@andrewfowlie
andrewfowlie / hugo_academic_from_arxiv.py
Created August 29, 2017 04:55
Convert arXiv webpage into markdown entry for webpage in Hugo academic theme
"""
Convert arXiv code into markdown entry for webpage in Hugo academic theme
=========================================================================
Main usuage e.g.,
>>> markdown('1607.06608')
to scrape https://arxiv.org/abs/1607.06608 into a publication for Hugo
academic theme.
@andrewfowlie
andrewfowlie / libload.py
Created July 4, 2017 23:45
Load functions into Python from a C++ library automagically
"""
Load functions from a dynmaic library via the header file
=========================================================
"""
import ctypes
import numpy as np
import json
import sys
from collections import OrderedDict as odict