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-31619: Fully incorporate SSP object association in DiaPipe #132

Merged
merged 5 commits into from Oct 11, 2021

Conversation

morriscb
Copy link
Contributor

@morriscb morriscb commented Oct 1, 2021

No description provided.

Copy link
Contributor

@ebellm ebellm left a comment

Choose a reason for hiding this comment

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

A few comments and suggestions throughout.

doSolarSystemAssociation = pexConfig.Field(
dtype=bool,
default=False,
doc="",
Copy link
Contributor

Choose a reason for hiding this comment

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

While I think the name is pretty self-explanatory here please do give this a non-null docstring.

for idx, diaSource in unAssocDiaSources.iterrows():
newDiaObjectsList.append(
self._initialize_dia_object(diaSource["diaSourceId"]))
unAssocDiaSources.loc[idx, "diaObjectId"] = diaSource["diaSourceId"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused here as to why you are setting the diaObjectId to be the diaSourceId. Are these not distinct ids?

Copy link
Contributor

Choose a reason for hiding this comment

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

In any case this doesn't need to be looped: you can simply say

unAssocDiaSources['diaObjectId'] = unAssocDiaSources['diaSourceId']

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The id for newly created DiaObjects has been the same as the id of the first DiaSource that makes up the object since we've had DiaObjects in the pipeline. It's an easy way to give all the DiaObjects a unique id.

def testRun(self):
"""Test running while creating and packaging alerts.
"""
self._testRun(True, True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self._testRun(True, True)
self._testRun(doPackageAlerts=True, doSolarSystemAssociation=True)

def testRunWithSolarSystemAssociation(self):
"""Test running while creating and packaging alerts.
"""
self._testRun(False, True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self._testRun(False, True)
self._testRun(doPackageAlerts=False, doSolarSystemAssociation=True)

def testRunWithAlerts(self):
"""Test running while creating and packaging alerts.
"""
self._testRun(True)
self._testRun(True, False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self._testRun(True, False)
self._testRun(doPackageAlerts=True, doSolarSystemAssociation=False)

"""Test running without creating and packaging alerts.
"""
self._testRun(False)
self._testRun(False, False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self._testRun(False, False)
self._testRun(doPackageAlerts=False, doSolarSystemAssociation=False)

diaSources.loc[idx, "diaObjectId"] = diaSource["diaSourceId"]
for idx, diaSource in unAssocDiaSources.iterrows():
newDiaObjectsList.append(
self._initialize_dia_object(diaSource["diaSourceId"]))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would investigate if you can run this without the iterrows loop, for example:

newDiaObjectsSeries = unAssocDiaSources['diaSourceId'].apply(self._initialize_dia_object)

which if it works will likely be faster than the explicit loop.

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'll give it a shot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to work. I remember apply being only slightly faster than iterrows when not using built in pandas operations. Still, it's likely to be a bit faster since it now operates on one column not the whole row.

Change outputs of AssociationTask slightly.

Debug line break.
Fixup unittest and datetime in skybotQuery.

Use reset_index to copy sub DataFrames.

Change to MagicMock

Debug unittests.
@morriscb morriscb force-pushed the tickets/DM-31619 branch 2 times, most recently from f049426 to 1300354 Compare October 8, 2021 22:01
Change new dia object creation behavior.

Remove superfluous log statement.
@morriscb morriscb merged commit a715d53 into master Oct 11, 2021
@morriscb morriscb deleted the tickets/DM-31619 branch October 11, 2021 18:05
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