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

debug

parent 2e0af30e
Loading
Loading
Loading
Loading
Loading
+34 −73
Original line number Diff line number Diff line
@@ -397,44 +397,7 @@ class StrayLight(object):
        return max(band_earth_e1, band_earth_e2)
    
###############################################################################  
####################################################################################


def processArgs(printHelp=False):
    """
    Processes command line arguments.
    """
    parser = OptionParser()

    parser.add_option('-c', '--configfile', dest='configfile',
                      help="Name of the configuration file", metavar="string")
    
    parser.add_option('-s', '--section', dest='section',
                      help="Name of the section of the config file [SCIENCE]", metavar="string")
    
    parser.add_option('-q', '--quadrant', dest='quadrant', help='CCD quadrant to simulate [0, 1, 2, 3]',
                      metavar='int')
    
    parser.add_option('-x', '--xCCD', dest='xCCD', help='CCD number in X-direction within the FPA matrix',
                      metavar='int')
    
    parser.add_option('-y', '--yCCD', dest='yCCD', help='CCD number in Y-direction within the FPA matrix',
                      metavar='int')
    
    parser.add_option('-d', '--debug', dest='debug', action='store_true',
                      help='Debugging mode on')
    
    parser.add_option('-t', '--test', dest='test', action='store_true',
                      help='Run unittest')
    
    parser.add_option('-f', '--fixed', dest='fixed', help='Use a fixed seed for the random number generators',
                      metavar='int')
    if printHelp:
        parser.print_help()
    else:
        return parser.parse_args()


###############################################################################
###############################################################################

def make_c_coor(fov, step):
@@ -1447,7 +1410,7 @@ class MCIsimulator():

            if home_path == '/home/yan':

                self.result_path = '../MCI_simData/'+self.source+ss+result_day
                self.result_path = '../MCI_simResult/'+self.source+"_"+result_day
            else:
                self.result_path = '/data/mcisimdata/'+result_day
                    
@@ -1713,32 +1676,33 @@ class MCIsimulator():
        theta = rotTelPos - rotSkyPos          
        
        ############ load star data catlog #####################            
        ##starcat='selection_20230517_concat.csv'
        
        starcat='selection_20230517_concat.fits'
        starcat='selection_MACSJ0744.9 3927_20230517_concat.csv'
        
        ##starcat='GaiaSource_675688-675713.csv'
        ##starcat='selection_20230517_concat.fits'
        ###################################################        
             
        self.log.info('Stat catlog file name is %s' % (starcat))
        
        da=fits.open(self.information['dir_path']+'MCI_inputData/star_input/'+starcat)   
        
        ####da=fits.open(starcat)
        ######################################################################
        # da=fits.open(self.information['dir_path']+'MCI_inputData/star_input/'+starcat)   
        
        df2=da[1].data
        ####
        # df2=da[1].data
        # del da
        
        #df2.index = range(len(df2))      
        ## limit the filed of view to 600*600 arcsec^2 square zone;
        ##########################################
        df2=pandas.read_csv(self.information['dir_path']+'MCI_inputData/star_input/'+starcat) 

        df3=df2[ (abs(df2['ra_gaia']-df2['ra_gaia'].mean())<400/3600.0) & (abs(df2['dec_gaia']-df2['dec_gaia'].mean())<400/3600.0) ]
        
        df3.index = range(len(df3))
        
        ###################################################
        
        # np.save('umag.npy', df3['umag'] )
        self.star=df3
        
        del da,df2,df3
        del df2,df3
        
        self.information['ra_obj']  = self.star['ra_gaia'].mean() 
        self.information['dec_obj'] = self.star['dec_gaia'].mean()
@@ -2218,7 +2182,7 @@ class MCIsimulator():
            st_magz.append(zmag)
            
           
            self.log.info('begin cal PSF')
            ## self.log.info('begin cal PSF')
            ######################################################################
            psf=dict() 
            
@@ -2252,11 +2216,11 @@ class MCIsimulator():
                stamp_img.setOrigin(0,0)                            
                stamp_img.scale=0.025  
                           
                self.log.info('begining galsim.PhotonArray.makeFromImage')
                # self.log.info('begining galsim.PhotonArray.makeFromImage')
                
                self.log.info('stamp_img.array.max()= %i' % (stamp_img.array.max()))
                # self.log.info('stamp_img.array.max()= %i' % (stamp_img.array.max()))
                
                print('stamp_img.array.max(): ', stamp_img.array.max() )
                ###print('stamp_img.array.max(): ', stamp_img.array.max() )
                
                #################################################   
                    
@@ -5438,11 +5402,11 @@ class MCIsimulator():
            print('applyPRNUeffect')

        ####################################################################
        # if self.source in sourcelist:
        #     if self.cosmicRays:
        #         # if self.debug == False: 
        #         self.addCosmicRays()
        #         print('addCosmicRays finisth')
        if self.source in sourcelist:
            if self.cosmicRays:
                # if self.debug == False: 
                self.addCosmicRays()
                print('addCosmicRays finisth')
                     
        ##################################################
        if self.skyback:
@@ -5463,23 +5427,20 @@ class MCIsimulator():
         
        #################################################

        # if self.bleeding:
        #     # if self.debug== False: 
        #     self.image_g=self.applyBleeding(self.image_g.copy())
        #     self.image_r=self.applyBleeding(self.image_r.copy())
        #     self.image_i=self.applyBleeding(self.image_i.copy())
        #     print('apply bleeding effect finisth')
        if self.bleeding:
            # if self.debug== False: 
            self.image_g=self.applyBleeding(self.image_g.copy())
            self.image_r=self.applyBleeding(self.image_r.copy())
            self.image_i=self.applyBleeding(self.image_i.copy())
            print('apply bleeding effect finisth')
     
        # ################################################
        ################################################
        
        # if self.nonlinearity:
        #     self.applyNonlinearity()
        #     print('applyNonlinearity')
        if self.nonlinearity:
            self.applyNonlinearity()
            print('applyNonlinearity')
          
        # ################################################
        

        
        #### read CCD image to output matrix as defined 
        
        
+163 B

File added.

No diff preview for this file type.

+2 −2
Original line number Diff line number Diff line
@@ -64,5 +64,5 @@ def CCDnonLinearityModel(data, beta=6e-7):
    return out
###################################################################

if __name__ == '__main__':
    print()
# if __name__ == '__main__':
#     print()
Loading