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-25748: Create pipeline task to generate fakes for AP processing and completeness tests #58

Merged
merged 3 commits into from Sep 10, 2020

Conversation

morriscb
Copy link
Contributor

No description provided.

Debug unittests.

Fix arctan calculation.

Fix area calculation.
Add a bit more docs.

Debug code and unittest.

Returns
-------
randoms : `lsst.pipe.tasks.PaquertTable`
Copy link
Member

Choose a reason for hiding this comment

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

PaquertTable -> ParquetTable

Copy link
Contributor Author

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.

Catalog of random points covering the given tract. Follows the
format expected in `lsst.pipe.tasks.InsertFakes`.
"""
np.random.seed(self.config.randomSeed)
Copy link
Member

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().

https://numpy.org/doc/stable/reference/random/index.html

----------
nFakes : `int`
Number of fakes to create.
boundingCicle : `lsst.sphgeom.BoundingCircle`
Copy link
Member

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.

Copy link
Contributor Author

@morriscb morriscb Sep 9, 2020

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.

Copy link
Member

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.

Copy link
Contributor Author

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()))

Copy link
Member

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.).

Copy link
Contributor Author

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.

return {self.config.visitSourceFlagCol: isVisitSource,
self.config.templateSourceFlagCol: isTemplateSource}

def createRandomMagnitudes(self, nFakes):
Copy link
Member

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.

Copy link
Contributor Author

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.
@morriscb morriscb merged commit f4d06a5 into master Sep 10, 2020
@kfindeisen kfindeisen deleted the tickets/DM-25748 branch April 13, 2022 21:55
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