From cb2b2f3b4c0d72525c501e4cc5dbb8cd53747a77 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Sat, 23 Aug 2025 08:52:44 +0800 Subject: [PATCH 1/8] sls grating config GU02 and GU04 bug: jump point exist in dist between 0th and direct Img --- observation_sim/instruments/data/sls_conf/CSST_GU2.conf | 6 +++--- observation_sim/instruments/data/sls_conf/CSST_GU4.conf | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/observation_sim/instruments/data/sls_conf/CSST_GU2.conf b/observation_sim/instruments/data/sls_conf/CSST_GU2.conf index 8be12ce..50e8e77 100644 --- a/observation_sim/instruments/data/sls_conf/CSST_GU2.conf +++ b/observation_sim/instruments/data/sls_conf/CSST_GU2.conf @@ -36,7 +36,7 @@ MMAG_MARK_B 30 # Trace description # DYDX_ORDER_B 0 -DYDX_B_0 82.91782550095616 -0.017450074030956903 -0.00034211980919903514 -5.229479577962483e-10 6.618188334096981e-10 4.5712407536340074e-11 +DYDX_B_0 82.91742083784611 -0.0174512487471819 -0.00034120894910458606 -1.298330068637783e-10 4.340249496308753e-10 1.0373044457577981e-11 # # X and Y Offsets # @@ -46,8 +46,8 @@ YOFF_B 0.0 # Dispersion solution # DISP_ORDER_B 1 -DLDP_B_0 7763276.642055119 -20266.736198394356 1255.309384604854 5.066171367500259 1.2647000472616756 -0.25632575767112603 -DLDP_B_1 -143465.8971715863 684.9306681233783 -157.3534822656011 -0.2303808137854618 0.03539958163679847 0.005924035996712881 +DLDP_B_0 448897.8581289202 -69.05924554341267 -200.37444114671905 0.04003968509481386 -0.027512617424472103 5.068370683947331e-05 +DLDP_B_1 10160.6234805349 4.430359702933667 0.09374704569926708 -0.000854410958383644 -2.8642365418529523e-05 -2.659603621537505e-06 # SENSITIVITY_B GU2.Throughput.0st.fits # diff --git a/observation_sim/instruments/data/sls_conf/CSST_GU4.conf b/observation_sim/instruments/data/sls_conf/CSST_GU4.conf index ee60aba..acafccb 100644 --- a/observation_sim/instruments/data/sls_conf/CSST_GU4.conf +++ b/observation_sim/instruments/data/sls_conf/CSST_GU4.conf @@ -36,7 +36,7 @@ MMAG_MARK_B 30 # Trace description # DYDX_ORDER_B 0 -DYDX_B_0 80.91986075321823 -0.01744761042150647 -0.0003580191107231064 -2.627009138987314e-10 -6.375179298238856e-10 2.763897714355112e-09 +DYDX_B_0 80.93796454255751 -0.017461724678154614 -0.00035745607061872265 1.586088715327381e-09 2.83632657494108e-10 2.4337528594084163e-09 # # X and Y Offsets # @@ -46,8 +46,8 @@ YOFF_B 0.0 # Dispersion solution # DISP_ORDER_B 1 -DLDP_B_0 52318605.038736925 -49905.61041920374 -325.3071290800653 11.683982888283492 -0.734011022951611 0.0798352458204433 -DLDP_B_1 -1489154.0375472226 1428.4941310271706 32.346965719777806 -0.3034273708620226 -0.01153922199462758 -0.0009324181582693394 +DLDP_B_0 560974.2568255321 4.836837898676734 -270.2027083117478 0.00017749467347293046 -3.42705736301515e-05 -2.4253188230594427e-06 +DLDP_B_1 15499.999999924863 8.661894315733124e-11 5.382306809541636e-12 -1.7061292984259495e-14 -6.679353210055169e-15 1.0401633823282333e-15 # SENSITIVITY_B GU4.Throughput.0st.fits # -- GitLab From 34673941ae42f759b7122e99bf7c643572ab6540 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Thu, 28 Aug 2025 15:17:39 +0800 Subject: [PATCH 2/8] tools get_pointing_accuracy.py def getChipCenterRaDec(chipID=1, p_ra=60., p_dec=-40., pa=23.5): --- tools/get_pointing_accuracy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/get_pointing_accuracy.py b/tools/get_pointing_accuracy.py index 7c53134..99aff91 100644 --- a/tools/get_pointing_accuracy.py +++ b/tools/get_pointing_accuracy.py @@ -130,7 +130,7 @@ def cal_FoVcenter_1P_ecliptic(lon_ecl_FieldCenter, lat_ecl_FieldCenter, chipID=1 return ra_PointCenter, dec_PointCenter, lon_ecl_PointCenter, lat_ecl_PointCenter -def getChipCenterRaDec(chipID=1, p_ra=60., p_dec=-40.): +def getChipCenterRaDec(chipID=1, p_ra=60., p_dec=-40., pa=23.5): chip = Chip(chipID) h_ext = ImageHeader.generateExtensionHeader( -- GitLab From fff63abdd33d6d68e1ad3ea56432c967de0f74d4 Mon Sep 17 00:00:00 2001 From: Chengliang Date: Fri, 10 Oct 2025 14:29:58 +0800 Subject: [PATCH 3/8] tools imgCropping.py --- tools/imgCropping.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tools/imgCropping.py diff --git a/tools/imgCropping.py b/tools/imgCropping.py new file mode 100644 index 0000000..033e101 --- /dev/null +++ b/tools/imgCropping.py @@ -0,0 +1,35 @@ +import os,sys +import numpy as np +from astropy.io import fits + +PRESCAN_X, IMAGE_X, OVERSCAN_X = 27, 1152, 71 +PRESCAN_Y, IMAGE_Y, OVERSCAN_Y = 0, 4616, 84 +BLOCK_WIDTH = PRESCAN_X + IMAGE_X + OVERSCAN_X + +def process_single_file(filename): + with fits.open(filename) as hdul: + data = hdul[1].data + + data = data[PRESCAN_Y : PRESCAN_Y + IMAGE_Y, :] + blocks = [data[:, i * BLOCK_WIDTH + PRESCAN_X : (i + 1) * BLOCK_WIDTH - OVERSCAN_X] for i in range(16)] + + blocks_a = np.concatenate(blocks[:4], axis=1) + blocks_b = np.concatenate([np.fliplr(b) for b in blocks[4:8]], axis=1) + blocks_c = np.concatenate([np.flipud(np.fliplr(b)) for b in blocks[11:7:-1]], axis=1) + blocks_d = np.concatenate([np.flipud(b) for b in blocks[15:11:-1]], axis=1) + + blocks_dc = np.concatenate([blocks_d, blocks_c], axis=1) + blocks_ab = np.concatenate([blocks_a, blocks_b], axis=1) + blocks_final = np.concatenate([blocks_ab, blocks_dc], axis=0) + + output_path = os.path.splitext(fn)[0]+'_cropping.fits' + fits.writeto(output_path, blocks_final, overwrite=True) + print(f"OK:{output_path}") + +if __name__ == "__main__": + if len(sys.argv) > 1: + fn = sys.argv[1] + else: + fn = 'CSST_MSC_MS_WIDE_20281024132057_20281024132327_10100484833_08_L0_V01.fits' + + process_single_file(fn) -- GitLab From a987f34e864e7d62c77b9f22141bf226e63b4d59 Mon Sep 17 00:00:00 2001 From: Chengliang Date: Fri, 10 Oct 2025 14:37:57 +0800 Subject: [PATCH 4/8] correct galaxy size --- catalog/C10_Catalog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catalog/C10_Catalog.py b/catalog/C10_Catalog.py index 3168b17..feae143 100644 --- a/catalog/C10_Catalog.py +++ b/catalog/C10_Catalog.py @@ -311,7 +311,8 @@ class Catalog(CatalogBase): param['bulgemass'] = gals['bulgemass'][igals] param['diskmass'] = gals['diskmass'][igals] - param['size'] = gals['size'][igals] + np.random.seed(int(pix_id)+cat_id+igals) + param['size'] = (gals['size'][igals] *((1.+gals['redshift'][igals])**(0.4))) *np.random.uniform(0.7, 1.3) if param['size'] > self.max_size: self.max_size = param['size'] -- GitLab From 7dadcef47af3e15f7a654944c7407905f48718a4 Mon Sep 17 00:00:00 2001 From: Chengliang Date: Fri, 10 Oct 2025 14:42:16 +0800 Subject: [PATCH 5/8] pep8 coding style --- catalog/C10_Catalog.py | 2 +- tools/imgCropping.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/catalog/C10_Catalog.py b/catalog/C10_Catalog.py index feae143..45f7a0d 100644 --- a/catalog/C10_Catalog.py +++ b/catalog/C10_Catalog.py @@ -312,7 +312,7 @@ class Catalog(CatalogBase): param['diskmass'] = gals['diskmass'][igals] np.random.seed(int(pix_id)+cat_id+igals) - param['size'] = (gals['size'][igals] *((1.+gals['redshift'][igals])**(0.4))) *np.random.uniform(0.7, 1.3) + param['size'] = (gals['size'][igals] * ((1.+gals['redshift'][igals])**(0.4))) * np.random.uniform(0.7, 1.3) if param['size'] > self.max_size: self.max_size = param['size'] diff --git a/tools/imgCropping.py b/tools/imgCropping.py index 033e101..42f4bd7 100644 --- a/tools/imgCropping.py +++ b/tools/imgCropping.py @@ -1,4 +1,5 @@ -import os,sys +import os +import sys import numpy as np from astropy.io import fits @@ -6,12 +7,13 @@ PRESCAN_X, IMAGE_X, OVERSCAN_X = 27, 1152, 71 PRESCAN_Y, IMAGE_Y, OVERSCAN_Y = 0, 4616, 84 BLOCK_WIDTH = PRESCAN_X + IMAGE_X + OVERSCAN_X + def process_single_file(filename): with fits.open(filename) as hdul: data = hdul[1].data - data = data[PRESCAN_Y : PRESCAN_Y + IMAGE_Y, :] - blocks = [data[:, i * BLOCK_WIDTH + PRESCAN_X : (i + 1) * BLOCK_WIDTH - OVERSCAN_X] for i in range(16)] + data = data[PRESCAN_Y:PRESCAN_Y + IMAGE_Y, :] + blocks = [data[:, i * BLOCK_WIDTH + PRESCAN_X:(i + 1) * BLOCK_WIDTH - OVERSCAN_X] for i in range(16)] blocks_a = np.concatenate(blocks[:4], axis=1) blocks_b = np.concatenate([np.fliplr(b) for b in blocks[4:8]], axis=1) @@ -26,6 +28,7 @@ def process_single_file(filename): fits.writeto(output_path, blocks_final, overwrite=True) print(f"OK:{output_path}") + if __name__ == "__main__": if len(sys.argv) > 1: fn = sys.argv[1] -- GitLab From 6d067f21976386c52b49cca92553b9fee0b7274c Mon Sep 17 00:00:00 2001 From: Chengliang Date: Wed, 15 Oct 2025 18:23:50 +0800 Subject: [PATCH 6/8] debug: dark in overscan --- observation_sim/sim_steps/readout_output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/observation_sim/sim_steps/readout_output.py b/observation_sim/sim_steps/readout_output.py index f21461d..db527de 100644 --- a/observation_sim/sim_steps/readout_output.py +++ b/observation_sim/sim_steps/readout_output.py @@ -20,7 +20,7 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param): if obs_param["add_dark"] is True: ny = int(chip.npix_y/2) base_dark = (ny-1)*(chip.readout_time/ny)*chip.dark_noise - chip.img.array[(chip.prescan_y+ny):-(chip.prescan_y+ny), :] = base_dark + chip.img.array[(chip.prescan_y+ny):-(chip.prescan_y+ny), :] += base_dark return chip, filt, tel, pointing -- GitLab From 6285580e4fa062614c4c7f90bb677ed26eef786a Mon Sep 17 00:00:00 2001 From: zhangxin Date: Thu, 16 Oct 2025 09:04:18 +0800 Subject: [PATCH 7/8] header value change with ccd json file:PSCAN1,PSCAN2,OSCAN1,OSCAN2 --- observation_sim/config/ChipOutput.py | 2 +- observation_sim/config/header/ImageHeader.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/observation_sim/config/ChipOutput.py b/observation_sim/config/ChipOutput.py index 5a08d7e..87aa566 100755 --- a/observation_sim/config/ChipOutput.py +++ b/observation_sim/config/ChipOutput.py @@ -73,7 +73,7 @@ class ChipOutput(object): self.hdr += additional_column_names def create_output_file(self): - if self.pointing_type == 'WIDE' or self.pointing_type == 'DEEP': + if self.pointing_type == 'WIDE' or self.pointing_type == 'DEEP' or self.pointing_type == 'CALF' or self.pointing_type == 'CALSP' or self.pointing_type == 'CALSS': self.cat = open(os.path.join(self.subdir, self.cat_name), "w") self.logger.info("Creating catalog file %s ...\n" % (os.path.join(self.subdir, self.cat_name))) diff --git a/observation_sim/config/header/ImageHeader.py b/observation_sim/config/header/ImageHeader.py index 97b46f5..69f34fb 100644 --- a/observation_sim/config/header/ImageHeader.py +++ b/observation_sim/config/header/ImageHeader.py @@ -556,6 +556,10 @@ def generateExtensionHeader(chip, xlen=9216, ylen=9232, ra=60, dec=-40, pa=-23.4 h_ext['GAIN14'] = chip.gain_channel[13] h_ext['GAIN15'] = chip.gain_channel[14] h_ext['GAIN16'] = chip.gain_channel[15] + h_ext['PSCAN1'] = chip.prescan_x + h_ext['PSCAN2'] = chip.prescan_y + h_ext['OSCAN1'] = chip.overscan_x + h_ext['OSCAN2'] = chip.overscan_y h_ext['RON01'] = readout h_ext['RON02'] = readout h_ext['RON03'] = readout -- GitLab From 5f565d9f82a47201375f2677b2266f0f3f683678 Mon Sep 17 00:00:00 2001 From: fangyuedong Date: Tue, 9 Dec 2025 13:00:31 +0800 Subject: [PATCH 8/8] update version to v3.3.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index dc4702c..0d5ef40 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,7 @@ with open("requirements.txt", "r") as f: ] setup(name='csst_msc_sim', - version='3.3.0', + version='3.3.1', packages=find_packages(), # install_requires=[ # # 'numpy>=1.18.5', -- GitLab