Skip to content

Instantly share code, notes, and snippets.

View thomasaarholt's full-sized avatar

Thomas Aarholt thomasaarholt

View GitHub Profile
@thomasaarholt
thomasaarholt / .profile
Last active March 23, 2021 10:08
.profile used on Machine Learning Cluster
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
@thomasaarholt
thomasaarholt / gms_load_hyperspy.py
Last active September 3, 2020 18:47
Python script to load any format supported by hyperspy directly into GMS 3.4+
'''
Python script to load any format supported by hyperspy directly into GMS
Must be copied and pasted into Gatan DigitalMicrograph (aka Gatan Microscopy Suite) version 3.4+
Call by `load_img(filepath)` at the bottom of the script. Can not be called outside of GMS.
Does not automatically convert the data type to EELS or EDS
Written by Thomas Aarholt, see https://gist.github.com/thomasaarholt/fccf06d56ff84cf76345b44dae30871e for newer versions
Feedback and forks are very welcome.
MUST: First import of hyperspy (or scipy) must NOT be run with "Execute on background thread" checked. One
can then swap to background thread and rerun.
v. 0.3: Added delete statements to ensure python objects don't stay in memory.
from __future__ import annotations
from collections import defaultdict
from os import path
from typing import DefaultDict, List, NamedTuple, Optional, Sequence, Set, Tuple, cast
import requests
import re
from copy import copy
from pyrsistent import m, s, v, PMap, PSet, PVector