Commit 5f8779ad authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

test

parent e0768565
Pipeline #4057 failed with stage
in 0 seconds
......@@ -2031,7 +2031,7 @@ class MCIsimulator():
st_magz=[]
self.log.info('load star catlog 777777777')
#################### generate star image ##########
if self.debug:
......@@ -2047,7 +2047,10 @@ class MCIsimulator():
Nstar=nstar-8
for j in tqdm(range(Nstar)): ### nsrcs length
for j in tqdm(range(Nstar)): ### nsrcs length
self.log.info('begin iteration........')
if j<nsrcs-8:
starRa = 3600.0*( newRa[j] ) # ra of star, arcsecond
......@@ -2140,13 +2143,19 @@ class MCIsimulator():
wave = np.linspace(2500, 11000, 8501)
# Input redshift
redshift = 0
self.log.info('load star catlog 777777777')
# Loading galaxy SED template
t=sed.Gal_Temp()
t=sed.Gal_Temp(self.information['dir_path'])
# Calculating the magnitude (u, g, r, i, z) of each template
t.toMag(redshift=redshift)
# Calculating flux
ugriz = np.array([umag, gmag, rmag, imag, zmag])
star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t)
star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t)
self.log.info('load star catlog 888888888888')
else:
......@@ -2158,19 +2167,22 @@ class MCIsimulator():
wave = np.linspace(2500, 11000, 8501)
# Input redshift
redshift = 0
redshift = 0
# Loading galaxy SED template
t=sed.Gal_Temp()
t=sed.Gal_Temp(self.information['dir_path'])
# Calculating the magnitude (u, g, r, i, z) of each template
t.toMag(redshift=redshift)
# Calculating flux
ugriz = np.array([umag, gmag, rmag, imag, zmag])
star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t)
#########################################
self.log.info('load star catlog 99999999')
##cal_SED_photons(self, flux_arr):
intscales,PSF_eff_weight=self.cal_SED_photons(star_flux)
self.information['dir_path 99999999999999']
gx=dict()
gy=dict()
......
......@@ -56,7 +56,7 @@ def reddening(wave, flux, ebv = 0.0, law = 'calzetti', Rv = 4.05):
fluxNew = flux / (10. ** (0.4 * ebv * curve))
return fluxNew
def flux_to_mag(wave, flux, band='GAIA_bp'):
def flux_to_mag(wave, flux, path, band='GAIA_bp'):
"""Convert flux of given spectra to magnitude
Args:
......@@ -68,11 +68,11 @@ def flux_to_mag(wave, flux, band='GAIA_bp'):
float: value of magnitude
"""
# /home/yan/MCI_sim/MCI_input/SED_Code/data
import os
##import os
parent = os.path.dirname(os.path.realpath(__file__))
###parent = os.path.dirname(os.path.realpath(__file__))
band = ascii.read(parent+'/seddata/' + band + '.dat')
band = ascii.read(path+'MCI_inputData/SED_Code/seddata/' + band + '.dat')
wave0= band['col1']
curv0= band['col2']
......@@ -120,12 +120,13 @@ class Gal_Temp():
Template of Galaxy SED
"""
def __init__(self):
import os
def __init__(self,path):
parent = os.path.dirname(os.path.realpath(__file__))
###import os
hdulist = fits.open(parent+'/seddata/galaxy_temp.fits')
###parent = os.path.dirname(os.path.realpath(__file__))
hdulist = fits.open(path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits')
self.wave = hdulist[1].data['wave']
self.flux = hdulist[2].data
self.age_grid = hdulist[3].data['logAge']
......@@ -149,14 +150,14 @@ class Star_Temp():
Template of Stellar SED
"""
def __init__(self):
def __init__(self,path):
import os
##import os
parent = os.path.dirname(os.path.realpath(__file__))
####parent = os.path.dirname(os.path.realpath(__file__))
###print("获取其父目录——" + parent) # 从当前文件路径中获取目录
hdulist = fits.open(parent+'/seddata/stellar_temp.fits')
hdulist = fits.open(path+'MCI_inputData/SED_Code/seddata/stellar_temp.fits')
self.wave = hdulist[1].data['wave']
self.flux = hdulist[2].data
self.Teff_grid = hdulist[3].data['Teff']
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment