Performance Profiling

Check how fast some of the performance-sensitive parts of the Xanespy run. These are generally looping through some stack of arrays or spectra.


In [3]:
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
# %matplotlib inline
from skimage import data, viewer, transform
import random


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

Register Translations


In [12]:
stack = []
im = data.camera()
for i in range(0, 60):
    # Generate a random shift
    d = 15
    shift = (random.randint(-d, d), random.randint(-d, d))
    matrix = transform.SimilarityTransform(translation=shift)
    new_im = transform.warp(im, matrix, mode='symmetric')
    stack.append(new_im)

In [9]:



Out[9]:
<matplotlib.image.AxesImage at 0x7f70c6af7898>

In [ ]: