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-20760: Drop DiaSources if RA/DEC is NaN and throw warning. #50

Merged
merged 3 commits into from Aug 5, 2019

Conversation

morriscb
Copy link
Contributor

@morriscb morriscb commented Aug 1, 2019

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.

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"]),
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 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)]
Copy link
Contributor

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.

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 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
Copy link
Contributor

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?

@morriscb
Copy link
Contributor Author

morriscb commented Aug 2, 2019

Updated the ticket. Take a look.

@morriscb morriscb merged commit c102aea into master Aug 5, 2019
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