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

Tickets/dm 48561 #189

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Tickets/dm 48561 #189

wants to merge 6 commits into from

Conversation

dsanmartim
Copy link
Contributor

@dsanmartim dsanmartim commented Jan 27, 2025

Hi Tiago,

With the release of astroquery 0.4.8, SIMBAD queries have changed significantly:

  • Methods like query_criteria are now deprecated.
  • Table fields have switched from "distance_result" and "fluxdata(V)" to "mesdistance" and "V".
  • Coordinates (ra and dec) are now returned in degrees.
  • Keywords for RA and DEC are now lowercase: raand dec.

I updated the find_target_simbad in this PR to align with these new defaults. Note that I haven't added backward compatibility with older astroquery versions, limiting the changes to a very straightforward implementation in the find_target_simbad method.

Let me know if that is enough or if you need further changes.

@dsanmartim dsanmartim requested a review from tribeiro January 27, 2025 14:38
Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

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

It seems like you replaced the query_criteria with a query_region and is doing the magnitude selection locally. This is probably going to be problematic, the idea of doing the query with a magnitude range and a catalog selection is that it reduces the load on Simbad, which has a maximum time for queries.

Can you implement the same logic as before with the updated library please?

"cat = HD"
)

# Execute the query_region asynchrnously
Copy link
Member

Choose a reason for hiding this comment

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

Please, remove unnecessary comment.

@ManonMarchand
Copy link

ManonMarchand commented Jan 28, 2025

Hi,

I'm helping people doing the transition to the new SIMBAD API. In your case, the criteria on main_id works, but you'd miss sources where the HD name has not been retained as the main identifier.

Instead, you can do:

from astroquery.simbad import Simbad
simbad = Simbad()
simbad.add_votable_fields("V", "rvz_redshift", "ident")
simbad.query_region("0 0", radius="0.5deg", criteria = "V > 1.0 AND V < 15.0 AND ident.id LIKE 'HD %'")
<Table length=11>
 main_id           ra                  dec          coo_err_maj coo_err_min coo_err_angle coo_wavelength     coo_bibcode             V                rvz_redshift          id    
                  deg                  deg              mas         mas          deg                                                                                              
  object        float64              float64          float32     float32       int16          str1             object            float64               float64           object  
--------- -------------------- -------------------- ----------- ----------- ------------- -------------- ------------------- ------------------ ----------------------- ----------
HD 224448    359.5189049988899       -0.12819304166      0.0184      0.0134            90              O 2020yCat.1350....0G  9.010000228881836  1.7111984493611843e-05  HD 224448
V* DQ Psc   359.94371479533993 -0.28011223164999993      0.0256      0.0177            90              O 2020yCat.1350....0G  6.840000152587891 -0.00010306599411669115  HD 224677
HD 224726 0.048423760559999994       -0.36044690697       0.021       0.017            90              O 2020yCat.1350....0G  7.269999980926514   7.799032670274819e-05  HD 224726
HD 224761  0.11556669868999998        0.20505916363       0.016      0.0118            90              O 2020yCat.1350....0G    9.3100004196167   7.578863438761907e-05  HD 224761
HD 224785  0.16292732910999996  0.22293384328999996      0.0215      0.0148            90              O 2020yCat.1350....0G  8.130000114440918 -0.00012441166837739992  HD 224785
HD 224785  0.16292732910999996  0.22293384328999996      0.0215      0.0148            90              O 2020yCat.1350....0G  8.130000114440918 -0.00012441166837739992 HD 224785A
HD 224839        0.29233276507       -0.07611040791      0.0274      0.0198            90              O 2020yCat.1350....0G  8.140000343322754 -1.0073584936431956e-05  HD 224839
HD 224876   0.3650773433200001        0.30159271301       0.017      0.0155            90              O 2020yCat.1350....0G  9.229999542236328 -0.00016500054530477204  HD 224876
HD 224877        0.35102985846  0.25156479216000005      0.0338      0.0239            90              O 2020yCat.1350....0G 10.666000366210938  -6.337516988152991e-05  HD 224877
HD 224898        0.39679581309 -0.13795247456000004      0.0176      0.0135            90              O 2020yCat.1350....0G  10.13599967956543   -9.14257391609885e-05  HD 224898
HD 224908  0.42679514528000007        -0.2177779556      0.0278      0.0204            90              O 2020yCat.1350....0G  8.640000343322754 -2.3882904019556506e-05  HD 224908

See line 2 where the main ID does not satrt with HD but the source is still part of the HD catalog.

Ident contains all the names of a source.

In case you need it one day, here is the ADQL query corresponding to this search (to be called with simbad.query_tap):

-- output columns
SELECT ra, dec, main_id, allfluxes.V, id AS "HD_id", rvz_redshift AS "z"
FROM basic
-- we need to add fluxes and all identifiers
JOIN allfluxes ON allfluxes.oidref = oid
JOIN ident ON ident.oidref = oid
-- we want something from HD catalog
WHERE ident.id LIKE 'HD %'
-- criteria on magnitude
AND V < 15.0 AND V > 1.0
-- criteria on region
AND CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10, 5, 3)) = 1

If you've got any issue or question with the new API, don't hesitate to tag me.

Manon

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.

3 participants