Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Aarholt thomasaarholt

  • University of Oslo
  • Oslo, Norway
View GitHub Profile
@thomasaarholt
thomasaarholt / Mn_whitelineratio
Created Apr 21, 2020 — forked from winston-song/Mn_whitelineratio
Mn L3/L2 white line ratio using gussian component plus H-S step edge
View Mn_whitelineratio
%matplotlib widget
import hyperspy.api as hs
import matplotlib.pyplot as plt
import numpy as np
ll_sum = hs.load('ll_sum.hspy')
s_sum = hs.load('s_sum.hspy')
s_sum.metadata.Acquisition_instrument.TEM.beam_energy=200
s_sum.metadata.Acquisition_instrument.TEM.convergence_angle=22.5
s_sum.metadata.Acquisition_instrument.TEM.Detector.EELS.collection_angle=37.9
@thomasaarholt
thomasaarholt / augumented_hdf5_matrix.py
Created Apr 7, 2020 — forked from wassname/augumented_hdf5_matrix.py
How to do data augmentation on a keras HDF5Matrix
View augumented_hdf5_matrix.py
"""Another way, note this one will load the whole array into memory ."""
from keras.preprocessing.image import ImageDataGenerator
import h5py
from keras.utils.io_utils import HDF5Matrix
seed=0
batch_size=32
# we create two instances with the same arguments
data_gen_args = dict(
rotation_range=90.,
@thomasaarholt
thomasaarholt / coordconv2d.py
Last active Feb 10, 2020 — forked from Dref360/coordconv2d.py
Un-scaled version of CoordConv2D
View coordconv2d.py
import keras.backend as K
import tensorflow as tf
from keras.layers import Layer
from keras.layers import Conv2D
"""Not tested, I'll play around with GANs soon with it."""
class CoordConv2D(Layer):
def __init__(self, channel, kernel, padding='valid', activation=None, **kwargs):
@thomasaarholt
thomasaarholt / selectfile.py
Created Jun 1, 2017 — forked from DrDub/selectfile.py
A file selection class build for ipywidgets without any extra dependencies.
View selectfile.py
import os
import ipywidgets as widgets
class FileBrowser(object):
def __init__(self):
self.path = os.getcwd()
self._update_files()
You can’t perform that action at this time.