Skip to content

Instantly share code, notes, and snippets.

@mkhorton
mkhorton / isodistort_interpolate.py
Created June 23, 2018 15:56
Interpolate ISODISTORT CIF along given displacement mode
def get_isodistort_transformed_structure(cif_file, displacive_mode_values=None):
"""
This function is designed to parse CIF files generated by ISODISTORT. The CIF
file specification has not yet been finalized, so this function may have to
be updated in the future. Only use on CIF files from trusted sources.
Args:
cif_file (str): location of ISODISTORT CIF file
displacive_mode_values (list): list of displacement mode values with length
matching the number of modes
@mkhorton
mkhorton / reverse_cmap.py
Last active December 4, 2023 08:01 — forked from stefanv/reverse_cmap.py
Reverse colormap
from skimage import io as sio
import skimage
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
img = skimage.img_as_float(sio.imread('image.png'))
img = img[..., :3] # remove alpha channel

Keybase proof

I hereby claim:

  • I am mkhorton on github.
  • I am mkhorton (https://keybase.io/mkhorton) on keybase.
  • I have a public key ASAmo-lMqXR54UI79t-ixFaIUqtzsfinjt-ZDlIUD9J6ewo

To claim this, I am signing this object:

@mkhorton
mkhorton / gist:7122746
Created October 23, 2013 17:15
Voro++ build failed on Homebrew on Mavericks
==> Downloading http://math.lbl.gov/voro++/download/dir/voro++-0.4.5.tar.gz
######################################################################## 100.0%
==> make
voro::wall_plane::cut_cell(voro::voronoicell_neighbor&, double, double, double) in cmd_line-GhWYty.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [voro++] Error 1
make: *** [all] Error 2
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
@mkhorton
mkhorton / graph-tool
Created May 25, 2013 20:43
Homebrew formula for graph-tool (http://projects.skewed.de/graph-tool/). Compiles but fails when trying "from graph_tool.all import *" with "'python' terminated by signal SIGSEGV (Address boundary error)".
require 'formula'
class GraphTool < Formula
homepage 'http://projects.skewed.de/graph-tool/'
url 'http://downloads.skewed.de/graph-tool/graph-tool-2.2.24.tar.bz2'
sha1 '0ba18967a749396c8a959e423cb6c9532add4432'
depends_on :x11
depends_on 'boost'
depends_on 'scipy' => :python