Skip to content

Instantly share code, notes, and snippets.

View ndevenish's full-sized avatar

Nicholas Devenish ndevenish

View GitHub Profile
@ndevenish
ndevenish / extract_small.py
Created May 1, 2018 15:52
simple script to try to read small indexed reflections out of a file
import cPickle as pickle
from scitbx.array_family import flex
with open("indexed.pickle") as f:
ref = pickle.load(f)
indexed = ref.get_flags(ref.flags.indexed)
intensity_one = flex.bool([x["intensity.sum.value"] == 1 for x in ref])
size_one_shoebox = flex.bool([sum(x["shoebox"].size()) == 3 for x in ref])
# TypeError: No to_python (by-value) converter found for C++ type: dials::model::Shoebox<float>
@ndevenish
ndevenish / JenkinsFile
Created May 8, 2018 09:50
Dials JenkinsFile
pipeline {
agent { label "centos6" }
stages {
// Prepare the workspace by copying artifacts, updating repositories etc
stage('Prepare') {
}
stage('Bootstrap') {
when {
@ndevenish
ndevenish / testing.h
Created June 11, 2018 14:24
Small, stand-alone GoogleTest replacement for simple testing scripts
/**
* Basic testing infrastructure for array_family polymorphic resources.
*
* Provides an extremely minimal replacement for some of the GoogleTest
* testing API, under the hope that at some point a proper C++ testing
* framework will be included with the distribution.
*
* If googletest is present, determined by the define NO_GTEST being
* #undefined, then use that instead of our minimal replacement.
*
mkdir modules
git clone https://github.com/benjaminhwilliams/cctbx_project.git modules/cctbx_project
ln -s modules/cctbx_project/libtbx/auto_build/bootstrap.py
python bootstrap.py --builder=dials hot base update build
cd modules/cctbx_project/ && \
git remote set-url origin [email protected]:cctbx/cctbx_project.git && \
git fetch && \
git reset --hard origin/master
@ndevenish
ndevenish / .block
Last active June 17, 2018 20:29
Dials python dependencies
license: mit
@ndevenish
ndevenish / plot_centroid_per_shoebox.py
Last active July 10, 2018 14:01
Plot centroids differences broken up by shoebox width in Z
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import cPickle as pickle
import enum
import dials.array_family.flex as flex
import sys
if "-h" in sys.argv or "--help" in sys.argv or len(sys.argv[1:]) != 1:
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
from collections import Counter
all_files = []
for path, dirs, files in os.walk("."):
all_files.extend(os.path.join(path, x) for x in files if x.endswith(".py"))
@ndevenish
ndevenish / linuxbrew_gcc.log
Created October 26, 2018 15:00
failed building llvm
$ docker build .
Sending build context to Docker daemon 2.56kB
Step 1/12 : FROM centos:6
---> 609c1f9b5406
Step 2/12 : RUN yum install -y gcc git automake make gcc-c++ pkgconfig patch
---> Running in 450b545850ed
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version
@ndevenish
ndevenish / # llvm - 2018-10-30_19-33-15.txt
Created October 30, 2018 20:17
llvm on 4.9.93-linuxkit-aufs - Homebrew build logs
Homebrew build logs for llvm on 4.9.93-linuxkit-aufs
Build date: 2018-10-30 19:33:15
@ndevenish
ndevenish / convert_print_to_log.py
Last active December 5, 2018 11:34
'bowler' script to convert prints to logger calls
from collections import OrderedDict
from bowler import *
from fissix.fixer_util import Attr, Name, ArgList, String, Comma
from fissix.pytree import type_repr, Node, Leaf # , Node, type_repr
from bowler.types import TOKEN
from fissix.pgen2 import token # token.COMMA
from fissix.pygram import python_symbols as syms
from libfuturize import fixer_util