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-25748: Create pipeline task to generate fakes for AP processing and completeness tests #58
Conversation
Debug unittests. Fix arctan calculation. Fix area calculation.
Add a bit more docs. Debug code and unittest.
python/lsst/ap/pipe/createApFakes.py
Outdated
|
||
Returns | ||
------- | ||
randoms : `lsst.pipe.tasks.PaquertTable` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PaquertTable
-> ParquetTable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually returning DataFrame now so I will change it.
python/lsst/ap/pipe/createApFakes.py
Outdated
Catalog of random points covering the given tract. Follows the | ||
format expected in `lsst.pipe.tasks.InsertFakes`. | ||
""" | ||
np.random.seed(self.config.randomSeed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a np.random generator object instance instead of the built in random state. rnd_gen = np.random.default_rng(seed)
etc. Add a note to the seed docstring that this goes to the default_rng().
---------- | ||
nFakes : `int` | ||
Number of fakes to create. | ||
boundingCicle : `lsst.sphgeom.BoundingCircle` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, all the random generation and transformation support up to a full sphere (up to Pi opening angle). Be explicit in the docstring about the maximum size of the allowed BoundingCircle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A larger than Pi value for a bounding circle doesn't make sense as a bounding circle of Pi already encompasses the full sphere.
Number of fakes to create. | ||
boundingCicle : `lsst.sphgeom.BoundingCircle` | ||
Circle bound covering the tract. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a geometrical distribution of points can easily be ambiguous. Please add a Note in the docstring here and perhaps in the Task description as well that "spatially uniform" actually means a uniform distribution of points per solid angle here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added "on the sphere" to be clearer.
cross /= np.sqrt(cross[0] ** 2 + cross[1] ** 2 + cross[2] ** 2) | ||
cosTheta = center.z() | ||
sinTheta = np.sin(np.arccos(center.z())) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not check that all the terms are correct in this matrix though I see it is tested with random angles (up to a rotation of ?); add a reference in a comment/docstring if this form of the rotation matrix is readily written down somewhere as a formula (I mean textbook, paper, WolframMathWorld, your notebook, tech note etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wikipedia baby... https://en.wikipedia.org/wiki/Rotation_matrix the "Rotation from axis and angle" sub heading.
python/lsst/ap/pipe/createApFakes.py
Outdated
return {self.config.visitSourceFlagCol: isVisitSource, | ||
self.config.templateSourceFlagCol: isTemplateSource} | ||
|
||
def createRandomMagnitudes(self, nFakes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please emhpasize here (createUniformRandomMagnitudes()
) and note in the Task docstring that this is uniform in magnitudes which is a non-physical model but perhaps all right for this task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of want to leave this as a generic name so that it can be overwritten in possible inherited tasks.
Fix linting.
b28abb4
to
068f394
Compare
No description provided.