Commit cd939224 authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent f6a0c574
Loading
Loading
Loading
Loading
Loading
+35 −35
Original line number Diff line number Diff line
@@ -121,42 +121,42 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'):
# SED Template


# class Gal_Temp():
#     """
#     Template of Galaxy SED
#     """

#     def __init__(self, log, path):

#         #
class Gal_Temp():
    """
    Template of Galaxy SED
    """

#         # parent = os.path.dirname(os.path.realpath(__file__))
#         self.path = path
#         hdulist = fits.open(
#             self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits')
    def __init__(self, log, path):

#         if len(hdulist) < 4:
#             log.error(
#                 'Data error in galaxy_temp.fits file, please check!!!')
#             raise ValueError(
#                 'Data error in galaxy_temp.fits file, please check!!!')

#         self.wave = hdulist[1].data['wave']
#         self.flux = hdulist[2].data
#         self.age_grid = hdulist[3].data['logAge']
#         self.feh_grid = hdulist[3].data['FeH']
        #

#     def toMag(self, redshift=0):
#         """Calculating magnitude
#         Args:
#             redshift (float, optional): redshift of spectra. Defaults to 0.
#         """
#         wave = self.wave * (1 + redshift)
#         self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u')
#         self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g')
#         self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r')
#         self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i')
#         self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z')
        # parent = os.path.dirname(os.path.realpath(__file__))
        self.path = path
        hdulist = fits.open(
            self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits')

        if len(hdulist) < 4:
            log.error(
                'Data error in galaxy_temp.fits file, please check!!!')
            raise ValueError(
                'Data error in galaxy_temp.fits file, please check!!!')

        self.wave = hdulist[1].data['wave']
        self.flux = hdulist[2].data
        self.age_grid = hdulist[3].data['logAge']
        self.feh_grid = hdulist[3].data['FeH']

    def toMag(self, redshift=0):
        """Calculating magnitude
        Args:
            redshift (float, optional): redshift of spectra. Defaults to 0.
        """
        wave = self.wave * (1 + redshift)
        self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u')
        self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g')
        self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r')
        self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i')
        self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z')


# class Star_Temp():