diff --git a/catalog/C10_Catalog.py b/catalog/C10_Catalog.py index 3168b1746c98e70213f0eb61fa44d36d1a5d2aa6..45f7a0d05e23f1a4b98dcf4d3b1789efc4b55aed 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'] diff --git a/observation_sim/config/ChipOutput.py b/observation_sim/config/ChipOutput.py index 5a08d7e0250afdfa02d1fa55270f667b941114bb..87aa566de5dfb7cb84cf3a166022e7fe3aded14a 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 97b46f52dc935361294957144f63dfb2d5d53430..69f34fb03dbf224c61bc3048ca84bc2711f60807 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 diff --git a/observation_sim/instruments/data/sls_conf/CSST_GU2.conf b/observation_sim/instruments/data/sls_conf/CSST_GU2.conf index 8be12ce5da3e949bc6a4464c37a275d04ab3cf0c..50e8e774afa9b9c506d080e21631ff1b41edbf36 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 ee60abab23c9c16992e93c4b0e2b43f07e966f3b..acafccb08216a23e132acb6e3e797d73811a21cc 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 # diff --git a/observation_sim/sim_steps/readout_output.py b/observation_sim/sim_steps/readout_output.py index f21461d56abd943505f5746f551ec470ed549525..db527de183037b8bf73f042784003fb326622934 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 diff --git a/setup.py b/setup.py index dc4702c5fed543cc1b9d62904423c54c7c693e90..0d5ef40342fed1550221f73a81127b680006c587 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', diff --git a/tools/get_pointing_accuracy.py b/tools/get_pointing_accuracy.py index 7c531348da0c81aea91c946b76ac12b726511f8c..99aff912ab6371847970e210eec27785678a5a1a 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( diff --git a/tools/imgCropping.py b/tools/imgCropping.py new file mode 100644 index 0000000000000000000000000000000000000000..42f4bd787988920c6235f37137687550520a0d44 --- /dev/null +++ b/tools/imgCropping.py @@ -0,0 +1,38 @@ +import os +import 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)