Commit 8649bb95 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

"updated to using the new field distortion model"

parent bd7943ce
......@@ -189,16 +189,21 @@ class Catalog(CatalogBase):
param['ra_orig'] = gals['ra'][igals]
param['dec_orig'] = gals['dec'][igals]
param['mag_use_normal'] = gals['mag_csst_%s'%(self.filt.filter_type)][igals]
# param['mag_use_normal'] = 20.
if self.filt.is_too_dim(mag=param['mag_use_normal'], margin=self.config["obs_setting"]["mag_lim_margin"]):
continue
param['z'] = gals['redshift'][igals]
param['model_tag'] = 'None'
param['g1'] = gals['shear'][igals][0]
param['g2'] = gals['shear'][igals][1]
# param['g1'] = gals['shear'][igals][0]
# param['g2'] = gals['shear'][igals][1]
param['g1'] = 0.
param['g2'] = 0.
param['kappa'] = gals['kappa'][igals]
param['e1'] = gals['ellipticity_true'][igals][0]
param['e2'] = gals['ellipticity_true'][igals][1]
# param['e1'] = gals['ellipticity_true'][igals][0]
# param['e2'] = gals['ellipticity_true'][igals][1]
param['e1'] = 0.
param['e2'] = 0.
# For shape calculation
......
......@@ -75,7 +75,8 @@ class Chip(FocalPlane):
self.fdModel = None
else:
try:
with pkg_resources.files('ObservationSim.Instrument.data.field_distortion').joinpath("FieldDistModelGlobal_mainFP_v1.0.pickle") as field_distortion:
# with pkg_resources.files('ObservationSim.Instrument.data.field_distortion').joinpath("FieldDistModelGlobal_mainFP_v1.0.pickle") as field_distortion:
with pkg_resources.files('ObservationSim.Instrument.data.field_distortion').joinpath("FieldDistModel_v2.0.pickle") as field_distortion:
with open(field_distortion, "rb") as f:
self.fdModel = pickle.load(f)
except AttributeError:
......
......@@ -153,8 +153,6 @@ class MockObject(object):
self.real_pos = self.getRealPos(chip.img, global_x=self.posImg.x, global_y=self.posImg.y,
img_real_wcs=self.real_wcs)
print(self.real_pos.x, self.real_pos.y)
x, y = self.real_pos.x + 0.5, self.real_pos.y + 0.5
x_nominal = int(np.floor(x + 0.5))
y_nominal = int(np.floor(y + 0.5))
......
......@@ -248,8 +248,6 @@ class Observation(object):
# Get position of object on the focal plane
pos_img, offset, local_wcs, real_wcs, fd_shear = obj.getPosImg_Offset_WCS(img=chip.img, fdmodel=self.fd_model, chip=chip, verbose=False, chip_wcs=chip_wcs, img_header=h_ext)
print(pos_img.x, pos_img.y)
# [TODO] For now, only consider objects which their centers (after field distortion) are projected within the focal plane
# Otherwise they will be considered missed objects
......
......@@ -107,7 +107,7 @@ class FieldDistortion(object):
# g1k_fd = g_abs * np.cos(phi - 2*img_rot)
# g2k_fd = -g_abs * np.sin(phi - 2*img_rot)
# g1k_fd = g_abs * np.cos(0. - 2*img_rot)
# g2k_fd = -g_abs * np.sin(0. - 2*img_rot)
# g2k_fd = g_abs * np.sin(0. - 2*img_rot)
fd_shear = galsim.Shear(g1=g1k_fd, g2=g2k_fd)
return galsim.PositionD(x, y), fd_shear
......
......@@ -341,8 +341,6 @@ class PSFInterp(PSFModel):
if findNeighMode == 'hoclistFind':
assert(self.hoc != 0), 'hoclist should be built correctly!'
imPSF = psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=True, hoc=self.hoc[twave], hoclist=self.hoclist[twave], PSFCentroidWgt=True)
imPSf = np.transpose(imPSF)
############TEST: START
TestGaussian = False
......
......@@ -11,7 +11,7 @@
* 导星探测器仿真
* 仪器参数更新,bug修复等
* 2022.08.23: 更新至最新的透过率曲线,在图像头文件中加入版本号。仿真软件版本号进行重新标记,当前版本为1.0.4
* 2022.06.20: 版本v0.5上线,请于release_v0.5 branch中进行clone操作(注:目前已重新设置为v1.0,release_v1.0.0)
* 2022.06.20: 版本v0.5上线,release_v0.5 branch(注:目前已重新设置为v1.0,release_v1.0.0)
* 2022.04.13: 修复了天测模块中的调用错误
* 2022.04.08: 修复了仅输出星表选项("out_cat_only")存在的问题
......
......@@ -9,13 +9,13 @@
# 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: "/share/home/fangyuedong/sim_v2/csst-simulation/workplace/"
work_dir: "/share/home/fangyuedong/csst-simulation/workplace/"
data_dir: "/share/simudata/CSSOSDataProductsSims/data/"
run_name: "wcs_test"
run_name: "wcs_test_fd_shear"
# Whether to use MPI
run_option:
use_mpi: NO
use_mpi: YES
# NOTE: "n_threads" paramters is currently not used in the backend
# simulation codes. It should be implemented later in the web frontend
# in order to config the number of threads to request from NAOC cluster
......@@ -44,10 +44,10 @@ catalog_options:
AGN_SED_WAVE: "wave_ross13.npy"
# Only simulate stars?
star_only: YES
star_only: NO
# Only simulate galaxies?
galaxy_only: NO
galaxy_only: YES
# rotate galaxy ellipticity
rotateEll: 0. # [degree]
......@@ -64,7 +64,7 @@ obs_setting:
# "Spectroscopic": simulate slitless spectroscopic chips only
# "FGS": simulate FGS chips only (31-42)
# "All": simulate full focal plane
survey_type: "Photometric"
survey_type: "All"
# Exposure time [seconds]
exp_time: 150.
......@@ -100,7 +100,7 @@ obs_setting:
# - give a list of indexes of chips: [ip_1, ip_2...]
# - run all chips: null
# Note: for all pointings
run_chips: [9]
run_chips: null
# Whether to enable astrometric modeling
enable_astrometric_model: True
......@@ -159,11 +159,11 @@ ins_effects:
# switches
# Note: bias_16channel, gain_16channel, and shutter_effect
# is currently not applicable to "FGS" observations
field_dist: OFF # Whether to add field distortions
add_back: OFF # Whether to add sky background
add_dark: OFF # Whether to add dark noise
add_readout: OFF # Whether to add read-out (Gaussian) noise
add_bias: OFF # Whether to add bias-level to images
field_dist: YES # Whether to add field distortions
add_back: YES # Whether to add sky background
add_dark: YES # Whether to add dark noise
add_readout: YES # Whether to add read-out (Gaussian) noise
add_bias: YES # Whether to add bias-level to images
bias_16channel: OFF # Whether to add different biases for 16 channels
gain_16channel: OFF # Whether to make different gains for 16 channels
shutter_effect: OFF # Whether to add shutter effect
......
......@@ -2,10 +2,10 @@
date
python -m cProfile -o C6_profiler_test.pstats /share/home/fangyuedong/sim_v2/csst-simulation/run_sim.py \
python -m cProfile -o C6_profiler_test.pstats /share/home/fangyuedong/csst-simulation/run_sim.py \
--config_file config_C6_test_wcs.yaml \
--catalog wcs_test_C6 \
-c /share/home/fangyuedong/sim_v2/csst-simulation/config
-c /share/home/fangyuedong/csst-simulation/config
# --config_file test_fd_C6.yaml \
# --catalog fd_test_C6 \
# --config_file config_C6.yaml \
......
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