コード例 #1
0
    def getContinua(self, window):
        """Estimate continuum for each SED in library
        
           @param window    width of rolling median window to remove high frequency noise in Angstroms
        """

        ### Return list of SED names and SEDs on an array identical to that used to PCA the
        ### synthetic spectra
        name_list = self.sedsMasked.keys()
        waveLen, sed_array = sedMapper.get_sed_array(self.sedsMasked,
                                                     self.minWavelen,
                                                     self.maxWavelen,
                                                     self.nWavelen)

        ### Convert window in Angstroms to window in pixels (that is an odd integer)
        window_pix = int(window / (waveLen[1] - waveLen[0]))
        if (window_pix % 2 == 0):
            window_pix += 1

        for i in range(len(self.sedsMasked)):

            ### Pick SED out of masked library
            sed = sed_array[i, :]

            ### Reconstruct using the eigenspectra of the synthetic library (no emission lines/noise)
            sed_rec = self._reconstructSmoothSpectrum(sed)

            ### Return continuum after high-pass filtering to get rid of high frequency noise
            sed_continuum = self._getContinuum(sed, sed_rec, window_pix)

            ### Turn into SED object
            sedContinuum = SED(waveLen, sed_continuum)

            ### Add to dictionary
            self.sedsContinuum[name_list[i]] = sedContinuum
コード例 #2
0
 def getContinua(self, window):
     """Estimate continuum for each SED in library
     
        @param window    width of rolling median window to remove high frequency noise in Angstroms
     """
     
     ### Return list of SED names and SEDs on an array identical to that used to PCA the 
     ### synthetic spectra 
     name_list = self.sedsMasked.keys()
     waveLen, sed_array = sedMapper.get_sed_array(self.sedsMasked, 
                                                     self.minWavelen, self.maxWavelen, self.nWavelen)
                         
     ### Convert window in Angstroms to window in pixels (that is an odd integer)
     window_pix = int(window/(waveLen[1] - waveLen[0]))
     if (window_pix % 2 == 0):
         window_pix += 1
                         
     for i in range(len(self.sedsMasked)):
     
         ### Pick SED out of masked library
         sed = sed_array[i,:]
         
         ### Reconstruct using the eigenspectra of the synthetic library (no emission lines/noise)
         sed_rec = self._reconstructSmoothSpectrum(sed)
         
         ### Return continuum after high-pass filtering to get rid of high frequency noise 
         sed_continuum = self._getContinuum(sed, sed_rec, window_pix)
         
         ### Turn into SED object
         sedContinuum = SED(waveLen, sed_continuum)
         
         ### Add to dictionary
         self.sedsContinuum[name_list[i]] = sedContinuum
コード例 #3
0
    def _doPCA(self, nComps, syntheticSEDs):
        """Do PCA on the synthetic spectra
        
           @param nComps           number of components to keep
           @param syntheticSEDs    library of synthetic spectra
        """

        waveLen, smooth_spectra = sedMapper.get_sed_array(
            syntheticSEDs, self.minWavelen, self.maxWavelen, self.nWavelen)

        self.specPCA = sklPCA(nComps)
        self.specPCA.fit(smooth_spectra)
コード例 #4
0
 def _doPCA(self, nComps, syntheticSEDs):
     """Do PCA on the synthetic spectra
     
        @param nComps           number of components to keep
        @param syntheticSEDs    library of synthetic spectra
     """
 
     waveLen, smooth_spectra = sedMapper.get_sed_array(syntheticSEDs, 
                                                       self.minWavelen, self.maxWavelen, self.nWavelen)
 
     self.specPCA = sklPCA(nComps)
     self.specPCA.fit(smooth_spectra)