Skip to content

Instantly share code, notes, and snippets.

View samueljackson92's full-sized avatar

Samuel Jackson samueljackson92

  • STFC
  • Wallingford, Oxfordshire, UK
View GitHub Profile
@samueljackson92
samueljackson92 / fuzzy.py
Created February 11, 2013 16:25
Fuzzy set logic tipping system python code.
#!/usr/bin/env python
#####################################################
#Fuzzy logic implementation of simple tipping system
#Author: Samuel Jackson (slj11@aber.ac.uk)
#Date: 10/2/13
#####################################################
#################################
# Functions for calculating #
@samueljackson92
samueljackson92 / delta.cpp
Created March 21, 2013 17:53
C/C++ code for calculating delta time. Output in seconds.
timeval t1, t2;
double elapsedTime;
//start timer
gettimeofday(&t1, NULL);
//do stuff...
//stop timer
gettimeofday(&t2, NULL);
import matplotlib.pyplot as plt
from pathlib import Path, PurePath
from image import ImageLoader, Regrid
from skimage.transform import resize
from skimage.exposure import exposure
import numpy as np
import sys
from PIL import Image as PillowImage
from PIL import ImageEnhance
import skimage
@samueljackson92
samueljackson92 / otsu.py
Last active December 24, 2020 04:15
Otsu's method of thresholding. Partially based on the implementation shown at: http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html
#!/usr/local/bin/python
#######################################################
# Otsu's Method
# Author: Samuel Jackson (samueljackson@outlook.com)
# Date: 21/07/2013
# Description: Performs Otsu's method of thresholding
# using the between class variance.
#######################################################
5.1,3.5,1.4,0.2,Iris-setosa
4.9,3.0,1.4,0.2,Iris-setosa
4.7,3.2,1.3,0.2,Iris-setosa
4.6,3.1,1.5,0.2,Iris-setosa
5.0,3.6,1.4,0.2,Iris-setosa
5.4,3.9,1.7,0.4,Iris-setosa
4.6,3.4,1.4,0.3,Iris-setosa
5.0,3.4,1.5,0.2,Iris-setosa
4.4,2.9,1.4,0.2,Iris-setosa
4.9,3.1,1.5,0.1,Iris-setosa
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samueljackson92
samueljackson92 / osx-breakout.md
Last active January 31, 2018 17:57
OSX Breakout
  • Add link to the proper build instructions on MediaWiki (remove existing content)
  • Merge build instructions on Github wiki
  • Update build instructions to use brew MantidDeveloper package.
  • Move Github wiki build instructions into the mantid/docs.
  • Create bottles for packages we manage
  • Converting script to python or cmake.
@samueljackson92
samueljackson92 / make_package.rb.in.patch
Last active October 2, 2017 14:46
Git patch for fixing the Mantid installer package script on OSX Sierra.
diff --git a/MantidPlot/make_package.rb.in b/MantidPlot/make_package.rb.in
index acdb31e30f..672bf3f3b6 100755
--- a/MantidPlot/make_package.rb.in
+++ b/MantidPlot/make_package.rb.in
@@ -72,7 +72,7 @@ library_filenames = ["libboost_regex-mt.dylib",
"libTKGeomBase.dylib",
"libqwt.dylib",
"libqwtplot3d.dylib",
- "libqscintilla2.dylib",
+ "libqscintilla2_qt4.dylib",
@samueljackson92
samueljackson92 / utils.py
Created July 19, 2017 08:18
Useful python functions
def printname(func):
"""
Prints the name of a decorated method
This can be useful for debugging unit tests which
interfere with each other.
"""
def wrapper(self):
print func.__name__
return func(self)
#!/usr/bin/env python
import sys
import subprocess
import os
import re
import tempfile
def run_command(command):
try: