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

update

parent 6c6b430c
Loading
Loading
Loading
Loading
Loading
+24 −24
Original line number Original line Diff line number Diff line
@@ -1398,7 +1398,7 @@ class MCIsimulator():
            df2 = pandas.read_csv(
            df2 = pandas.read_csv(
                self.information['dir_path']+'MCI_inputData/star_input/'+starcat)
                self.information['dir_path']+'MCI_inputData/star_input/'+starcat)
            ###
            ###
          
            #
            try:
            try:
                df2['ra_gaia'][10]
                df2['ra_gaia'][10]
            except NameError:
            except NameError:
@@ -1406,7 +1406,7 @@ class MCIsimulator():
                    'Error,no ra data in the star_cat catlog file ')
                    'Error,no ra data in the star_cat catlog file ')
                raise ValueError(
                raise ValueError(
                   'Error,no ra data in the star_cat catlog file ')
                   'Error,no ra data in the star_cat catlog file ')
                
            #
            try:
            try:
                df2['dec_gaia'][10]
                df2['dec_gaia'][10]
            except NameError:
            except NameError:
@@ -1414,13 +1414,13 @@ class MCIsimulator():
                    'Error,no dec data in the star_cat catlog file ')
                    'Error,no dec data in the star_cat catlog file ')
                raise ValueError(
                raise ValueError(
                   'Error,no dec data in the star_cat catlog file ')
                   'Error,no dec data in the star_cat catlog file ')
                    
            #
            if df2['ra_gaia'].max() > 360 or df2['ra_gaia'].min() < 0 or df2['dec_gaia'].max() > 90 or df2['dec_gaia'].min() < -90:
            if df2['ra_gaia'].max() > 360 or df2['ra_gaia'].min() < 0 or df2['dec_gaia'].max() > 90 or df2['dec_gaia'].min() < -90:
                self.log.error(
                self.log.error(
                    'ra or dec data beyond definition,please check!')
                    'ra or dec data beyond definition,please check!')
                raise ValueError(
                raise ValueError(
                   'ra or dec data beyond definition,please check!')
                   'ra or dec data beyond definition,please check!')
    
            #
            df3 = df2[(abs(df2['ra_gaia']-df2['ra_gaia'].mean()) < 400/3600.0)
            df3 = df2[(abs(df2['ra_gaia']-df2['ra_gaia'].mean()) < 400/3600.0)
                      & (abs(df2['dec_gaia']-df2['dec_gaia'].mean()) < 400/3600.0)]
                      & (abs(df2['dec_gaia']-df2['dec_gaia'].mean()) < 400/3600.0)]


@@ -1454,7 +1454,7 @@ class MCIsimulator():
                    'Error,no ra data in the star_cat catlog file ')
                    'Error,no ra data in the star_cat catlog file ')
                raise ValueError(
                raise ValueError(
                   'Error,no ra data in the star_cat catlog file ')
                   'Error,no ra data in the star_cat catlog file ')
                
            #
            try:
            try:
                self.star['dec'][10]
                self.star['dec'][10]
            except NameError:
            except NameError:
@@ -2351,16 +2351,16 @@ class MCIsimulator():


            if not os.path.exists(filename):
            if not os.path.exists(filename):
                print('finish load all the input galaxy image fits files')
                print('finish load all the input galaxy image fits files')
                
                #
                self.log.error(
                self.log.error(
                    'Error, when load input galaxy image fits files')
                    'Error, when load input galaxy image fits files')
                raise ValueError(
                raise ValueError(
                    'Error, when load input galaxy image fits files')
                    'Error, when load input galaxy image fits files')
                
                #
                break
                break


            srcs_cat = fits.open(filename)
            srcs_cat = fits.open(filename)
            
            #
            # ### load galaxy SED fitsfile  ###
            # ### load galaxy SED fitsfile  ###


            if self.lensing:
            if self.lensing:
@@ -2383,7 +2383,7 @@ class MCIsimulator():
            dec_list = []
            dec_list = []


            for kkk in range(1, len(srcs_cat)):
            for kkk in range(1, len(srcs_cat)):
                
                #
                # test input data
                # test input data
                try:
                try:
                    srcs_cat[kkk].header['new_ra']
                    srcs_cat[kkk].header['new_ra']
@@ -2392,7 +2392,7 @@ class MCIsimulator():
                        'Error,no ra data in the input galaxy data  file ')
                        'Error,no ra data in the input galaxy data  file ')
                    raise ValueError(
                    raise ValueError(
                       'Error,no ra data in the input galaxy data  file ')
                       'Error,no ra data in the input galaxy data  file ')
          
                #
                try:
                try:
                    srcs_cat[kkk].header['new_dec']
                    srcs_cat[kkk].header['new_dec']
                except NameError:
                except NameError:
@@ -2456,19 +2456,19 @@ class MCIsimulator():
                # # SED of j-th galaxy  ,# unit of 10-17 erg/s/A/cm2
                # # SED of j-th galaxy  ,# unit of 10-17 erg/s/A/cm2
                # here is k1+1, not k1, k1 begins with 0
                # here is k1+1, not k1, k1 begins with 0
                gal_flux = srcs_sed[k1+1].data
                gal_flux = srcs_sed[k1+1].data
                
                #
                if gal_flux.min() < 0 or len(gal_flux) < 100:
                if gal_flux.min() < 0 or len(gal_flux) < 100:
                    self.log.error(
                    self.log.error(
                        'Galaxy SED data error, please check!')
                        'Galaxy SED data error, please check!')
                    raise ValueError(
                    raise ValueError(
                       'Galaxy SED data error, please check!')
                       'Galaxy SED data error, please check!')
                    
                #
                if srcs_cat[k1+1].data.min() < 0 or srcs_cat[k1+1].data.max == 0 or srcs_cat[k1+1].data.ndim != 2:
                if srcs_cat[k1+1].data.min() < 0 or srcs_cat[k1+1].data.max == 0 or srcs_cat[k1+1].data.ndim != 2:
                    self.log.error(
                    self.log.error(
                        'Galaxy image data error, please check!')
                        'Galaxy image data error, please check!')
                    raise ValueError(
                    raise ValueError(
                       'Galaxy image data error, please check!')
                       'Galaxy image data error, please check!')
                    
                #
                ################################
                ################################
                # ## rotate the lensed_images_g  ###
                # ## rotate the lensed_images_g  ###
                if abs(theta.deg) > 0:
                if abs(theta.deg) > 0: