In [18]:
# Load needed modules
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import ncempy.io as nio
import ipywidgets as widgets
from ipywidgets import interact, interactive
In [21]:
# Set file path
file_name = r'c:\users\linol\Downloads\01_Si110_5images_1.ser'
# Read the data in the file
ser0 = nio.ser.serReader(file_name)
# Set the variable named data to the loaded dataset
data = ser0['data']
# Available information
# The 'data' key holds all of the data
print(ser0.keys())
# Print out the shape of the dataset
print('Dataset shape = {}'.format(data.shape))
In [22]:
fg1, ax1 = plt.subplots(1,1)
imax1 = ax1.imshow(data[0,:,:],
vmin=data.min(),vmax = data.max()) # Set the initial image and intenstiy scaling
# Updates the plot
def axUpdate(i):
imax1.set_data(data[i,:,:])
# Create the slider to update the plot
w = interactive(axUpdate, i=(0,data.shape[0]-1))
display(w)