diff --git a/code/python/src/thirdparty/maths.py b/code/python/src/thirdparty/maths.py index 86b5ac4..21f4cce 100644 --- a/code/python/src/thirdparty/maths.py +++ b/code/python/src/thirdparty/maths.py @@ -8,6 +8,8 @@ from fractions import Fraction; import math; import numpy as np; +from numpy.random import binomial as random_binomial; +random_binary = lambda p: (random_binomial(1, p) == 1); import pandas as pd; import random; from random import uniform; @@ -22,6 +24,8 @@ __all__ = [ 'Fraction', 'math', 'np', + 'random_binomial', + 'random_binary', 'pd', 'random', 'uniform', diff --git a/code/python/src/thirdparty/plots.py b/code/python/src/thirdparty/plots.py new file mode 100644 index 0000000..c05a8fe --- /dev/null +++ b/code/python/src/thirdparty/plots.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# IMPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +from matplotlib import pyplot as mplt; +from matplotlib import animation as mplt_animation; +from matplotlib import colors as mplt_colours; +from matplotlib import patches as mplt_patches; + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# EXPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +__all__ = [ + 'mplt', + 'mplt_colours', + 'mplt_patches', + 'mplt_animation', +];