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-48256: Fix RunTimeError 'Record data is not contiguous in memory.' when running subtraction #369

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mrawls
Copy link
Contributor

@mrawls mrawls commented Dec 24, 2024

No description provided.

@mrawls mrawls requested a review from parejkoj December 24, 2024 07:56
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

Could we get a unittest that confirms the bug is fixed? Because as coded, this wouldn't fix it (and I'm now not sure what the underlying bug truly is anyway!).

@@ -853,6 +853,10 @@ def _checkMask(mask, sources, excludeMaskPlanes, checkAdjacent=True):
xv = (np.rint(sources.getX() - mask.getX0())).astype(int)
yv = (np.rint(sources.getY() - mask.getY0())).astype(int)

# The source catalog may not be contiguous.
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 this comment is necessary: the lines below say the same thing.

@@ -853,6 +853,10 @@ def _checkMask(mask, sources, excludeMaskPlanes, checkAdjacent=True):
xv = (np.rint(sources.getX() - mask.getX0())).astype(int)
yv = (np.rint(sources.getY() - mask.getY0())).astype(int)

# The source catalog may not be contiguous.
if not sources.isContiguous():
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 pretty sure this is too late to fix the problem, since the error report has it coming from the xv=... line above. When I said line 854, it must have been on a different version of the file. What I had meant was just after the call to self.sourceSelector.selectSources in _sourceSelector(). Except _checkMask is called on sources, not selected, so I don't see how it could fail in this way, unless the input catalog is broken somehow?

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 put the putative fix in _checkMask because it operates on the source table in question, but you're probably right that this would best be handled earlier.

@mrawls
Copy link
Contributor Author

mrawls commented Jan 9, 2025

I'd like to add a unit test but I'm not sure how to make a non-contiguous source catalog on purpose. I think the test would best go here; I can work on this tomorrow.

@parejkoj
Copy link
Contributor

I think we need to find out how this was triggered in this first place. I posted a followup question on the ticket, because it doesn't seem possible to have failed with a non-contiguous, unmodified catalog.

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.

2 participants