Commit d0c206b0 authored by JX's avatar JX 😵
Browse files

Merge remote-tracking branch 'origin/develop'

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