Skip to content

Commit

Permalink
Merge pull request #227 from LSSTDESC/issue_201/use_generator_for_gs_…
Browse files Browse the repository at this point in the history
…objects

Issue 201/use generator for gs objects
  • Loading branch information
jchiang87 authored Sep 21, 2019
2 parents a3e4b71 + 79100d0 commit 7be0c2f
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 408 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dist: trusty
compiler: gcc

env:
- OS_TYPE=centos OS_VERSION=7 DOCKER_IMAGE=lsstdesc/stack-sims:w_2019_23-sims_w_2019_23
- OS_TYPE=centos OS_VERSION=7 DOCKER_IMAGE=lsstdesc/stack-sims:w_2019_37-sims_w_2019_37

services:
- docker
Expand Down
3 changes: 0 additions & 3 deletions python/desc/imsim/ImageSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,6 @@ def __call__(self, gs_objects):
if nan_fluxes > 0:
logger.info("%s objects had nan fluxes", nan_fluxes)

# Recover the memory devoted to the GalSimCelestialObject instances.
gs_objects.reset()

add_cosmic_rays(gs_interpreter, IMAGE_SIMULATOR.phot_params)
full_well = int(IMAGE_SIMULATOR.config['ccd']['full_well'])
apply_channel_bleeding(gs_interpreter, full_well)
Expand Down
8 changes: 4 additions & 4 deletions python/desc/imsim/camera_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Class to encapsulate info from lsst.obs.lsst.imsim.ImsimMapper().camera.
"""
import astropy.time
import lsst.afw.geom as afw_geom
import lsst.geom as lsst_geom
from lsst.obs.lsst.imsim import ImsimMapper

__all__ = ['CameraInfo', 'getHourAngle']
Expand Down Expand Up @@ -65,15 +65,15 @@ def mosaic_section(amp_info):
Returns
-------
lsst.afw.geom.Box2I
lsst.geom.Box2I
"""
yseg, xseg = (int(x) for x in amp_info.getName()[-2:])
width = amp_info.getBBox().getWidth()
height = amp_info.getBBox().getHeight()
xmin = xseg*width
ymin = 0 if yseg == 1 else height
return afw_geom.Box2I(afw_geom.Point2I(xmin, ymin),
afw_geom.Extent2I(width, height))
return lsst_geom.Box2I(lsst_geom.Point2I(xmin, ymin),
lsst_geom.Extent2I(width, height))


