Commit 7e5ae118 authored by Wei Chengliang's avatar Wei Chengliang
Browse files

grid galaxy for wcs_test

parent f5cf292a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -138,11 +138,11 @@ class Galaxy(MockObject):
        real_wcs_local = self.real_wcs.local(self.real_pos)

        disk = galsim.Sersic(n=self.disk_sersic_idx, half_light_radius=self.hlr_disk, flux=1.0, gsparams=gsp)
        disk_shape = galsim.Shear(g1=self.e1_disk, g2=self.e2_disk)
        disk = disk.shear(disk_shape)
        ###disk_shape = galsim.Shear(g1=self.e1_disk, g2=self.e2_disk)
        ###disk = disk.shear(disk_shape)
        bulge = galsim.Sersic(n=self.bulge_sersic_idx, half_light_radius=self.hlr_bulge, flux=1.0, gsparams=gsp)
        bulge_shape = galsim.Shear(g1=self.e1_bulge, g2=self.e2_bulge)
        bulge = bulge.shear(bulge_shape)
        ###bulge_shape = galsim.Shear(g1=self.e1_bulge, g2=self.e2_bulge)
        ###bulge = bulge.shear(bulge_shape)

        for i in range(len(bandpass_list)):
            bandpass = bandpass_list[i]
+21 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ class Observation(object):
        chip_output.Log_info(filt.sky_background)

        # [TODO] [TEST]
        return
        #return

        if chip.survey_type == "photometric":
            sky_map = None
@@ -195,11 +195,16 @@ class Observation(object):
            
            chip_wcs = galsim.FitsWCS(header=h_ext)

            nnn = 30
            NNObj = nnn*nnn #484 ###
            tt = 0
            for j in range(self.nobj):
                
                # (DEBUG)
                # if j >= 10:
                #     break
                if NNObj == 0:
                    continue

                obj = self.cat.objs[j]

@@ -258,6 +263,20 @@ 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)

                ### set pos_img
                if True:
                    ngal_x = nnn #22 #sampling ngal_x*ngal_y position on current CCD-chip
                    ngal_y = nnn #22
                    xmin = chip.bound.xmin +256
                    ymin = chip.bound.ymin +256
                    jj = NNObj-1 ###np.random.randint(int(ngal_x*ngal_y)) #set position for galaxy-jj
                    iy = int(jj / ngal_x)
                    ix = int(jj - iy*ngal_x)
                    px = xmin + ix*int((chip.npix_x - 512)/ngal_x)
                    py = ymin + iy*int((chip.npix_y - 512)/ngal_y)
                    pos_img.x = px
                    pos_img.y = py

                # [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
                # if pos_img.x == -1 or pos_img.y == -1 or (not chip.isContainObj(x_image=pos_img.x, y_image=pos_img.y, margin=0.)):
@@ -304,6 +323,7 @@ class Observation(object):
                    if isUpdated == 1:
                        # TODO: add up stats
                        chip_output.cat_add_obj(obj, pos_img, pos_shear)
                        NNObj = NNObj-1 ###
                        pass
                    elif isUpdated == 0:
                        missed_obj += 1
+32 −32
Original line number Diff line number Diff line
@@ -9,10 +9,9 @@
# 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/csst-simulation/workplace/"
work_dir: "/share/simudata/CSSOSDataProductsSims/data/CSSTSimImage_C6/"
data_dir: "/share/simudata/CSSOSDataProductsSims/data/"
run_name: "C6_test"
run_name: "C6_test"
run_name: "C6_wcs_test1"

# Whether to use MPI
run_option:
@@ -48,7 +47,7 @@ catalog_options:
  star_only: NO

  # Only simulate galaxies?
  galaxy_only: NO
  galaxy_only: YES

  # rotate galaxy ellipticity
  rotateEll: 0. # [degree]
