Example #1
0
    def setup_class(self):
        self.DataSpectrum = DataSpectrum.open(
            "../data/WASP14/WASP-14_2009-06-15_04h13m57s_cb.spec.flux",
            orders=np.array([22]))
        self.Instrument = TRES()
        self.HDF5Interface = HDF5Interface(
            "../libraries/PHOENIX_submaster.hdf5")

        stellar_Starting = {
            "temp": 6000,
            "logg": 4.05,
            "Z": -0.4,
            "vsini": 10.5,
            "vz": 15.5,
            "logOmega": -19.665
        }
        stellar_tuple = C.dictkeys_to_tuple(stellar_Starting)

        cheb_tuple = ("c1", "c2", "c3")
        cov_tuple = ("sigAmp", "logAmp", "l")
        region_tuple = ("h", "loga", "mu", "sigma")

        self.Model = Model(self.DataSpectrum,
                           self.Instrument,
                           self.HDF5Interface,
                           stellar_tuple=stellar_tuple,
                           cheb_tuple=cheb_tuple,
                           cov_tuple=cov_tuple,
                           region_tuple=region_tuple,
                           outdir="")
Example #2
0
    def __init__(self, DataSpectrum, Instrument, LibraryHA, LibraryLA,
                 parameters, deltaParameters):
        '''Initialize the comparison object.

        :param DataSpectrum: the spectrum that provides a wl grid + natural resolution
        :type DataSpectrum: :obj:`grid_tools.DataSpectrum`
        :param Instrument: the instrument object on which the DataSpectrum was acquired (ie, TRES, SPEX...)
        :type Instrument: :obj:`grid_tools.Instrument`
        :param LibraryHA: the path to the native resolution spectral library
        :type LibraryHA: string
        :param LibraryLA: the path to the approximate spectral library
        :type LibraryLA: string

        '''

        self.DataSpectrum = DataSpectrum
        self.Instrument = Instrument

        self.HDF5InterfaceHA = HDF5Interface(LibraryHA)
        self.HDF5InterfaceLA = HDF5Interface(LibraryLA)

        print("Bounds of the grids are")
        print("HA", self.HDF5InterfaceHA.bounds)
        print("LA", self.HDF5InterfaceLA.bounds)

        #If the DataSpectrum contains more than one order, we only take the first one. To get behavior with a
        # different order, you should only load that via the DataSpectrum(orders=[22]) flag.
        self.wl = self.DataSpectrum.wls[0]

        self.fullModelLA = Model(self.DataSpectrum,
                                 self.Instrument,
                                 self.HDF5InterfaceLA,
                                 stellar_tuple=("temp", "logg", "Z", "vsini",
                                                "vz", "logOmega"),
                                 cheb_tuple=("c1", "c2", "c3"),
                                 cov_tuple=("sigAmp", "logAmp", "l"),
                                 region_tuple=("loga", "mu", "sigma"))
        self.modelLA = self.fullModelLA.OrderModels[0]

        self.fullModelHA = ModelHA(self.DataSpectrum,
                                   self.Instrument,
                                   self.HDF5InterfaceHA,
                                   stellar_tuple=("temp", "logg", "Z", "vsini",
                                                  "vz", "logOmega"),
                                   cheb_tuple=("c1", "c2", "c3"),
                                   cov_tuple=("sigAmp", "logAmp", "l"),
                                   region_tuple=("loga", "mu", "sigma"))
        self.modelHA = self.fullModelHA.OrderModels[0]

        self.parameters = parameters
        self.deltaParameters = deltaParameters

        self.base = self.get_specHA(self.parameters)
        self.baseLA = self.get_specLA(self.parameters)
        self.approxResid = get_resid_spec(
            self.base, self.baseLA)  #modelHA - modelLA @ parameters