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

Match psrcat behavior for the "NAME" parameter #122

Merged
merged 3 commits into from
Apr 24, 2023

Conversation

Killian42
Copy link
Contributor

When querying the database for the name parameters, the package currently behaves this way:

>>> import psrqpy
>>> q = psrqpy.QueryATNF(psrs = ['J0034-0721','J1906+1854'], params = ['Name','JName','BName'])
>>> print(q)
JNAME       NAME     BNAME
---------- ---------- --------
J0034-0721 J0034-0721 B0031-07
J1906+1854 J1906+1854       --

With these modifications, the same code would return the following table, which matches the behavior of psrcat for the "NAME" parameter (PSRB if it exists, otherwise PSRJ) :

JNAME       NAME     BNAME  
---------- ---------- --------
J0034-0721   B0031-07 B0031-07
J1906+1854 J1906+1854       --

@mattpitkin
Copy link
Owner

Thanks very much for this. Would you be able to add a test for this in test/query_test.py, e.g.:

def test_name(query):
    """
    Test that the PSRB name is used as default for NAME if it exists, else use PSRJ.
    """

    psr = query.get_pulsar("J0034-0721")
    assert psr["NAME"][0] == psr["BNAME"][0]

    psr = query.get_pulsar("J1906+1854")
    assert psr["NAME"][0] == psr["JNAME"][0]

@Killian42
Copy link
Contributor Author

No problem ! I think the test you wrote is good, so I only added comments.

@mattpitkin
Copy link
Owner

Thanks, I'll merge this when the tests complete.

@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage: 91.66% and project coverage change: +0.14 🎉

Comparison is base (b51fb57) 75.21% compared to head (d5febdd) 75.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   75.21%   75.35%   +0.14%     
==========================================
  Files           7        7              
  Lines        3199     3205       +6     
  Branches      557      558       +1     
==========================================
+ Hits         2406     2415       +9     
+ Misses        571      568       -3     
  Partials      222      222              
Impacted Files Coverage Δ
psrqpy/utils.py 60.22% <85.71%> (+0.38%) ⬆️
psrqpy/tests/query_test.py 98.52% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mattpitkin mattpitkin merged commit 5dbc244 into mattpitkin:main Apr 24, 2023
@mattpitkin
Copy link
Owner

I've released a new version (v1.2.6) with this change incorporated.

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