args = parser.parse_args() import matplotlib.pyplot as plt import multiprocessing as mp import numpy as np 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
import matplotlib.pyplot as plt import multiprocessing as mp import numpy as np 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