Loading Catalog/testCat_fits.py +14 −13 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ NSIDE = 128 class Catalog(CatalogBase): def __init__(self, config, chip, pointing, chip_output, filt, **kwargs): super().__init__() self.cat_dir = os.path.join(config["data_dir"], config["catalog_options"]["input_path"]["cat_dir"]) self.seed_Av = config["catalog_options"]["seed_Av"] self.cat_dir = config["catalog_options"]["input_path"]["cat_dir"] self.seed_Av = 121212 #config["catalog_options"]["seed_Av"] # (TEST) self.cosmo = FlatLambdaCDM(H0=67.66, Om0=0.3111) Loading @@ -46,6 +46,8 @@ class Catalog(CatalogBase): with pkg_resources.path('Catalog.data', 'SLOAN_SDSS.g.fits') as filter_path: self.normF_star = Table.read(str(filter_path)) with pkg_resources.path('Catalog.data', 'lsst_throuput_g.fits') as filter_path: self.normF_galaxy = Table.read(str(filter_path)) self.config = config self.chip = chip Loading @@ -58,16 +60,9 @@ class Catalog(CatalogBase): self.stamp_path = os.path.join(self.cat_dir, stamp_file) #self.stamp_SED_path = os.path.join(config["data_dir"], config["SED_templates_path"]["stamp_SED"]) ###shoule be stamp-SED #self._load_SED_lib_stamps() ###shoule be stamp-SED self.tempSed_gal, self.tempRed_gal = seds("galaxy.list", seddir="/share/simudata/CSSOSDataProductsSims/data/Templates/Galaxy/") #only for test self.tempSed_gal, self.tempRed_gal = seds("galaxy.list", seddir="/public/home/chengliang/CSSOSDataProductsSims/testCats/Templates/Galaxy/") #only for test if "rotateEll" in config["catalog_options"]: self.rotation = float(int(config["catalog_options"]["rotateEll"]/45.)) else: self.rotation = 0. # Update output .cat header with catalog specific output columns self._add_output_columns_header() self._get_healpix_list() self._load() Loading Loading @@ -99,19 +94,21 @@ class Catalog(CatalogBase): def load_norm_filt(self, obj): if obj.type == "stamp": #return self.normF_galaxy ###normalize_filter for stamp return None return self.normF_galaxy ###normalize_filter for stamp else: return None def _load_stamps(self, stamps, pix_id=None): print("debug:: load_stamps") nstamps = len(stamps['filename']) self.rng_sedGal = random.Random() self.rng_sedGal.seed(pix_id) # Use healpix index as the random seed self.rng_sedGal.seed(float(pix_id)) # Use healpix index as the random seed self.ud = galsim.UniformDeviate(pix_id) for istamp in range(nstamps): print("debug::", istamp) fitsfile = os.path.join(self.cat_dir, "stampCats/"+stamps['filename'][istamp].decode('utf-8')) print("debug::", istamp, fitsfile) hdu=fitsio.open(fitsfile) param = self.initialize_param() Loading Loading @@ -167,6 +164,7 @@ class Catalog(CatalogBase): param['redden'] = self.tempRed_gal[param['sed_type']] param['av'] = 0.0 param['redden'] = 0 param['mu'] = 1 #param["CSSTmag"]= True #param["mag_r"] = 20. Loading @@ -183,9 +181,12 @@ class Catalog(CatalogBase): if "stamp_cat" in self.config["catalog_options"]["input_path"] and self.config["catalog_options"]["input_path"]["stamp_cat"] and self.config["catalog_options"]["stamp_yes"]: stamps_cat = h5.File(self.stamp_path, 'r')['Stamps'] print("debug::",stamps_cat.keys()) for pix in self.pix_list: try: stamps = stamps_cat[str(pix)] print("debug::",stamps.keys()) self._load_stamps(stamps, pix_id=pix) del stamps except Exception as e: Loading config/config_overall_newStar_fits.yaml 0 → 100644 +146 −0 Original line number Diff line number Diff line --- ############################################### # # Configuration file for CSST simulation # Overall settings # CSST-Sim Group, 2024/01/08 # ############################################### # Base diretories and naming setup # can add some of the command-line arguments here as well; # ok to pass either way or both, as long as they are consistent work_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_C9Tests/" run_name: "testRun0" # Project cycle and run counter are used to name the outputs project_cycle: 9 run_counter: 1 # Run options run_option: # Output catalog only? # If yes, no imaging simulation will be run. Only the catalogs # of corresponding footprints will be generated. out_cat_only: NO ############################################### # Catalog setting ############################################### # Configure the input catalog: options should be implemented # in the corresponding (user defined) 'Catalog' class catalog_options: input_path: cat_dir: "/public/home/chengliang/CSSOSDataProductsSims/testCats/" # star_cat: "star_catalog/" # galaxy_cat: "qsocat/cat2CSSTSim_bundle-50sqDeg/" stamp_cat: "stampCatsIndex.hdf5" SED_templates_path: # star_SED: # galaxy_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/" # AGN_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/qsocat/qsosed/" # stamp_SED: # Only simulate stars? star_only: NO # Only simulate galaxies? galaxy_only: NO # With stamp? stamp_yes: YES # rotate galaxy ellipticity rotateEll: 0. # [degree] ############################################### # Observation setting ############################################### obs_setting: # (Optional) a file of point list # if you just want to run default pointing: # - pointing_dir: null # - pointing_file: null pointing_file: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/pointing50_C9/pointing_50_1_n.dat" obs_config_file: "/public/home/chengliang/CSSOSDataProductsSims/csst_msc_sim/config/obs_config_SCI_WIDE_phot.yaml" # Run specific pointing(s): # - give a list of indexes of pointings: [ip_1, ip_2...] # - run all pointings: null # Note: only valid when a pointing list is specified run_pointings: [0] # Whether to enable astrometric modeling enable_astrometric_model: YES # Cut by saturation magnitude in which band? cut_in_band: "z" # saturation magnitude margin mag_sat_margin: -2.5 # mag_sat_margin: -15. # limiting magnitude margin mag_lim_margin: +1.0 ############################################### # PSF setting ############################################### psf_setting: # Which PSF model to use: # "Gauss": simple gaussian profile # "Interp": Interpolated PSF from sampled ray-tracing data psf_model: "Interp" # PSF size [arcseconds] # radius of 80% energy encircled # NOTE: only valid for "Gauss" PSF # psf_rcont: 0.15 # path to PSF data # NOTE: only valid for "Interp" PSF # PSF models for photometry survey simulation psf_pho_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/psfCube/set1_dynamic/" # PSF models for slitless spectrum survey simulation psf_sls_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/SLS_PSF_PCA_fp/" ############################################### # Shear setting ############################################### shear_setting: # Options to generate mock shear field: # "constant": all galaxies are assigned a constant reduced shear # "catalog": get shear values from catalog shear_type: "constant" # For constant shear field reduced_g1: 0. reduced_g2: 0. ############################################### # Output options ############################################### output_setting: output_format: "channels" # Whether to export as 16 channels (subimages) with pre- and over-scan ("image"/"channels") shutter_output: NO # Whether to export shutter effect 16-bit image prnu_output: NO # Whether to export the PRNU (pixel-to-pixel flat-fielding) files ############################################### # Random seeds ############################################### random_seeds: seed_poisson: 20210601 # Seed for Poisson noise seed_CR: 20210317 # Seed for generating random cosmic ray maps seed_flat: 20210101 # Seed for generating random flat fields seed_prnu: 20210102 # Seed for photo-response non-uniformity seed_gainNonUniform: 20210202 # Seed for gain nonuniformity seed_biasNonUniform: 20210203 # Seed for bias nonuniformity seed_rnNonUniform: 20210204 # Seed for readout-noise nonuniformity seed_badcolumns: 20240309 # Seed for bad columns seed_defective: 20210304 # Seed for defective (bad) pixels seed_readout: 20210601 # Seed for read-out gaussian noise ... Loading
Catalog/testCat_fits.py +14 −13 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ NSIDE = 128 class Catalog(CatalogBase): def __init__(self, config, chip, pointing, chip_output, filt, **kwargs): super().__init__() self.cat_dir = os.path.join(config["data_dir"], config["catalog_options"]["input_path"]["cat_dir"]) self.seed_Av = config["catalog_options"]["seed_Av"] self.cat_dir = config["catalog_options"]["input_path"]["cat_dir"] self.seed_Av = 121212 #config["catalog_options"]["seed_Av"] # (TEST) self.cosmo = FlatLambdaCDM(H0=67.66, Om0=0.3111) Loading @@ -46,6 +46,8 @@ class Catalog(CatalogBase): with pkg_resources.path('Catalog.data', 'SLOAN_SDSS.g.fits') as filter_path: self.normF_star = Table.read(str(filter_path)) with pkg_resources.path('Catalog.data', 'lsst_throuput_g.fits') as filter_path: self.normF_galaxy = Table.read(str(filter_path)) self.config = config self.chip = chip Loading @@ -58,16 +60,9 @@ class Catalog(CatalogBase): self.stamp_path = os.path.join(self.cat_dir, stamp_file) #self.stamp_SED_path = os.path.join(config["data_dir"], config["SED_templates_path"]["stamp_SED"]) ###shoule be stamp-SED #self._load_SED_lib_stamps() ###shoule be stamp-SED self.tempSed_gal, self.tempRed_gal = seds("galaxy.list", seddir="/share/simudata/CSSOSDataProductsSims/data/Templates/Galaxy/") #only for test self.tempSed_gal, self.tempRed_gal = seds("galaxy.list", seddir="/public/home/chengliang/CSSOSDataProductsSims/testCats/Templates/Galaxy/") #only for test if "rotateEll" in config["catalog_options"]: self.rotation = float(int(config["catalog_options"]["rotateEll"]/45.)) else: self.rotation = 0. # Update output .cat header with catalog specific output columns self._add_output_columns_header() self._get_healpix_list() self._load() Loading Loading @@ -99,19 +94,21 @@ class Catalog(CatalogBase): def load_norm_filt(self, obj): if obj.type == "stamp": #return self.normF_galaxy ###normalize_filter for stamp return None return self.normF_galaxy ###normalize_filter for stamp else: return None def _load_stamps(self, stamps, pix_id=None): print("debug:: load_stamps") nstamps = len(stamps['filename']) self.rng_sedGal = random.Random() self.rng_sedGal.seed(pix_id) # Use healpix index as the random seed self.rng_sedGal.seed(float(pix_id)) # Use healpix index as the random seed self.ud = galsim.UniformDeviate(pix_id) for istamp in range(nstamps): print("debug::", istamp) fitsfile = os.path.join(self.cat_dir, "stampCats/"+stamps['filename'][istamp].decode('utf-8')) print("debug::", istamp, fitsfile) hdu=fitsio.open(fitsfile) param = self.initialize_param() Loading Loading @@ -167,6 +164,7 @@ class Catalog(CatalogBase): param['redden'] = self.tempRed_gal[param['sed_type']] param['av'] = 0.0 param['redden'] = 0 param['mu'] = 1 #param["CSSTmag"]= True #param["mag_r"] = 20. Loading @@ -183,9 +181,12 @@ class Catalog(CatalogBase): if "stamp_cat" in self.config["catalog_options"]["input_path"] and self.config["catalog_options"]["input_path"]["stamp_cat"] and self.config["catalog_options"]["stamp_yes"]: stamps_cat = h5.File(self.stamp_path, 'r')['Stamps'] print("debug::",stamps_cat.keys()) for pix in self.pix_list: try: stamps = stamps_cat[str(pix)] print("debug::",stamps.keys()) self._load_stamps(stamps, pix_id=pix) del stamps except Exception as e: Loading
config/config_overall_newStar_fits.yaml 0 → 100644 +146 −0 Original line number Diff line number Diff line --- ############################################### # # Configuration file for CSST simulation # Overall settings # CSST-Sim Group, 2024/01/08 # ############################################### # Base diretories and naming setup # can add some of the command-line arguments here as well; # ok to pass either way or both, as long as they are consistent work_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_C9Tests/" run_name: "testRun0" # Project cycle and run counter are used to name the outputs project_cycle: 9 run_counter: 1 # Run options run_option: # Output catalog only? # If yes, no imaging simulation will be run. Only the catalogs # of corresponding footprints will be generated. out_cat_only: NO ############################################### # Catalog setting ############################################### # Configure the input catalog: options should be implemented # in the corresponding (user defined) 'Catalog' class catalog_options: input_path: cat_dir: "/public/home/chengliang/CSSOSDataProductsSims/testCats/" # star_cat: "star_catalog/" # galaxy_cat: "qsocat/cat2CSSTSim_bundle-50sqDeg/" stamp_cat: "stampCatsIndex.hdf5" SED_templates_path: # star_SED: # galaxy_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/" # AGN_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/qsocat/qsosed/" # stamp_SED: # Only simulate stars? star_only: NO # Only simulate galaxies? galaxy_only: NO # With stamp? stamp_yes: YES # rotate galaxy ellipticity rotateEll: 0. # [degree] ############################################### # Observation setting ############################################### obs_setting: # (Optional) a file of point list # if you just want to run default pointing: # - pointing_dir: null # - pointing_file: null pointing_file: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/pointing50_C9/pointing_50_1_n.dat" obs_config_file: "/public/home/chengliang/CSSOSDataProductsSims/csst_msc_sim/config/obs_config_SCI_WIDE_phot.yaml" # Run specific pointing(s): # - give a list of indexes of pointings: [ip_1, ip_2...] # - run all pointings: null # Note: only valid when a pointing list is specified run_pointings: [0] # Whether to enable astrometric modeling enable_astrometric_model: YES # Cut by saturation magnitude in which band? cut_in_band: "z" # saturation magnitude margin mag_sat_margin: -2.5 # mag_sat_margin: -15. # limiting magnitude margin mag_lim_margin: +1.0 ############################################### # PSF setting ############################################### psf_setting: # Which PSF model to use: # "Gauss": simple gaussian profile # "Interp": Interpolated PSF from sampled ray-tracing data psf_model: "Interp" # PSF size [arcseconds] # radius of 80% energy encircled # NOTE: only valid for "Gauss" PSF # psf_rcont: 0.15 # path to PSF data # NOTE: only valid for "Interp" PSF # PSF models for photometry survey simulation psf_pho_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/psfCube/set1_dynamic/" # PSF models for slitless spectrum survey simulation psf_sls_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/SLS_PSF_PCA_fp/" ############################################### # Shear setting ############################################### shear_setting: # Options to generate mock shear field: # "constant": all galaxies are assigned a constant reduced shear # "catalog": get shear values from catalog shear_type: "constant" # For constant shear field reduced_g1: 0. reduced_g2: 0. ############################################### # Output options ############################################### output_setting: output_format: "channels" # Whether to export as 16 channels (subimages) with pre- and over-scan ("image"/"channels") shutter_output: NO # Whether to export shutter effect 16-bit image prnu_output: NO # Whether to export the PRNU (pixel-to-pixel flat-fielding) files ############################################### # Random seeds ############################################### random_seeds: seed_poisson: 20210601 # Seed for Poisson noise seed_CR: 20210317 # Seed for generating random cosmic ray maps seed_flat: 20210101 # Seed for generating random flat fields seed_prnu: 20210102 # Seed for photo-response non-uniformity seed_gainNonUniform: 20210202 # Seed for gain nonuniformity seed_biasNonUniform: 20210203 # Seed for bias nonuniformity seed_rnNonUniform: 20210204 # Seed for readout-noise nonuniformity seed_badcolumns: 20240309 # Seed for bad columns seed_defective: 20210304 # Seed for defective (bad) pixels seed_readout: 20210601 # Seed for read-out gaussian noise ...