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 os | |
import ipywidgets as widgets | |
class FileBrowser(object): | |
def __init__(self): | |
self.path = os.getcwd() | |
self._update_files() | |
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 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): |
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
"""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., |
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
%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 |