.. _book_fig_chapter7_fig_spec_reconstruction: PCA Reconstruction of a spectrum -------------------------------- Figure 7.6 The reconstruction of a particular spectrum from its eigenvectors. The input spectrum is shown in gray, and the partial reconstruction for progressively more terms is shown in black. The top panel shows only the mean of the set of spectra. By the time 20 PCA components are added, the reconstruction is very close to the input, as indicated by the expected total variance of 94%. .. image:: ../images/chapter7/fig_spec_reconstruction_1.png :scale: 100 :align: center .. raw:: html
**Code output:** .. raw:: html
.. literalinclude:: fig_spec_reconstruction.txt .. raw:: html
**Python source code:** .. raw:: html
.. literalinclude:: fig_spec_reconstruction.py :lines: 12- .. raw:: html
:download:`[download source: fig_spec_reconstruction.py] ` .. raw:: html