@@ -95,20 +94,21 @@ obs_setting:
  # - give a list of indexes of pointings: [ip_1, ip_2...]
  # - run all pointings: null
  # Note: only valid when a pointing list is specified
  run_pointings: [0,1,2,3,4]
  run_pointings: [0,1,2,3,4,5,6,7,8,9]
  #run_pointings: [0,1,2,3,4,5]
  
  # Run specific chip(s):
  # - give a list of indexes of chips: [ip_1, ip_2...]
  # - run all chips: null
  # Note: for all pointings
  run_chips: null
  run_chips: null
  run_chips: [8, 23]
  #run_chips: null

  # Whether to enable astrometric modeling
  enable_astrometric_model: True
  enable_astrometric_model: False

  # Whether to enable straylight model
  enable_straylight_model: True
  enable_straylight_model: False

  # Cut by saturation magnitude in which band?
  cut_in_band: "z"
@@ -127,7 +127,7 @@ psf_setting:
  # Which PSF model to use:
  # "Gauss": simple gaussian profile
  # "Interp": Interpolated PSF from sampled ray-tracing data
  psf_model: "Interp"
  psf_model: "Gauss"

  # PSF size [arcseconds]
  # radius of 80% energy encircled
@@ -149,8 +149,8 @@ shear_setting:
  shear_type: "catalog"

  # For constant shear filed
  reduced_g1: 0.
  reduced_g2: 0.
  reduced_g1: -0.02
  reduced_g2: -0.04

###############################################
# Instrumental effects setting
@@ -159,25 +159,25 @@ ins_effects:
  # switches
  # Note: bias_16channel, gain_16channel, and shutter_effect
  # is currently not applicable to "FGS" observations
  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: YES  # Whether to add different biases for 16 channels
  gain_16channel: YES  # Whether to make different gains for 16 channels
  shutter_effect: YES  # Whether to add shutter effect
  flat_fielding:  YES  # Whether to add flat-fielding effect
  prnu_effect:    YES  # Whether to add PRNU effect
  non_linear:     YES  # Whether to add non-linearity
  cosmic_ray:     YES  # Whether to add cosmic-ray
  cray_differ:    YES  # Whether to generate different cosmic ray maps CAL and MS output
  cte_trail:      YES  # Whether to simulate CTE trails
  saturbloom:     YES  # Whether to simulate Saturation & Blooming
  add_badcolumns: YES  # Whether to add bad columns
  add_hotpixels:  YES  # Whether to add hot pixels
  add_deadpixels: YES  # Whether to add dead(dark) pixels
  bright_fatter:  YES  # Whether to simulate Brighter-Fatter (also diffusion) effect
  field_dist:     NO  # Whether to add field distortions
  add_back:       NO  # Whether to add sky background
  add_dark:       NO  # Whether to add dark noise
  add_readout:    NO  # Whether to add read-out (Gaussian) noise
  add_bias:       NO  # Whether to add bias-level to images
  bias_16channel: NO  # Whether to add different biases for 16 channels
  gain_16channel: NO  # Whether to make different gains for 16 channels
  shutter_effect: NO  # Whether to add shutter effect
  flat_fielding:  NO  # Whether to add flat-fielding effect
  prnu_effect:    NO  # Whether to add PRNU effect
  non_linear:     NO  # Whether to add non-linearity
  cosmic_ray:     NO  # Whether to add cosmic-ray
  cray_differ:    NO  # Whether to generate different cosmic ray maps CAL and MS output
  cte_trail:      NO  # Whether to simulate CTE trails
  saturbloom:     NO  # Whether to simulate Saturation & Blooming
  add_badcolumns: NO  # Whether to add bad columns
  add_hotpixels:  NO  # Whether to add hot pixels
  add_deadpixels: NO  # Whether to add dead(dark) pixels
  bright_fatter:  NO  # Whether to simulate Brighter-Fatter (also diffusion) effect

  # Values: 
  # default values have been defined individually for each chip in: