From 1e934dc3efbee2830298274bdd1063e9b94a524f Mon Sep 17 00:00:00 2001 From: raj_mathe Date: Thu, 30 Jun 2022 05:42:54 +0200 Subject: [PATCH] =?UTF-8?q?woche12=20>=20master:=20code=20py=20-=20thirdpa?= =?UTF-8?q?rty=20imports=20f=C3=BCr=20mathe+plots?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/python/src/thirdparty/maths.py | 4 ++++ code/python/src/thirdparty/plots.py | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 code/python/src/thirdparty/plots.py 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', +];