Commit f92ea9e9 authored by yuedong0607's avatar yuedong0607
Browse files

bug fix: chip reset origin for ghosts drawing

parent dc56a253
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -178,15 +178,16 @@ class Ghost:
            "wave_name": wave_name,
        }
        
    def draw(self, image, pos_pix, r_pix, flux=1.0):
    def draw_on_chip(self, chip, pos_pix, r_pix, flux=1.0):
        x_pix, y_pix = pos_pix.x, pos_pix.y
        profile = galsim.TopHat(radius=r_pix, flux=flux)
        chip.img.setOrigin(0, 0)
        profile.drawImage(
            image = image,
            image = chip.img,
            center = galsim.PositionD(x_pix, y_pix),
            add_to_image=True
        )
        return image
        chip.img.setOrigin(chip.bound.xmin, chip.bound.ymin)


if __name__ == "__main__":
+1 −1
Original line number Diff line number Diff line
@@ -80,6 +80,6 @@ def add_ghosts_SCI(self, chip, filt, tel, pointing, catalog, obs_param):
                                       img_real_wcs=obj.chip_wcs)
            # print(f"star at {obj.getRealPos(chip.img, global_x=pos_img.x, global_y=pos_img.y, img_real_wcs=obj.chip_wcs)}")
            # print("ghost info: ", ghost_pos.x, ghost_pos.y, r_pix, ratio * nphotons_tot)
            chip.img = ghost_model.draw(chip.img, ghost_pos, r_pix, flux=ratio * nphotons_tot)
            ghost_model.draw_on_chip(chip, ghost_pos, r_pix, flux=ratio * nphotons_tot)
            
    return chip, filt, tel, pointing
 No newline at end of file