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 Original line Diff line number Diff line
@@ -121,42 +121,42 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'):
# SED Template
# SED Template




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

#     def __init__(self, log, path):

#         #


#         # parent = os.path.dirname(os.path.realpath(__file__))
    def __init__(self, log, path):
#         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):
        # parent = os.path.dirname(os.path.realpath(__file__))
#         """Calculating magnitude
        self.path = path
#         Args:
        hdulist = fits.open(
#             redshift (float, optional): redshift of spectra. Defaults to 0.
            self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits')
#         """

#         wave = self.wave * (1 + redshift)
        if len(hdulist) < 4:
#         self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u')
            log.error(
#         self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g')
                'Data error in galaxy_temp.fits file, please check!!!')
#         self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r')
            raise ValueError(
#         self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i')
                'Data error in galaxy_temp.fits file, please check!!!')
#         self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z')

        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():
# class Star_Temp():