import utils
import matplotlib.pyplot as plt
import numpy as np

def pixel_spectra(max_pixels):
    slabs, i_min, i_max = utils.load_slabs()

    X = utils.as_np_array(slabs)

    f, axes = plt.subplots()

    n_freqs, n_pixels = X.shape[0], X.shape[1]

    generator = np.random.Generator(np.random.PCG64())
    idc = np.unique(generator.choice(range(n_pixels), min(n_pixels, max_pixels)))

    for i in idc:
        axes.plot(utils.energies, X[:,i], c='blue', alpha=0.1)
    plt.show()