Commit 615e951f authored by Fang Yuedong's avatar Fang Yuedong
Browse files

bug fix for guidance abberation correction

parent 92db78dd
......@@ -23,7 +23,7 @@ class Observation(object):
self.filter_param = FilterParam()
self.Catalog = Catalog
def prepare_chip_for_exposure(self, chip, ra_cen, dec_cen, pointing, wcs_fp=None, slsPSFOptim = False):
def prepare_chip_for_exposure(self, chip, ra_cen, dec_cen, pointing, wcs_fp=None, slsPSFOptim=False):
# Get WCS for the focal plane
if wcs_fp == None:
wcs_fp = self.focal_plane.getTanWCS(
......@@ -35,19 +35,20 @@ class Observation(object):
chip.img.wcs = wcs_fp
chip.slsPSFOptim = slsPSFOptim
if chip.chipID in [1,2,3,4,5,10,21,26,27,28,29,30] and slsPSFOptim:
if chip.chipID in [1, 2, 3, 4, 5, 10, 21, 26, 27, 28, 29, 30] and slsPSFOptim:
chip.img_stack = {}
for id1 in np.arange(2):
gn = chip_utils.getChipSLSGratingID(chip.chipID)[id1]
orders = {}
# for id2 in ['-2','-1','0','1','2']:
for id2 in ['0','1']:
for id2 in ['0', '1']:
o_n = "order"+id2
allbands = {}
for id3 in ['1','2','3','4']:
for id3 in ['1', '2', '3', '4']:
w_n = "w"+id3
allbands[w_n] = galsim.ImageF(chip.npix_x, chip.npix_y)
allbands[w_n].setOrigin(chip.bound.xmin, chip.bound.ymin)
allbands[w_n].setOrigin(
chip.bound.xmin, chip.bound.ymin)
allbands[w_n].wcs = wcs_fp
orders[o_n] = allbands
chip.img_stack[gn] = orders
......@@ -111,16 +112,17 @@ class Observation(object):
input_date_str=date_str,
input_time_str=time_str
)
ra_cen, dec_cen = ra_cen[0], dec_cen[0]
ra_offset, dec_offset = pointing.ra - ra_cen, pointing.dec - dec_cen
ra_offset, dec_offset = pointing.ra - \
ra_cen[0], pointing.dec - dec_cen[0]
else:
ra_offset, dec_offset = 0., 0.
ra_cen = pointing.ra
dec_cen = pointing.dec
ra_offset, dec_offset = 0., 0.
slsPSFOpt = False
# Prepare necessary chip properties for simulation
chip = self.prepare_chip_for_exposure(chip, ra_cen, dec_cen, pointing, slsPSFOptim = slsPSFOpt)
chip = self.prepare_chip_for_exposure(
chip, ra_cen, dec_cen, pointing, slsPSFOptim=slsPSFOpt)
# Initialize SimSteps
sim_steps = SimSteps(overall_config=self.config,
......
......@@ -78,12 +78,12 @@ class ChipOutput(object):
self.hdr += "\n"
self.cat.write(self.hdr)
def cat_add_obj(self, obj, pos_img, pos_shear):
def cat_add_obj(self, obj, pos_img, pos_shear, ra_offset=0., dec_offset=0.):
ximg = obj.real_pos.x + 1.0
yimg = obj.real_pos.y + 1.0
line = self.fmt % (
obj.id, int(self.chip_label), self.filt.filter_type, ximg, yimg, obj.ra, obj.dec, obj.ra_orig, obj.dec_orig, obj.z, obj.getMagFilter(
obj.id, int(self.chip_label), self.filt.filter_type, ximg, yimg, obj.ra + ra_offset, obj.dec + dec_offset, obj.ra_orig, obj.dec_orig, obj.z, obj.getMagFilter(
self.filt), obj.type,
obj.pmra, obj.pmdec, obj.rv, obj.parallax)
line += obj.additional_output_str
......
......@@ -194,7 +194,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
if isUpdated == 1:
# TODO: add up stats
self.chip_output.cat_add_obj(obj, pos_img, pos_shear)
self.chip_output.cat_add_obj(
obj, pos_img, pos_shear, ra_offset=self.ra_offset, dec_offset=self.dec_offset)
pass
elif isUpdated == 0:
missed_obj += 1
......
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