Commit f5ae2578 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

add radec_offsets (due to aberration compensation by FGS) to wcs projection

parent 5bfe6760
Pipeline #6221 passed with stage
in 0 seconds
......@@ -92,16 +92,21 @@ class Observation(object):
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
else:
ra_cen = pointing.ra
dec_cen = pointing.dec
ra_offset, dec_offset = 0., 0.
# Prepare necessary chip properties for simulation
chip = self.prepare_chip_for_exposure(chip, ra_cen, dec_cen, pointing)
# Initialize SimSteps
sim_steps = SimSteps(overall_config=self.config,
chip_output=chip_output, all_filters=self.all_filters)
chip_output=chip_output,
all_filters=self.all_filters,
ra_offset=ra_offset,
dec_offset=dec_offset)
for step in pointing.obs_param["call_sequence"]:
if self.config["run_option"]["out_cat_only"]:
......
......@@ -59,13 +59,13 @@ class MockObject(object):
flux = self.getFluxFilter(filt)
return flux * tel.pupil_area * exptime
def getPosWorld(self):
ra = self.param["ra"]
dec = self.param["dec"]
def getPosWorld(self, ra_offset=0., dec_offset=0.):
ra = self.param["ra"] + ra_offset
dec = self.param["dec"] + dec_offset
return galsim.CelestialCoord(ra=ra * galsim.degrees, dec=dec * galsim.degrees)
def getPosImg_Offset_WCS(self, img, fdmodel=None, chip=None, verbose=True, chip_wcs=None, img_header=None):
self.posImg = img.wcs.toImage(self.getPosWorld())
def getPosImg_Offset_WCS(self, img, fdmodel=None, chip=None, verbose=True, chip_wcs=None, img_header=None, ra_offset=0., dec_offset=0.):
self.posImg = img.wcs.toImage(self.getPosWorld(ra_offset, dec_offset))
self.localWCS = img.wcs.local(self.posImg)
# Apply field distortion model
if (fdmodel is not None) and (chip is not None):
......
import os
class SimSteps:
def __init__(self, overall_config, chip_output, all_filters):
def __init__(self, overall_config, chip_output, all_filters, ra_offset=0., dec_offset=0.):
self.overall_config = overall_config
self.chip_output = chip_output
self.all_filters = all_filters
self.ra_offset = ra_offset
self.dec_offset = dec_offset
from .prepare_headers import prepare_headers, updateHeaderInfo
from .add_sky_background import add_sky_background_sci, add_sky_flat_calibration, add_sky_background
......@@ -15,6 +18,7 @@ class SimSteps:
from .readout_output import add_prescan_overscan, add_readout_noise, apply_gain, quantization_and_output
from .add_LED_flat import add_LED_Flat
SIM_STEP_TYPES = {
"scie_obs": "add_objects",
"sky_background": "add_sky_background",
......@@ -31,6 +35,6 @@ SIM_STEP_TYPES = {
"readout_noise": "add_readout_noise",
"gain": "apply_gain",
"quantization_and_output": "quantization_and_output",
"led_calib_model":"add_LED_Flat",
"sky_flatField":"add_sky_flat_calibration",
}
\ No newline at end of file
"led_calib_model": "add_LED_Flat",
"sky_flatField": "add_sky_flat_calibration",
}
......@@ -145,7 +145,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
# Get position of object on the focal plane
pos_img, _, _, _, fd_shear = obj.getPosImg_Offset_WCS(
img=chip.img, fdmodel=fd_model, chip=chip, verbose=False, chip_wcs=chip_wcs, img_header=self.h_ext)
img=chip.img, fdmodel=fd_model, chip=chip, verbose=False, chip_wcs=chip_wcs, img_header=self.h_ext, ra_offset=self.ra_offset, dec_offset=self.dec_offset)
# [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
......
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