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-20760: Drop DiaSources if RA/DEC is NaN and throw warning. #50
Conversation
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.
some fiddly suggestions.
DataFrame of DiaSources trimmed of all entries with NaN values for | ||
RA/DEC. | ||
""" | ||
nan_mask = np.logical_or(np.isnan(dia_sources.loc[:, "ra"]), |
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 would do this in a more native pandas way:
nan_mask = dia_sources["ra"].isnull() | dia_sources["decl"].isnull()
"DiaSource %i has NaN value for RA/DEC, " | ||
"dropping from association." % | ||
dia_sources.loc[nan_idx, "diaSourceId"]) | ||
dia_sources = dia_sources[np.logical_not(nan_mask)] |
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.
You might try a timing test of just this line and see if dia_sources[~nan_mask]
is faster.
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 doubt there is much difference here so I'll change it to the simpler line.
inplace=True) | ||
|
||
dia_sources.loc[2, "ra"] = np.nan | ||
dia_sources.loc[3, "decl"] = np.nan |
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.
this may be silly, but how about a check for both ra and decl as NaN?
Updated the ticket. Take a look. |
No description provided.