Skip to content

Instantly share code, notes, and snippets.

View thomaskeck's full-sized avatar

Thomas Keck thomaskeck

  • Karlsruhe
View GitHub Profile
@thomaskeck
thomaskeck / remote_debugger.py
Last active September 25, 2022 21:10
A Python Remote Post Mortem Debugger
# Server Application which should be debugged
def acticvate_remote_post_mortem_debugger():
def info(type, value, tb):
import traceback
traceback.print_exception(type, value, tb)
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('127.0.0.1', 8002))
@thomaskeck
thomaskeck / limits.py
Last active November 8, 2019 10:48
Calculate exact Binomial Limits
import scipy.special
import scipy.stats
def binomial_limit(n, k, sigma=1):
"""
Calculates the upper and lower limit for the probability p of a binomial distribution
if an experiment yielded k successes for n trials.
The confidence level for the limits is given in sigmas of the gaussian distribution.
In contrast to other methods (see https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval),
this method is exact in the sense that there is no approximation involved for the binomial distribution.