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-47648 : Return table of unassociated objects #254

Merged
merged 1 commit into from
Jan 23, 2025
Merged

Conversation

Gerenjie
Copy link
Contributor

Adds a new dataset, unAssocSsObjects, to the struct returned by ssoAssociation and sends it to the Butler as ssSingleFrameUnassociatedObjects through ssSingleFrameAssociation. Doesn't do anything to diaPipe, so this only affects SingleFrame.

Copy link

@matthewholman matthewholman left a comment

Choose a reason for hiding this comment

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

Jake and I sat together and reviewed this.

Copy link

@ColinOrionChandler ColinOrionChandler left a comment

Choose a reason for hiding this comment

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

Looks good to me. Looking forward to this...

Copy link
Contributor

@isullivan isullivan 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 for you to consider

python/lsst/ap/association/diaPipe.py Show resolved Hide resolved
python/lsst/ap/association/diaPipe.py Show resolved Hide resolved
solarSystemObjectTable, exposure)
associatedSsSources = ssoAssocResult.ssSourceData
return associatedSsSources
return self.solarSystemAssociator.run(sourceTable.to_pandas(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I missed before that you are converting the source table to astropy, and then a few lines later converting it back to pandas. Can you find a different way to ensure that the ra and dec columns are added and in degrees?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the doc -- it starts out as a lsst.afw.table.SourceCatalog.

@@ -144,31 +150,10 @@ def run(self,
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the Returns section. There are now many additional components to the results struct.

"residual_ras", "residual_decs"])
associatedSsSources=Table(names=["ssObjectId", "ra", "dec", "obs_position", "obj_position",
"residual_ras", "residual_decs"]),
unassociatedSsObjects=Table(names=emptySolarSystemObjects.columns)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine as it is, but are you expecting the column names to change?

@@ -242,13 +249,14 @@ def _radec_to_xyz(self, ras, decs):

return vectors

def _return_empty(self, diaSourceCatalog):
def _return_empty(self, diaSourceCatalog, emptySolarSystemObjects):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a docstring.

@@ -163,8 +163,14 @@ def run(self, diaSourceCatalog, solarSystemObjects, exposure):
decs.append(dia_dec)
expected_ras.append(ssObject["ra"])
expected_decs.append(ssObject["dec"])

self.log.info("Successfully associated %d SolarSystemObjects.", nFound)
associated.append(True)
Copy link
Contributor

Choose a reason for hiding this comment

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

associated is only used to set maskedObjects['associated'] below. Could you instead set the appropriate index of maskedObjects['associated'] directly to True or False here?


self.log.info("Attempting to associate %d objects...", nSolarSystemObjects)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you delete this log message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Amalgamated into "Successfully associated %d / %d SolarSystemObjects.", which I prefer since multithreaded log messages shuffle the lines together.

@@ -125,12 +125,11 @@ def run(self, diaSourceCatalog, solarSystemObjects, exposure):
maskedObjects = self._maskToCcdRegion(
solarSystemObjects,
exposure,
solarSystemObjects["Err(arcsec)"].max())
solarSystemObjects["Err(arcsec)"].max()).copy()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you want this .copy() statement. It is making a copy of the return value of self._maskToCcdRegion, which does not seem useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self._maskToCcdRegion returns a copy-by-reference mask of solarSystemObjects, which I can't set a column of (i.e. associated later). Copying the dataframe makes it alterable.

tests/test_diaPipe.py Show resolved Hide resolved
@isullivan
Copy link
Contributor

I forgot to mention: please edit the "merge" commit to have a more descriptive message.

@Gerenjie Gerenjie force-pushed the tickets/DM-47648 branch 3 times, most recently from 4966bc5 to 7c860aa Compare January 10, 2025 20:54
@Gerenjie Gerenjie merged commit 9effe60 into main Jan 23, 2025
2 checks passed
@Gerenjie Gerenjie deleted the tickets/DM-47648 branch January 23, 2025 05:07
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.

4 participants