def getHourAngle(observatory, mjd, ra):
Expand Down
64 changes: 32 additions & 32 deletions python/desc/imsim/camera_readout.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from astropy.io import fits
import astropy.time
import galsim
import lsst.afw.geom as afwGeom
import lsst.geom as lsst_geom
import lsst.afw.image as afwImage
with warnings.catch_warnings():
warnings.simplefilter('ignore')
Expand Down Expand Up @@ -567,7 +567,7 @@ def _noao_section_keyword(bbox, flipx=False, flipy=False):
Parameters
----------
bbox : lsst.afw.geom.Box2I
bbox : lsst.geom.Box2I
Bounding box.
flipx : bool
Flag to indicate that data should be flipped in the x-direction.
Expand Down Expand Up @@ -598,16 +598,16 @@ def set_itl_bboxes(amp):
lsst.afw.table.tableLib.AmpInfoRecord
The updated AmpInfoRecord.
"""
amp.setRawBBox(afwGeom.Box2I(afwGeom.Point2I(0, 0),
afwGeom.Extent2I(544, 2048)))
amp.setRawDataBBox(afwGeom.Box2I(afwGeom.Point2I(3, 0),
afwGeom.Extent2I(509, 2000)))
amp.setRawHorizontalOverscanBBox(afwGeom.Box2I(afwGeom.Point2I(512, 0),
afwGeom.Extent2I(48, 2000)))
amp.setRawVerticalOverscanBBox(afwGeom.Box2I(afwGeom.Point2I(0, 2000),
afwGeom.Extent2I(544, 48)))
amp.setRawPrescanBBox(afwGeom.Box2I(afwGeom.Point2I(0, 0),
afwGeom.Extent2I(3, 2000)))
amp.setRawBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 0),
lsst_geom.Extent2I(544, 2048)))
amp.setRawDataBBox(lsst_geom.Box2I(lsst_geom.Point2I(3, 0),
lsst_geom.Extent2I(509, 2000)))
amp.setRawHorizontalOverscanBBox(lsst_geom.Box2I(lsst_geom.Point2I(512, 0),
lsst_geom.Extent2I(48, 2000)))
amp.setRawVerticalOverscanBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 2000),
lsst_geom.Extent2I(544, 48)))
amp.setRawPrescanBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 0),
lsst_geom.Extent2I(3, 2000)))
return amp


Expand All @@ -626,16 +626,16 @@ def set_e2v_bboxes(amp):
lsst.afw.table.tableLib.AmpInfoRecord
The updated AmpInfoRecord.
"""
amp.setRawBBox(afwGeom.Box2I(afwGeom.Point2I(0, 0),
afwGeom.Extent2I(542, 2022)))
amp.setRawDataBBox(afwGeom.Box2I(afwGeom.Point2I(10, 0),
afwGeom.Extent2I(522, 2002)))
amp.setRawHorizontalOverscanBBox(afwGeom.Box2I(afwGeom.Point2I(522, 0),
afwGeom.Extent2I(20, 2002)))
amp.setRawVerticalOverscanBBox(afwGeom.Box2I(afwGeom.Point2I(0, 2002),
afwGeom.Extent2I(542, 20)))
amp.setRawPrescanBBox(afwGeom.Box2I(afwGeom.Point2I(0, 0),
afwGeom.Extent2I(10, 2002)))
amp.setRawBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 0),
lsst_geom.Extent2I(542, 2022)))
amp.setRawDataBBox(lsst_geom.Box2I(lsst_geom.Point2I(10, 0),
lsst_geom.Extent2I(522, 2002)))
amp.setRawHorizontalOverscanBBox(lsst_geom.Box2I(lsst_geom.Point2I(522, 0),
lsst_geom.Extent2I(20, 2002)))
amp.setRawVerticalOverscanBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 2002),
lsst_geom.Extent2I(542, 20)))
amp.setRawPrescanBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 0),
lsst_geom.Extent2I(10, 2002)))
return amp


Expand All @@ -654,16 +654,16 @@ def set_phosim_bboxes(amp):
lsst.afw.table.tableLib.AmpInfoRecord
The updated AmpInfoRecord.
"""
amp.setRawBBox(afwGeom.Box2I(afwGeom.Point2I(0, 0),
afwGeom.Extent2I(519, 2001)))
amp.setRawDataBBox(afwGeom.Box2I(afwGeom.Point2I(4, 1),
afwGeom.Extent2I(509, 2000)))
amp.setRawHorizontalOverscanBBox(afwGeom.Box2I(afwGeom.Point2I(513, 1),
afwGeom.Extent2I(6, 2000)))
amp.setRawVerticalOverscanBBox(afwGeom.Box2I(afwGeom.Point2I(0, 2001),
afwGeom.Extent2I(519, 0)))
amp.setRawPrescanBBox(afwGeom.Box2I(afwGeom.Point2I(0, 1),
afwGeom.Extent2I(4, 2000)))
amp.setRawBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 0),
lsst_geom.Extent2I(519, 2001)))
amp.setRawDataBBox(lsst_geom.Box2I(lsst_geom.Point2I(4, 1),
lsst_geom.Extent2I(509, 2000)))
amp.setRawHorizontalOverscanBBox(lsst_geom.Box2I(lsst_geom.Point2I(513, 1),
lsst_geom.Extent2I(6, 2000)))
amp.setRawVerticalOverscanBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 2001),
lsst_geom.Extent2I(519, 0)))
amp.setRawPrescanBBox(lsst_geom.Box2I(lsst_geom.Point2I(0, 1),
lsst_geom.Extent2I(4, 2000)))
return amp

PixelParameters = namedtuple('PixelParameters',
Expand Down
Loading

0 comments on commit 7be0c2f

Please sign in to comment.