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-24926: Attempt to get footprints from afw diaSourceCatalog and automatically set the alert cutout size. #84

Merged
merged 5 commits into from Jun 2, 2020

Conversation

morriscb
Copy link
Contributor

No description provided.

@@ -715,6 +715,9 @@ def make_dia_source_schema():
'observed in.')
schema.addField("isDipole", type='Flag',
doc='Object determined to be a dipole.')
schema.addField("bboxSize", type='L',
doc='Length of the square bounding box for cutouts in the '
'alerts.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments/docstrings above say this is the “minimal schema required for a DIASource”, and that it was “Generated automatically from apdb-schema.yaml in dax_apdb/data”.

I'm pretty sure that adding bboxSize renders at least the second of those comments untrue.

I'm surprised that the bbox size is part of the minimal schema, too, but I should understand the rest of the PR before worrying about that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, having read a bit further, I think this is fine. Specifically, what I've understood is that this schema is not exactly what's mapped to the database, but is just being used to pass information through the DIA pipeline (because we read and discard the footprint early in the process, and need somewhere to keep its dimensions).

I think that's fine, but some updates to the comments about where this schema came from and what it's used for would help!

footprintBBox = inputRecord.getFootprint().getBBox()
recX = inputRecord.getCentroid().x
recY = inputRecord.getCentroid().y
bboxSize = int(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int is going to round down here, right? Is that what we want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly below this line is a ceil call that rounds up no matter what. The int is here only to change the type after the calculation.

from lsst.utils import getPackageDir
import lsst.utils.tests


def make_input_source_catalog(n_objects, add_flags=False):
def make_input_source_catalog(dataset, add_flags=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring needs updating to match this change.

import lsst.afw.image as afwImage
import lsst.afw.image.utils as afwImageUtils
import lsst.geom as geom
import lsst.meas.base.tests as measTests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add meas_base as setupRequired to ups/ap_association.table.

@@ -181,6 +178,26 @@ def _patchDiaObjects(self, diaObjects):
diaObjects["zLcNonPeriodic"] = None
diaObjects["yLcNonPeriodic"] = None

def createDiaSourceBBox(self, bboxSize):
"""Compute the size of the bounding box for this diaSource.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be worth clarifying this docstring a bit — it's kinda surprising that it takes an argument called bboxSize and yet it “computes the size of the bounding box”.

Perhaps something like “given the maximum dimension of the source footprint, in pixels, return an appropriate bounding box”?

else:
obj.set(subSchema.getKey(), 1)
return objects
if subSchema.getField().getName() == "ip_diffim_DipoleFit_neg_instFlux":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realise the logic here is mostly not new, just rearranged, but... I kinda feel like a comment about what's going on would be helpful. Why are these particular fields being set to these particular values?

@morriscb
Copy link
Contributor Author

morriscb commented Jun 1, 2020

Hey @jdswinbank, I'm ready for you have a look again.

Additionally create unittests for new method.
Debug unittest.

Fix linting and add bbox test to run.
Reword docstring in DiaSource schema.

Edit docstring in unittest.
Additionally alphabetize packages in ups table.

Add clarifying comment to fake diaSource creation.
@morriscb morriscb merged commit 4835ec0 into master Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants