Commit a5d541c9 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

code clean

parent ffe6d3f5
...@@ -27,10 +27,7 @@ class C3Catalog(CatalogBase): ...@@ -27,10 +27,7 @@ class C3Catalog(CatalogBase):
super().__init__() super().__init__()
self.cat_dir = os.path.join(config["data_dir"], config["input_path"]["cat_dir"]) self.cat_dir = os.path.join(config["data_dir"], config["input_path"]["cat_dir"])
self.seed_Av = config["random_seeds"]["seed_Av"] self.seed_Av = config["random_seeds"]["seed_Av"]
# self.normalize_dir = os.path.join(config["data_dir"], config["SLS_path"]["SLS_norm"])
# self.normF_star = Table.read(os.path.join(self.normalize_dir, 'SLOAN_SDSS.g.fits'))
# self.normF_galaxy = Table.read(os.path.join(self.normalize_dir, 'lsst_throuput_g.fits'))
with pkg_resources.path('Catalog.data', 'SLOAN_SDSS.g.fits') as filter_path: with pkg_resources.path('Catalog.data', 'SLOAN_SDSS.g.fits') as filter_path:
self.normF_star = Table.read(str(filter_path)) self.normF_star = Table.read(str(filter_path))
with pkg_resources.path('Catalog.data', 'lsst_throuput_g.fits') as filter_path: with pkg_resources.path('Catalog.data', 'lsst_throuput_g.fits') as filter_path:
...@@ -154,7 +151,6 @@ class C3Catalog(CatalogBase): ...@@ -154,7 +151,6 @@ class C3Catalog(CatalogBase):
pmdec_list = np.zeros(nstars).tolist() pmdec_list = np.zeros(nstars).tolist()
rv_list = np.zeros(nstars).tolist() rv_list = np.zeros(nstars).tolist()
parallax_list = [1e-9] * nstars parallax_list = [1e-9] * nstars
# lib_path = os.path.join(self.config["data_dir"], self.config["obs_setting"]["astrometric_lib"])
dt = datetime.fromtimestamp(self.pointing.timestamp) dt = datetime.fromtimestamp(self.pointing.timestamp)
date_str = dt.date().isoformat() date_str = dt.date().isoformat()
time_str = dt.time().isoformat() time_str = dt.time().isoformat()
......
...@@ -19,7 +19,7 @@ class ChipOutput(object): ...@@ -19,7 +19,7 @@ class ChipOutput(object):
exp_name = imgKey0 + "_%s_%s.fits" exp_name = imgKey0 + "_%s_%s.fits"
self.chipLabel = focal_plane.getChipLabel(chip.chipID) self.chipLabel = focal_plane.getChipLabel(chip.chipID)
self.img_name = prefix + exp_name%(self.chipLabel, filt.filter_type) self.img_name = prefix + exp_name%(self.chipLabel, filt.filter_type)
# self.cat_name = self.img_name[:-5] + ".cat"
self.cat_name = 'MSC_' + config["obs_setting"]["date_obs"] + config["obs_setting"]["time_obs"] + "_" + str(pointing_ID).rjust(7, '0') + "_" + self.chipLabel.rjust(2,'0') + ".cat" self.cat_name = 'MSC_' + config["obs_setting"]["date_obs"] + config["obs_setting"]["time_obs"] + "_" + str(pointing_ID).rjust(7, '0') + "_" + self.chipLabel.rjust(2,'0') + ".cat"
self.subdir = subdir self.subdir = subdir
......
...@@ -23,27 +23,6 @@ def config_dir(config, work_dir=None, data_dir=None): ...@@ -23,27 +23,6 @@ def config_dir(config, work_dir=None, data_dir=None):
# PSF data directory # PSF data directory
path_dict["psf_dir"] = os.path.join(path_dict["data_dir"], config["psf_setting"]["psf_dir"]) path_dict["psf_dir"] = os.path.join(path_dict["data_dir"], config["psf_setting"]["psf_dir"])
path_dict["fd_path"] = os.path.join(path_dict["data_dir"], config["psf_setting"]["fd_path"]) path_dict["fd_path"] = os.path.join(path_dict["data_dir"], config["psf_setting"]["fd_path"])
# SED catalog directory
# TODO: SED_dir is deprecated
path_dict["SED_dir"] = os.path.join(path_dict["data_dir"], "imageSims/Catalog/SEDObject")
# Directories/files for instrument parameters, e.g. efficiency curves.
# path_dict["filter_dir"] = os.path.join(path_dict["data_dir"], config["Efficiency_curve_path"]["filter_eff"])
# path_dict["ccd_dir"] = os.path.join(path_dict["data_dir"], config["Efficiency_curve_path"]["ccd_eff"])
# path_dict["mirror_file"] = os.path.join(path_dict["data_dir"], config["Efficiency_curve_path"]["mirror_eff"])
# Cosmic-ray data directory:
# path_dict["CRdata_dir"] = os.path.join(path_dict["data_dir"], config["CR_data_path"])
# if "sky_file" in config:
# path_dict["sky_file"] = os.path.join(path_dict["data_dir"], config["sky_file"])
# else:
# path_dict["sky_file"] = 'sky_emiss_hubble_50_50_A.dat'
# path_dict["sky_file"] = os.path.join(path_dict["data_dir"], config["sky_data_path"])
# Slitless spectroscopy realted
# path_dict["sls_dir"] = os.path.join(path_dict["data_dir"], config["SLS_path"]["SLS_conf"])
# path_dict["normalize_dir"] = os.path.join(path_dict["data_dir"], config["SLS_path"]["SLS_norm"])
return path_dict return path_dict
......
...@@ -131,7 +131,13 @@ class Galaxy(MockObject): ...@@ -131,7 +131,13 @@ class Galaxy(MockObject):
bulge_shape = galsim.Shear(g1=self.e1_bulge, g2=self.e2_bulge) bulge_shape = galsim.Shear(g1=self.e1_bulge, g2=self.e2_bulge)
bulge = bulge.shear(bulge_shape) bulge = bulge.shear(bulge_shape)
gal = self.bfrac * bulge + (1.0 - self.bfrac) * disk # gal = self.bfrac * bulge + (1.0 - self.bfrac) * disk
# (TEST) Random knots
knots = galsim.RandomKnots(npoints=100, profile=disk)
kfrac = np.random.random()*(1.0 - self.bfrac)
gal = self.bfrac * bulge + (1.0 - self.bfrac - kfrac) * disk + kfrac * knots
gal = gal.withFlux(nphotons) gal = gal.withFlux(nphotons)
gal_shear = galsim.Shear(g1=g1, g2=g2) gal_shear = galsim.Shear(g1=g1, g2=g2)
gal = gal.shear(gal_shear) gal = gal.shear(gal_shear)
...@@ -214,7 +220,13 @@ class Galaxy(MockObject): ...@@ -214,7 +220,13 @@ class Galaxy(MockObject):
bulge_shape = galsim.Shear(g1=self.e1_bulge, g2=self.e2_bulge) bulge_shape = galsim.Shear(g1=self.e1_bulge, g2=self.e2_bulge)
bulge = bulge.shear(bulge_shape) bulge = bulge.shear(bulge_shape)
gal = self.bfrac * bulge + (1.0 - self.bfrac) * disk # gal = self.bfrac * bulge + (1.0 - self.bfrac) * disk
# (TEST) Random knots
knots = galsim.RandomKnots(npoints=100, profile=disk)
kfrac = np.random.random()*(1.0 - self.bfrac)
gal = self.bfrac * bulge + (1.0 - self.bfrac - kfrac) * disk + kfrac * knots
gal = gal.withFlux(tel.pupil_area * exptime) gal = gal.withFlux(tel.pupil_area * exptime)
gal_shear = galsim.Shear(g1=g1, g2=g2) gal_shear = galsim.Shear(g1=g1, g2=g2)
gal = gal.shear(gal_shear) gal = gal.shear(gal_shear)
......
...@@ -10,16 +10,15 @@ ...@@ -10,16 +10,15 @@
# Can add some of the command-line arguments here as well; # Can add some of the command-line arguments here as well;
# OK to pass either way or both, as long as they are consistent # OK to pass either way or both, as long as they are consistent
# work_dir: "/public/home/fangyuedong/sim_code_release/CSST/test/" # work_dir: "/public/home/fangyuedong/sim_code_release/CSST/test/"
work_dir: "/public/home/fangyuedong/current_csst/CSST/workplace/" work_dir: "/public/home/fangyuedong/temp/CSST/workplace/"
data_dir: "/data/simudata/CSSOSDataProductsSims/data/" data_dir: "/data/simudata/CSSOSDataProductsSims/data/"
run_name: "TEST_importlib" run_name: "TEST_random_knots"
# (Optional) a file of point list # (Optional) a file of point list
# if you just want to run default pointing: # if you just want to run default pointing:
# - pointing_dir: null # - pointing_dir: null
# - pointing_file: null # - pointing_file: null
pointing_dir: "/data/simudata/CSSOSDataProductsSims/data/" pointing_dir: "/data/simudata/CSSOSDataProductsSims/data/"
# pointing_file: "pointing10_20210202.dat"
pointing_file: "pointing_test1214.dat" pointing_file: "pointing_test1214.dat"
# Whether to use MPI # Whether to use MPI
...@@ -35,7 +34,7 @@ run_option: ...@@ -35,7 +34,7 @@ run_option:
out_cat_only: NO out_cat_only: NO
# Only simulate stars? # Only simulate stars?
star_only: YES star_only: NO
# Only simulate galaxies? # Only simulate galaxies?
galaxy_only: NO galaxy_only: NO
...@@ -101,19 +100,6 @@ SED_templates_path: ...@@ -101,19 +100,6 @@ SED_templates_path:
star_SED: "Catalog_20210126/SpecLib.hdf5" star_SED: "Catalog_20210126/SpecLib.hdf5"
galaxy_SED: "Templates/Galaxy/" galaxy_SED: "Templates/Galaxy/"
# TODO: should the following path settings be made hidden from user?
# Efficiency_curve_path:
# filter_eff: "Filters/"
# ccd_eff: "Filter_CCD_Mirror/ccd/"
# mirror_eff: "Filter_CCD_Mirror/mirror_ccdnote.txt"
# CR_data_path: "CRdata/"
# sky_data_path: "skybackground/sky_emiss_hubble_50_50_A.dat"
# SLS_path:
# SLS_conf: "CONF"
# SLS_norm: "normalize_filter"
############################################### ###############################################
# PSF setting # PSF setting
...@@ -132,7 +118,6 @@ psf_setting: ...@@ -132,7 +118,6 @@ psf_setting:
# path to PSF data # path to PSF data
# NOTE: only valid for "Interp" PSF # NOTE: only valid for "Interp" PSF
# psf_dir: "csstPSFdata/CSSOS_psf_20210108/CSST_psf_ciomp_2p5um_cycle3_ccr90"
psf_dir: "/data/simudata/CSSOSDataProductsSims/data/csstPSFdata/psfCube" psf_dir: "/data/simudata/CSSOSDataProductsSims/data/csstPSFdata/psfCube"
# path to field-distortion model # path to field-distortion model
......
...@@ -94,21 +94,7 @@ SED_templates_path: ...@@ -94,21 +94,7 @@ SED_templates_path:
star_SED: "SED_MMW_Gaia_Cluster_D20_SS.hdf5" star_SED: "SED_MMW_Gaia_Cluster_D20_SS.hdf5"
galaxy_SED: null galaxy_SED: null
# TODO: should the following path settings be made hidden from user? ################################################
Efficiency_curve_path:
filter_eff: "Filters/"
ccd_eff: "Filter_CCD_Mirror/ccd/"
mirror_eff: "Filter_CCD_Mirror/mirror_ccdnote.txt"
CR_data_path: "CRdata/"
sky_data_path: "skybackground/sky_emiss_hubble_50_50_A.dat"
SLS_path:
SLS_conf: "CONF"
SLS_norm: "normalize_filter"
###############################################
# PSF setting # PSF setting
############################################### ###############################################
psf_setting: psf_setting:
...@@ -125,11 +111,11 @@ psf_setting: ...@@ -125,11 +111,11 @@ psf_setting:
# path to PSF data # path to PSF data
# NOTE: only valid for "Interp" PSF # NOTE: only valid for "Interp" PSF
psf_dir: "csstPSFdata/CSSOS_psf_20210108/CSST_psf_ciomp_2p5um_cycle3_ccr90" psf_dir: "/data/simudata/CSSOSDataProductsSims/data/csstPSFdata/psfCube"
# path to field-distortion model # path to field-distortion model
# Note: only valid when ins_effects: field_dist is "ON" # Note: only valid when ins_effects: field_dist is "ON"
fd_path: "FieldDistModelv2.0.pickle" fd_path: "FieldDistModelGlobal_v1.0.pickle"
# sigma_spin: 0.0 # psf spin? # sigma_spin: 0.0 # psf spin?
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
date date
python /public/home/fangyuedong/20211203/CSST/run_example.py config_example.yaml -c /public/home/fangyuedong/20211203/CSST/config python /public/home/fangyuedong/temp/CSST/run_example.py config_example.yaml -c /public/home/fangyuedong/temp/CSST/config
...@@ -16,4 +16,4 @@ NP=40 ...@@ -16,4 +16,4 @@ NP=40
date date
echo $NP echo $NP
mpirun -np $NP python /public/home/fangyuedong/20211203/CSST/run_sim.py config_example.yaml -c /public/home/fangyuedong/20211203/CSST/config mpirun -np $NP python /public/home/fangyuedong/temp/CSST/run_sim.py config_example.yaml -c /public/home/fangyuedong/temp/CSST/config
...@@ -16,4 +16,4 @@ NP=80 ...@@ -16,4 +16,4 @@ NP=80
date date
echo $NP echo $NP
mpirun -np $NP python /public/home/fangyuedong/current_csst/CSST/run_sim.py config_C3.yaml -c /public/home/fangyuedong/current_csst/CSST/config mpirun -np $NP python /public/home/fangyuedong/temp/CSST/run_sim.py config_C3.yaml -c /public/home/fangyuedong/temp/CSST/config
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