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
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
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:

EXED

  • ~5 per run
  • limits and start parameters once
  • mask generated for every run
  • scipy.optimize.leastsq
    • Using it to determine UB matrix
    • Easy to control
  • Problems
    • Algorithms rely on high redundancy
  • Colineararity problems with limited directions sampled
QPainterPath path;
std::sort(points.begin(), points.end(),
[](const QPointF& p1, const QPointF& p2) -> bool
{
return p1.x() < p2.x();
});
constexpr auto step = 100.0;
@samueljackson92
samueljackson92 / git-jenkins-format
Created August 19, 2016 06:45
Apply patch from clang-format job
#!/usr/bin/env python
import requests
import sys
import subprocess
import os
import tempfile
def get_build_list():
contents = get_json_data("http://builds.mantidproject.org/job/pull_requests-clang-format/api/json?pretty=true")
if 'builds' in contents.keys():
@samueljackson92
samueljackson92 / crossvalidation.py
Last active June 9, 2016 15:37
Repeated cross validation
from sklearn import cross_validation
from sklearn import metrics
from sklearn.pipeline import Pipeline
import numpy as np
import collections
def repeated_cross_fold_validation(models, X, y, n=10, k=5, cv=None,
score_function=metrics.accuracy_score):
""" Run cross validation on a set of models n times