import numpy as np import matplotlib.pyplot as plt """ This example script demonstrates how to load and visualise a slice of a hyperspectral image. """ def get_wn_index(wn_query, wn): """Gets the index number for a specified wavenumber.""" return np.argmin(np.abs(wn_query - wn)) #Specify path to image image_name = "12089_1.npy" image = np.load(image_name) wavenumbers = np.load("wn.npy") # Show absorbance at 1650 cm-1 amide_slice = image[:, :, get_wn_index(1650, wavenumbers)] fig, ax = plt.subplots(figsize=(5, 5)) ax.imshow(amide_slice,) # Save destination save_dest = "amide_12089.png" # Save image fig.savefig(save_dest)