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-19694: Make internal table contiguous in memory #167

Merged
merged 1 commit into from
May 9, 2019
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
26 changes: 13 additions & 13 deletions python/lsst/meas/algorithms/defects.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,13 @@ def toFitsRegionTable(self):
rotang = schema.addField("ROTANG", type="D", units="deg", doc="Rotation angle")
component = schema.addField("COMPONENT", type="I", doc="Index of this region")
table = lsst.afw.table.BaseCatalog(schema)
table.resize(len(self._defects))

for i, defect in enumerate(self._defects):
box = defect.getBBox()
record = table.addNew()
# Correct for the FITS 1-based offset
record.set(x, box.getCenterX() + 1.0)
record.set(y, box.getCenterY() + 1.0)
table[i][x] = box.getCenterX() + 1.0
table[i][y] = box.getCenterY() + 1.0
width = box.getWidth()
height = box.getHeight()

Expand All @@ -302,10 +302,10 @@ def toFitsRegionTable(self):
shapeType = "POINT"
else:
shapeType = "BOX"
record.set(shape, shapeType)
record.set(r, np.array([width, height], dtype=np.float64))
record.set(rotang, 0.0)
record.set(component, i)
table[i][shape] = shapeType
table[i][r] = np.array([width, height], dtype=np.float64)
table[i][rotang] = 0.0
table[i][component] = i

# Set some metadata in the table (force OBSTYPE to exist)
metadata = copy.copy(self.getMetadata())
Expand Down Expand Up @@ -370,14 +370,14 @@ def toSimpleTable(self):
height = schema.addField("height", type="I", units="pix",
doc="Y extent of box")
table = lsst.afw.table.BaseCatalog(schema)
table.resize(len(self._defects))

for defect in self._defects:
for i, defect in enumerate(self._defects):
box = defect.getBBox()
record = table.addNew()
record.set(x, box.getBeginX())
record.set(y, box.getBeginY())
record.set(width, box.getWidth())
record.set(height, box.getHeight())
table[i][x] = box.getBeginX()
table[i][y] = box.getBeginY()
table[i][width] = box.getWidth()
table[i][height] = box.getHeight()

# Set some metadata in the table (force OBSTYPE to exist)
metadata = copy.copy(self.getMetadata())
Expand Down