changhoonhahn / gqp_mc

GQP mock challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

speculator normalization issue

changhoonhahn opened this issue · comments

The current version of speculator is trained on unnormalized SEDs --- i.e. the spectrum is not normalized by the integral of the SFH.

        for i, tage, m, z in zip(range(len(tages)), tages, sfh, zh): 
            if m <= 0: # no star formation in this bin 
                continue
            self._ssp.params['logzsol'] = np.log10(z/0.0190) # log(Z/Zsun)
            if self.model_name == 'fsps': 
                self._ssp.params['dust2'] = tt_dust 
            elif self.model_name == 'fsps_complexdust': 
                self._ssp.params['dust1'] = tt_dust1
                self._ssp.params['dust2'] = tt_dust2 
                self._ssp.params['dust3'] = tt_dust_index
            wave_rest, lum_i = self._ssp.get_spectrum(tage=tage, peraa=True) # in units of Lsun/AA

            if i == 0: 
                lum_ssp = np.zeros(len(wave_rest))
            lum_ssp += m * lum_i 

        lum_ssp /= np.sum(sfh)        # this line is missing
        return wave_rest, lum_ssp

Closing this issue since this falls under #52