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

debug

parent 03b67b5b
Loading
Loading
Loading
Loading
Loading
+27 −67
Original line number Diff line number Diff line
@@ -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                
         
   
            ###################################################################
            ###### test code #####
@@ -2007,7 +1986,7 @@ 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]
@@ -2026,26 +2005,7 @@ class MCIsimulator():
            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'])           
            #########################################
            
            ##cal_SED_photons(self, flux_arr):
            intscales,PSF_eff_weight=self.cal_SED_photons(star_flux)