This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
machineTime = { | |
'm1': { | |
'p1':20, | |
'p2':np.nan, | |
'p3':70, | |
'p4':4, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import sympy as sp | |
sp.init_printing() | |
E0, dE, Cc = sp.symbols('E0, dE, C_c, ') | |
deltaZ_sigma = Cc*dE/E0#*2*sp.sqrt(2*sp.log(2)) | |
zlp = 0.9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'Hello Thomas - edit PATH using "profile"' | |
alias ls="ls --color" | |
alias cd..='cd ../' # Go back 1 directory level (for fast typers) | |
alias cd...='cd ../../' | |
alias ..='cd ../' # Go back 1 directory level | |
alias ...='cd ../../' # Go back 2 directory levels | |
alias .3='cd ../../../' # Go back 3 directory levels | |
alias .4='cd ../../../../' # Go back 4 directory levels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
"\e[C": forward-char | |
"\e[D": backward-char |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Timer unit: 1e-06 s | |
Total time: 0.265183 s | |
File: /mnt/c/Users/thomasaar/Documents/atomap/atomap/atom_finding_refining.py | |
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmux attach |