Skip to content

Instantly share code, notes, and snippets.

Thomas Aarholt thomasaarholt

  • University of Oxford
  • Oxford, UK
Block or report user

Report or block thomasaarholt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
thomasaarholt / gist:5fc33ed59c846bbf64999a17324b1432
Created Jun 15, 2019 from attempted compiling of quantum espresso GPU version
View gist:5fc33ed59c846bbf64999a17324b1432
(/shared/users/thomasaar/py37) /shared/users/thomasaar/downloads/q-e-gpu/install: more
# @configure_input@
# compilation rules
.SUFFIXES : .o .c .f .f90
# most fortran compilers can directly preprocess c-like directives: use
# $(MPIF90) $(F90FLAGS) -c $<
import numpy as np
machineTime = {
'm1': {
thomasaarholt /
Last active Mar 4, 2019
Calculate the standard deviation of the gaussian distribution in defocus caused by chromatic aberration in the STEM
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp
E0, dE, Cc = sp.symbols('E0, dE, C_c, ')
deltaZ_sigma = Cc*dE/E0#*2*sp.sqrt(2*sp.log(2))
zlp = 0.9
thomasaarholt / .profile
Created Feb 27, 2019
.profile used on Machine Learning Cluster
View .profile
GNU nano 2.5.3 File: /shared/users/thomasaar/.profile
PS1='$(pwd): '
echo 'Hello Thomas - edit PATH using "profile"'
# This is a comment
echo 'Enabling environment for pyprismatic'
export CPLUS_INCLUDE_PATH=/usr/local/cuda-10.0/include:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=$HOME/fftw_gcc5_build/lib64:/usr/local/cuda-10.0/lib64:$HOME/prismatic_gcc5/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$HOME/fftw_gcc5_build/lib64:/usr/local/cuda-10.0/lib64:$HOME/prismatic_gcc5/lib:$LIBRARY_PATH
thomasaarholt / .inputrc
Created Feb 27, 2019
Absolutely necessary .inputrc hotkeys for navigating in bash
View .inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
thomasaarholt /
Last active Mar 11, 2019
Add colorbar next to image
from mpl_toolkits.axes_grid1 import make_axes_locatable
def colorbar(mappable):
"mappable is img = plt.imshow()"
ax = mappable.axes
fig = ax.figure
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
cax.aname = 'colorbar'
return fig.colorbar(mappable, cax=cax)
thomasaarholt /
Created Feb 26, 2019
Convert Windows filepath to Ubuntu on Windows filepath
from pathlib import Path
def win2lin(rpath: r"C:\Users..."):
path = rpath.replace("\\", "/").replace(":/", "/")
drive = path[0]
path = Path("/mnt/") / Path(drive.lower() + path[1:])
return path
### Example:
# >>> win2lin(r"C:\Users\myuser\Documents")
# PosixPath('/mnt/c/Users/myuser/Documents')
View profile_atomap
Timer unit: 1e-06 s
Total time: 0.265183 s
File: /mnt/c/Users/thomasaar/Documents/atomap/atomap/
Function: _make_model_from_atom_list at line 740
Line # Hits Time Per Hit % Time Line Contents
740 def _make_model_from_atom_list(
741 atom_list,
View remove_voronoi_edge_cells
def border_elems(image_2d, pixels=1): # Input array : a, Edgewidth : W
n = image_2d.shape[0]
r = np.minimum(np.arange(n)[::-1], np.arange(n))
return image_2d[np.minimum(r[:,None],r)<pixels]
def remove_integrated_edge_cells(i_points, i_record, p_record,
pixels=1, inplace=False):
Removes any cells that touch within a number of pixels of
the image border.
import numpy as np
import math
import copy
from tqdm import tqdm, trange
from scipy import interpolate
from scipy import ndimage
from scipy.spatial import cKDTree
import matplotlib.pyplot as plt
import hyperspy.api as hs
from hyperspy.signals import Signal1D, Signal2D
You can’t perform that action at this time.