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

Extended packed designation functionality #406

Conversation

hhsieh00
Copy link
Collaborator

Added functionality for extended packed provisional designations to be implemented by the MPC in anticipation of higher discovery rates from LSST (https://minorplanetcenter.net/mpcops/documentation/provisional-designation-definition/)

@pep8speaks
Copy link

pep8speaks commented Aug 23, 2024

Hello @hhsieh00! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-09-06 21:02:13 UTC

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 99.00990% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.19%. Comparing base (df7f292) to head (e8f5699).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
sbpy/data/names.py 98.21% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #406      +/-   ##
==========================================
+ Coverage   82.99%   83.19%   +0.20%     
==========================================
  Files          88       88              
  Lines        8109     8183      +74     
==========================================
+ Hits         6730     6808      +78     
+ Misses       1379     1375       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hhsieh00 hhsieh00 added enhancement feature request request for new functionality labels Aug 23, 2024
@hhsieh00 hhsieh00 changed the title Added extended packed desig functionality Extended packed desig functionality Aug 23, 2024
@hhsieh00 hhsieh00 changed the title Extended packed desig functionality Extended packed designation functionality Aug 23, 2024
@hhsieh00 hhsieh00 marked this pull request as draft August 23, 2024 03:03
@hhsieh00 hhsieh00 added this to the v0.6 milestone Aug 23, 2024
@hhsieh00 hhsieh00 marked this pull request as ready for review August 23, 2024 23:36
@hhsieh00 hhsieh00 requested a review from mkelley August 23, 2024 23:36
@mkelley mkelley added the data label Aug 23, 2024
@mkelley
Copy link
Member

mkelley commented Aug 24, 2024

I'll do a detailed review later, but it looks like two of your lines are not covered by the tests:

https://app.codecov.io/gh/NASA-Planetary-Science/sbpy/pull/406/blob/sbpy/data/names.py#L164

Can you add a case that raises IndexError or ValueError? You can test it like so:

def test_raises_error():
    with pytest.raises(IndexError):
        Names.to_packed("bad_input_here")

There are a couple other blocks not in our testing suite, but they don't seem to be related to your edits, so I won't make you cover them.

@hhsieh00 hhsieh00 marked this pull request as draft August 24, 2024 11:47
@hhsieh00 hhsieh00 marked this pull request as ready for review August 24, 2024 23:35
@hhsieh00
Copy link
Collaborator Author

Just a note, I think line 140 (which I didn't write, but just put inside a try-except block; but which is currently flagged as uncovered code) is extraneous, since the "s[6:].isdigit()" condition above it should already prevent anything that looks like "1995 A" (i.e., single letter, no subscript) from being passed through that section. As such, I think it can be deleted, but just wanted to get a second opinion before doing so.

@mkelley
Copy link
Member

mkelley commented Aug 26, 2024

You're right, except that we can get to that line with a cometary fragment style designation. I'm seeing two problems.
Something like "1234 A-A" returns a value, but should raise an error, right? Also, lines 129 and 131 test for the hyphen that denotes a fragment. They test s[-2] but fragments could be two characters (73P-BA). The testing suite doesn't check for two character fragments, but it should.

In [3]: Names.to_packed("2024 A-A")
Out[3]: 'K24A00a'

They are unrelated, so we should proceed with this PR, and open issues for each of them.

@hhsieh00
Copy link
Collaborator Author

Oh yeah, I did notice that multi-letter fragments were not accounted for in the code, but also that they do not seem to be accounted for by the MPC's own documentation (https://www.minorplanetcenter.net/iau/info/PackedDes.html), except by making the 7 character packed designation into an 8 character designation since the fragment is simply recorded in plain-text. And yeah, 1234 A-A seems like a different issue, so maybe better to treat it with a separate issue/PR?

@hhsieh00
Copy link
Collaborator Author

By the way, just for traceability, in working on the code for the extended packed provisional designations, I found that the MPC had also extended its scheme for packed permanent designations beyond 620000, so code for handling extended packed permanent designations is also included in this PR.

Copy link
Member

@mkelley mkelley left a comment

Choose a reason for hiding this comment

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

The updates look good. Since you tagged it v0.6, we will merge after v0.5 is out.

and len(p) == 7
):
# packed numbers translation string with no I
pkd_noI = 'ABCDEFGHJKLMNOPQRSTUVWXYZ'
Copy link
Member

Choose a reason for hiding this comment

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

This variable is not used and should be deleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

Copy link
Member

@mkelley mkelley left a comment

Choose a reason for hiding this comment

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

You'll need to rebase with the updated main branch, then resolve the changes.rst conflicts. Let me know if you want some tips.

@hhsieh00
Copy link
Collaborator Author

Hm, yeah, can you send me info on how to do that? Thanks!

@hhsieh00 hhsieh00 force-pushed the 388-adding-functionality-to-unpack-mpcs-new-lsst-era-extended-packed-designation-format branch from 20ae799 to 037c6de Compare September 6, 2024 03:47
removed second instance of pkd_noI definition

fixed test

Update test_names.py

Update test_names.py

changed indentation of a closing )

fixed error with unpacking permanent desigs

fixed typo

modified code structure slightly + added tests

removed test_break_packed() case that is no longer invalid

fixed typo in test to_packed() statements

added quotes to numerical designations in test statements

fixed typos

added functionality for extended permanent asteroid designations

continuing to try to cover code with tests

Update test_names.py

Update test_names.py

added another test error

added different test errors

Update test_names.py

Update test_names.py

error not being raised...testing more

testing error raising

removed example that didn't raise error

changed ValueError and IndexError to TargetNameParseError

changed some ValueError examples to IndexError

added ValueError examples to test_names.py

added ValueError examples to test_names.py

fixed typo

fixed typo

added more data validation

added more data validation checks and fixed some typos

Update names.py

Added check for value errors in to_packed

Added check for value errors in extended provisional designation code block of to_packed()

missing quotes in example results

added missing quotes in example results

fixed another bug in to_packed()

fixed another bug in to_packed() where designations with 2-digit subscripts were getting skipped

fixed error where some packed desigs were failing

return statement was missing in to_packed() for provisional designations with no subscript number or subscripts of 1

various changes

- added examples of extended provisional designation handling to names.rst
- fixed bug in to_packed()
- added tests to test_names.py

forgot math import command

forgot math import command

Added/removed white spaces

Added/removed white spaces

Added extended packed desig functionality

Added functionality for extended packed provisional designations to be implemented by the MPC in anticipation of higher discovery rates from LSST (https://minorplanetcenter.net/mpcops/documentation/provisional-designation-definition/)
@hhsieh00 hhsieh00 force-pushed the 388-adding-functionality-to-unpack-mpcs-new-lsst-era-extended-packed-designation-format branch from 037c6de to e8f5699 Compare September 6, 2024 21:02
@hhsieh00 hhsieh00 merged commit 813fe61 into main Sep 6, 2024
10 checks passed
@mkelley
Copy link
Member

mkelley commented Sep 6, 2024

Congrats!

@hhsieh00 hhsieh00 deleted the 388-adding-functionality-to-unpack-mpcs-new-lsst-era-extended-packed-designation-format branch September 7, 2024 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data enhancement feature request request for new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding functionality to unpack MPC's new LSST-era extended packed designation format
3 participants