Commit 55c41637 authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

debug

parent 03b67b5b
Pipeline #4389 canceled with stage
in 0 seconds
......@@ -1753,17 +1753,9 @@ class MCIsimulator():
########## finish save PSF fits ##########################################
############################################################################
###### add binary stars to the star catlog #######
binary_star=np.array([[-0.05, 20, 20.5, 20, 19.5, 19, 18.8],
[-0.12, 20, 20.5, 20, 19.5, 19, 18.8],
[-5.45, 20, 20.5, 20, 19.5, 19, 18.8],
[-5.55, 20, 20.5, 20, 19.5, 19, 18.8],
[-10.05, 20, 20.5, 20, 19.5, 19, 18.8],
[-10.17, 20, 20.5, 20, 19.5, 19, 18.8],
[-15.45, 20, 20.5, 20, 19.5, 19, 18.8],
[-15.60, 20, 20.5, 20, 19.5, 19, 18.8]])
nsrcs=len(self.star['ra_gaia']) + 8
nsrcs=len(self.star['ra_gaia'])
self.log.info('load star catlog successfully')
......@@ -1906,31 +1898,18 @@ class MCIsimulator():
#################### generate star image ##########
# if self.debug:
# nstar=nsrcs
# else:
nstar=nsrcs
sim_binary_star=False
if sim_binary_star:
Nstar=nstar
else:
Nstar=nstar-8
for j in tqdm(range(Nstar)): ### nsrcs length
for j in tqdm(range(nsrcs)): ### nsrcs length
if j==0:
self.log.info('begin iteration........')
if j<nsrcs-8:
starRa = 3600.0*( newRa[j] ) # ra of star, arcsecond
starDec = 3600.0*( newDec[j] ) # dec of star, arcsecond
else:
starRa =binary_star[j-nsrcs, 0]+ self.information['ra_obj']*3600.0
starDec =binary_star[j-nsrcs, 1]+ self.information['dec_obj']*3600.0
starRa = 3600.0*( newRa[j] ) # ra of star, arcsecond
starDec = 3600.0*( newDec[j] ) # dec of star, arcsecond
###################################################################
###### test code #####
......@@ -2007,45 +1986,26 @@ class MCIsimulator():
####### use SED_code to generate star SED #######
# SED of j-th star
if j<nsrcs-8:
umag = self.star['umag'][j]
gmag = self.star['gmag'][j]
rmag = self.star['rmag'][j]
imag = self.star['imag'][j]
zmag = self.star['zmag'][j]
wave = np.linspace(2500, 11000, 8501)
# Input redshift
redshift = 0
# Loading galaxy SED template
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.information['dir_path'])
# else:
# umag = binary_star[j-nsrcs, 2]
# gmag = binary_star[j-nsrcs, 3]
# rmag = binary_star[j-nsrcs, 4]
# imag = binary_star[j-nsrcs, 5]
# zmag = binary_star[j-nsrcs, 6]
# wave = np.linspace(2500, 11000, 8501)
# # Input redshift
# redshift = 0
# # Loading galaxy SED template
# 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.information['dir_path'])
#########################################
umag = self.star['umag'][j]
gmag = self.star['gmag'][j]
rmag = self.star['rmag'][j]
imag = self.star['imag'][j]
zmag = self.star['zmag'][j]
wave = np.linspace(2500, 11000, 8501)
# Input redshift
redshift = 0
# Loading galaxy SED template
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.information['dir_path'])
##cal_SED_photons(self, flux_arr):
intscales,PSF_eff_weight=self.cal_SED_photons(star_flux)
......
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