Skip to content

Instantly share code, notes, and snippets.

View plasmaman's full-sized avatar

Erik Kolstad plasmaman

View GitHub Profile
@plasmaman
plasmaman / weibull.py
Last active December 22, 2023 17:42
Python code for estimating the shape and scale parameters for a two-parameter Weibull distribution. It uses scipy.optimize.fmin to minimize the Likelihood function.
from scipy.stats import exponweib
from scipy.optimize import fmin
import numpy as np
# x is your data array
# returns [shape, scale]
def fitweibull(x):
def optfun(theta):
return -np.sum(np.log(exponweib.pdf(x, 1, theta[0], scale = theta[1], loc = 0)))
@plasmaman
plasmaman / my_qstat.py
Last active December 28, 2015 07:29
Python code for extracting keys from "qstat -f". Initially made for getting the full job name (Job_Name) string.
import subprocess
# Short script to get the juicy stuff from "qstat -f"
# Note especially that you get the whole Job Name
# Add whatever you want in the keys array
###############################
# Preferences:
# Separator to use in the output