Chip.py 52.1 KB
Newer Older
1001
                # Add Read-out Noise
Fang Yuedong's avatar
Fang Yuedong committed
1002
                if config["ins_effects"]["add_readout"] == True:
Fang Yuedong's avatar
Fang Yuedong committed
1003
1004
                    seed = int(config["random_seeds"]["seed_readout"]
                               ) + pointing_ID*30 + self.chipID + 2
1005
                    rng_readout = galsim.BaseDeviate(seed)
Fang Yuedong's avatar
Fang Yuedong committed
1006
1007
                    readout_noise = galsim.GaussianNoise(
                        rng=rng_readout, sigma=self.read_noise)
1008
                    DarkCombImg.addNoise(readout_noise)
Fang Yuedong's avatar
Fang Yuedong committed
1009

1010
                DarkCombImg, self.gain_channel = effects.ApplyGainNonUniform16(
Fang Yuedong's avatar
Fang Yuedong committed
1011
1012
                    DarkCombImg, gain=self.gain,
                    nsecy=self.nsecy, nsecx=self.nsecx,
1013
1014
                    seed=SeedGainNonuni+self.chipID,
                    logger=self.logger)
Fang Yuedong's avatar
Fang Yuedong committed
1015
                # DarkCombImg = effects.AddOverscan(
Fang Yuedong's avatar
Fang Yuedong committed
1016
1017
                #     DarkCombImg,
                #     overscan=overscan, gain=self.gain,
Fang Yuedong's avatar
Fang Yuedong committed
1018
1019
1020
1021
                #     widthl=27, widthr=27, widtht=8, widthb=8)
                DarkCombImg.replaceNegative(replace_value=0)
                DarkCombImg.quantize()
                DarkCombImg = galsim.ImageUS(DarkCombImg)
1022
                timestamp_obs += 10 * 60
1023
                chip_utils.outputCal(
1024
                    chip=self,
Fang Yuedong's avatar
Fang Yuedong committed
1025
1026
1027
1028
                    img=DarkCombImg,
                    ra_cen=ra_cen,
                    dec_cen=dec_cen,
                    img_rot=img_rot,
Xin Zhang's avatar
Xin Zhang committed
1029
                    im_type='DARK',
Fang Yuedong's avatar
Fang Yuedong committed
1030
1031
                    pointing_ID=pointing_ID,
                    output_dir=chip_output.subdir,
1032
                    exptime=self.dark_exptime,
1033
1034
                    project_cycle=config["project_cycle"],
                    run_counter=config["run_counter"],
Fang Yuedong's avatar
Fang Yuedong committed
1035
                    timestamp=timestamp_obs)
Fang Yuedong's avatar
Fang Yuedong committed
1036
1037
1038
1039
            del DarkCombImg
        # img = galsim.ImageUS(img)

        # # 16 output channel, with each a single image file
Fang Yuedong's avatar
Fang Yuedong committed
1040
        # if config["ins_effects"]["readout16"] == True:
Fang Yuedong's avatar
Fang Yuedong committed
1041
1042
1043
1044
        #     print("  16 Output Channel simulation")
        #     for coli in [0, 1]:
        #         for rowi in range(8):
        #             sub_img = effects.readout16(
Fang Yuedong's avatar
Fang Yuedong committed
1045
1046
1047
        #                 GSImage=img,
        #                 rowi=rowi,
        #                 coli=coli,
Fang Yuedong's avatar
Fang Yuedong committed
1048
1049
1050
1051
1052
        #                 overscan_value=self.overscan)
        #             rowcoltag = str(rowi) + str(coli)
        #             img_name_root = chip_output.img_name.split(".")[0]
        #             sub_img.write("%s/%s_%s.fits" % (chip_output.subdir, img_name_root, rowcoltag))
        #     del sub_img
Zhang Xin's avatar
Zhang Xin committed
1053
        return img
For faster browsing, not all history is shown. View entire blame