import itertools import Starfish from Starfish import emulator from Starfish.grid_tools import HDF5Interface from Starfish.emulator import PCAGrid, Gprior, Glnprior, Emulator from Starfish.covariance import Sigma import os if args.create: myHDF5 = HDF5Interface() my_pca = PCAGrid.create(myHDF5) my_pca.write() if args.plot == "reconstruct": my_HDF5 = HDF5Interface() my_pca = PCAGrid.open() recon_fluxes = my_pca.reconstruct_all() # we need to apply the same normalization to the synthetic fluxes that we # used for the reconstruction fluxes = np.empty((my_pca.M, my_pca.npix)) for i, spec in enumerate(my_HDF5.fluxes): fluxes[i, :] = spec # Normalize all of the fluxes to an average value of 1 # In order to remove uninteresting correlations fluxes = fluxes / np.average(fluxes, axis=1)[np.newaxis].T data = zip(my_HDF5.grid_points, fluxes, recon_fluxes)
import Starfish from Starfish import emulator from Starfish.grid_tools import HDF5Interface from Starfish.emulator import PCAGrid, Gprior, Glnprior, Emulator from Starfish.covariance import Sigma import os if args.create: myHDF5 = HDF5Interface() my_pca = PCAGrid.create(myHDF5) my_pca.write() if args.plot == "reconstruct": my_HDF5 = HDF5Interface() my_pca = PCAGrid.open() recon_fluxes = my_pca.reconstruct_all() # we need to apply the same normalization to the synthetic fluxes that we # used for the reconstruction fluxes = np.empty((my_pca.M, my_pca.npix)) for i, spec in enumerate(my_HDF5.fluxes): fluxes[i,:] = spec # Normalize all of the fluxes to an average value of 1 # In order to remove uninteresting correlations fluxes = fluxes/np.average(fluxes, axis=1)[np.newaxis].T data = zip(my_HDF5.grid_points, fluxes, recon_fluxes)