Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-10452: Move bboxFromIraf to obs_base utils.py #3

Merged
merged 1 commit into from
May 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 2 additions & 16 deletions python/lsst/obs/ctio0m9/ctio0m9Mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
import lsst.afw.image.utils as afwImageUtils
import lsst.afw.geom as afwGeom
import lsst.afw.cameraGeom as cameraGeom
from lsst.obs.base import CameraMapper, MakeRawVisitInfo
from lsst.obs.base import CameraMapper, MakeRawVisitInfo, bboxFromIraf
import lsst.pex.policy as pexPolicy

from lsst.obs.ctio0m9 import Ctio0m9

class Ctio0m9MakeRawVisitInfo(MakeRawVisitInfo):
Expand All @@ -50,19 +49,6 @@ def getDateAvg(self, md, exposureTime):
dateObs = self.popIsoDate(md, "DATE-OBS")
return self.offsetDate(dateObs, 0.5*exposureTime)

def bboxFromIraf(irafBBoxStr):
"""Split an IRAF-style BBOX (used e.g. for DETSEC), returning a Box2I

[x0:x1,y0:y1] where x0 and x1 are the one-indexed start and end columns, and correspondingly
y0 and y1 are the start and end rows.
"""

mat = re.search(r"^\[([-\d]+):([-\d]+),([-\d]+):([-\d]+)\]$", irafBBoxStr)
if not mat:
raise RuntimeError("Unable to parse IRAF-style bbox \"%s\"" % irafBBoxStr)
x0, x1, y0, y1 = [int(_) for _ in mat.groups()]

return afwGeom.BoxI(afwGeom.PointI(x0 - 1, y0 - 1), afwGeom.PointI(x1 - 1, y1 - 1))

class Ctio0m9Mapper(CameraMapper):
packageName = 'obs_ctio0m9'
Expand Down Expand Up @@ -144,7 +130,7 @@ def std_raw(self, item, dataId):
rawPrescanBBox = a.getRawPrescanBBox()
rawPrescanBBox.shift(afwGeom.ExtentI(2*(ix - 1)*extraSerialOverscan,
(iy - 1)*extraParallelOverscan))

xy0 = rawPrescanBBox.getMin()
xy1 = rawPrescanBBox.getMax()

Expand Down