Physics, Data Science, Least Squares, Chemometrics, Spectroscopy.
# Generate the components matrix or K matrix components = np.array([component_a, component_b, component_c]) # Apply Least squares cs = least_sq(query_spectra, components) # And plot the result: plt.plot(x_range, query_spectra, color = 'black', label = 'Mix spectrum' ) # Plot the unknown spectrum