Skip to content

New module to query Lowell Observatory astorbDB database#3203

Open
hhsieh00 wants to merge 171 commits intoastropy:mainfrom
hhsieh00:3129-add-lowell-astorbdb-query-module
Open

New module to query Lowell Observatory astorbDB database#3203
hhsieh00 wants to merge 171 commits intoastropy:mainfrom
hhsieh00:3129-add-lowell-astorbdb-query-module

Conversation

@hhsieh00
Copy link
Copy Markdown

@hhsieh00 hhsieh00 commented Feb 4, 2025

This is a new module for querying the Lowell Observatory astorbDB database (see issue #3129), specifically using REST APIs used to run their AstInfo tool (https://asteroid.lowell.edu/astinfo/). The AstInfo class in this module specifically retrieves designation, orbital element, orbit, albedo, color, taxonomy, lightcurve, dynamical family, and escape route data for asteroids catalogued in the Lowell astorbDB database.

@bsipocz bsipocz added this to the v0.4.10 milestone Feb 4, 2025
@bsipocz bsipocz marked this pull request as draft February 4, 2025 20:25
@mkelley mkelley self-requested a review February 5, 2025 20:56
Copy link
Copy Markdown
Contributor

@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.

Looks good and very useful in general. Some initial comments and questions to address while you continue testing.

Comment thread astroquery/astorbdb/__init__.py Outdated
Comment thread astroquery/astorbdb/core.py Outdated
Comment thread astroquery/astorbdb/core.py Outdated
Comment thread astroquery/astorbdb/core.py Outdated
Comment thread astroquery/astorbdb/core.py Outdated
Comment thread astroquery/astorbdb/core.py Outdated
Comment thread astroquery/astorbdb/core.py Outdated
@bsipocz
Copy link
Copy Markdown
Member

bsipocz commented Feb 15, 2025

Thanks @mkelley for the review. I haven't looked into it in any meaningful way yet, but I notice that there are a lot of comments on async stuff. We should remove/rework the template module as a lot has changed. E.g. there is a preference of supporting actual async/sync API and not just with the early template hackary. So I would suggest to so that, too, if the service support async, then opt into that with a keyword argument, but don't duplicate the methods with the decorator.

#2598

or one PR that did the keyword approach: #3201 or the ESA modules also have a async_job keyword to switch between sync and async query modes.

@bsipocz bsipocz removed this from the v0.4.10 milestone Mar 18, 2025
@mkelley
Copy link
Copy Markdown
Contributor

mkelley commented Oct 21, 2025

I'm not sure why the checks didn't run. @hhsieh00 You might want to try to git rebase with an updated astroquery/main and then push the updates.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 98.29060% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.03%. Comparing base (ef48060) to head (f01791f).
⚠️ Report is 263 commits behind head on main.

Files with missing lines Patch % Lines
astroquery/lowellmps/core.py 98.21% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3203      +/-   ##
==========================================
+ Coverage   71.72%   72.03%   +0.30%     
==========================================
  Files         235      238       +3     
  Lines       20253    20487     +234     
==========================================
+ Hits        14527    14757     +230     
- Misses       5726     5730       +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hhsieh00 hhsieh00 marked this pull request as ready for review October 22, 2025 02:34
@hhsieh00 hhsieh00 requested a review from mkelley October 22, 2025 02:39
Copy link
Copy Markdown
Contributor

@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.

Looks good, thanks again! I'll ask a general question for @bsipocz , this PR adds about 0.4 MB of test data. Is that OK, or should we consider reducing it?

Comment thread .pre-commit-config.yaml Outdated

Returns
-------
res : A dictionary holding available AstInfo data
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bsipocz is it OK that this particular _async method returns a dictionary of responses? _parse_result appropriately handles it, so the class is internally consistent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would say drop duplicating the async/sync methods approach

Comment thread astroquery/astorbdb/core.py Outdated
def _process_data_elements(self, src):
"""
internal routine to process raw data in Dict format, must
be able to work recursively
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe some additional comments could be added here to help with code maintenance. It seems to me that this is primarily about assigning units to returned values. Is there a place in the astorb documentation where the units were defined?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

added some more specific comments

@hhsieh00
Copy link
Copy Markdown
Author

I can reduce some of the test data. Multiple objects are necessary since some have null results (e.g., main-belt asteroids don't have escape route data, while NEOs don't have family data, and relatively newly discovered asteroids don't have lightcurve, taxonomic, or albedo data), but I can reduce it to less than what's there currently.

query code only for now; tests not written yet
Fixing some codestyle issues in core.py
fixing more codestyle issues in core.py
First complete draft of the astorbdb class including tests and documentation
removed get_raw_response lines, changed names of dynamical_family and escape_routes methods, changed OrderedDict output to regular dictionaries. Also re-ordered methods in alphabetical order.  Other minor edits.
fixed dynamical_family and escape_route function names in documentation; also added astorbdb.rst to various toc files
query code only for now; tests not written yet
Fixing some codestyle issues in core.py
fixing more codestyle issues in core.py
First complete draft of the astorbdb class including tests and documentation
removed get_raw_response lines, changed names of dynamical_family and escape_routes methods, changed OrderedDict output to regular dictionaries. Also re-ordered methods in alphabetical order.  Other minor edits.
query code only for now; tests not written yet
Fixing some codestyle issues in core.py
fixing more codestyle issues in core.py
This reverts commit d56b251.
@hhsieh00 hhsieh00 force-pushed the 3129-add-lowell-astorbdb-query-module branch from 92a6f86 to 13be374 Compare December 16, 2025 08:34
removed automodapi code from solarsystem version of  lowellmps.rst to match other sections (e.g., jpl, imcce)
@hhsieh00 hhsieh00 requested a review from mkelley December 16, 2025 18:51
Copy link
Copy Markdown
Contributor

@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.

Just one comment on the documentation.

an interface to the `Asteroid Information
<https://asteroid.lowell.edu/astinfo/>`_ (AstInfo)
tool provided as part of
the Lowell Minor Planet Services which utilize the `astorbDB
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't really understand that there was a publication related to this until I followed the link. What about re-writing this link in citation style? Something like, "astorbDB database (Moskovitz et al. 2022 <url>_)"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I second this

@mkelley mkelley requested a review from bsipocz January 12, 2026 20:28
Copy link
Copy Markdown
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

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

Thank you @hhsieh00 for this PR. I have a a large collection of comments, but this feels to be rather close to be merge able. The big picture items:

  • I think the module could be named in a bit more descriptive way
  • there are way too many commits with a lot of revertions. Those should preferably be squashed into the commits they are reverting.
  • I have commented on the async-sync question already, there should not be a duplicate of methods any more, no usage of the decorator and if the service supports real async, then control it with a kwarg, like async_job=True
  • I feel the API can be a bit more descriptive or better fit into the method naming approaches we use in the other modules (e.g. not just a noun but an active verb+noun, e.g. query_albedos -- I firmly believe this will help users in the long run)

Again, thank you so much for working on this module, I hope while the comments are numerous they won't be too complicated to be addressed.

Comment thread CHANGES.rst
New Tools and Services
----------------------

lowellmps
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would consider adding an underscore in the name, that would ease readibility and we have precedent for it e.g. esa.xmm_newton or ipac.nexsci.nasa_exoplanet_archive

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@bsipocz I would be in favor of this. With the nexsci name in mind in particular, what do you think about expanding it a bit more to lowell_minor_planet_services? "MPS" is not really an abbreviation in common usage that I'm aware of, so spelling it out completely would be the best for readability in my opinion, at the expense of compactness.

Comment on lines +4 to +7
LOWELLMPS
-------------------------

:author: Henry Hsieh (hhsieh@gmail.com)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe add a 1-2 sentence description here, otherwise loose this docstring.

Also, note that we are cleaning out this author information -- the git history should hold that information much better than these files.

Comment thread CHANGES.rst
lowellmps
^^^^^^^^^

- module added to query the Lowell Minor Planet Services database [#3203]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

only the AstInfo tool was added, so be explicit about it

__all__ = ['AstInfo', 'AstInfoClass']


@async_to_sync
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't use this any more; if async is supported by the server add support for it via a kwarg.

# actual query uri
_uri = None

def albedos_async(self, object_name, *,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe query_albedo?

an interface to the `Asteroid Information
<https://asteroid.lowell.edu/astinfo/>`_ (AstInfo)
tool provided as part of
the Lowell Minor Planet Services which utilize the `astorbDB
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I second this

>>> from astroquery.lowellmps import AstInfo
>>> albedos = AstInfo.albedos('656')
>>> print(albedos) # doctest: +IGNORE_OUTPUT
[{'albedo': 0.065, 'albedo_error_lower': -0.002, 'albedo_error_upper': 0.002, 'citation_bibcode': '2011PASJ...63.1117U', 'citation_url': 'https://darts.isas.jaxa.jp/astro/akari/catalogue/AcuA.html', 'count_bands_detection': 2, 'diameter': <Quantity 54.32 km>, 'diameter_error_lower': <Quantity -0.77 km>, 'diameter_error_upper': <Quantity 0.77 km>, 'eta': 0.82, 'eta_error_lower': None, 'eta_error_upper': None, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 11, 'survey_name': 'Usui et al. (2011)'}, {'albedo': 0.0625, 'albedo_error_lower': -0.015, 'albedo_error_upper': 0.015, 'citation_bibcode': '2004PDSS...12.....T', 'citation_url': 'http://sbn.psi.edu/pds/asteroid/IRAS_A_FPA_3_RDR_IMPS_V6_0.zip', 'count_bands_detection': 3, 'diameter': <Quantity 53.17 km>, 'diameter_error_lower': <Quantity -5.5 km>, 'diameter_error_upper': <Quantity 5.5 km>, 'eta': 0.756, 'eta_error_lower': -1, 'eta_error_upper': 1, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 18, 'survey_name': 'Infrared Astronomical Satellite (IRAS)'}, {'albedo': 0.075, 'albedo_error_lower': -0.011, 'albedo_error_upper': 0.011, 'citation_bibcode': '2019PDSS..251.....M', 'citation_url': 'http://sbnarchive.psi.edu/pds4/non_mission/neowise_diameters_albedos_V2_0.zip', 'count_bands_detection': 4, 'diameter': <Quantity 48.471 km>, 'diameter_error_lower': <Quantity -0.535 km>, 'diameter_error_upper': <Quantity 0.535 km>, 'eta': 1.033, 'eta_error_lower': -0.021, 'eta_error_upper': 0.021, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 58, 'survey_name': 'NEOWISE'}, {'albedo': 0.045, 'albedo_error_lower': -0.005, 'albedo_error_upper': 0.005, 'citation_bibcode': '2019PDSS..251.....M', 'citation_url': 'http://sbnarchive.psi.edu/pds4/non_mission/neowise_diameters_albedos_V2_0.zip', 'count_bands_detection': 4, 'diameter': <Quantity 62.604 km>, 'diameter_error_lower': <Quantity -0.512 km>, 'diameter_error_upper': <Quantity 0.512 km>, 'eta': 1.458, 'eta_error_lower': -0.025, 'eta_error_upper': 0.025, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 46, 'survey_name': 'NEOWISE'}, {'albedo': 0.092, 'albedo_error_lower': -0.041, 'albedo_error_upper': 0.041, 'citation_bibcode': '2019PDSS..251.....M', 'citation_url': 'http://sbnarchive.psi.edu/pds4/non_mission/neowise_diameters_albedos_V2_0.zip', 'count_bands_detection': 2, 'diameter': <Quantity 38.214 km>, 'diameter_error_lower': <Quantity -10.329 km>, 'diameter_error_upper': <Quantity 10.329 km>, 'eta': 0.95, 'eta_error_lower': -0.2, 'eta_error_upper': 0.2, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 16, 'survey_name': 'NEOWISE'}, {'albedo': 0.069, 'albedo_error_lower': -0.034, 'albedo_error_upper': 0.034, 'citation_bibcode': '2019PDSS..251.....M', 'citation_url': 'http://sbnarchive.psi.edu/pds4/non_mission/neowise_diameters_albedos_V2_0.zip', 'count_bands_detection': 2, 'diameter': <Quantity 45.005 km>, 'diameter_error_lower': <Quantity -15.483 km>, 'diameter_error_upper': <Quantity 15.483 km>, 'eta': 0.95, 'eta_error_lower': -0.2, 'eta_error_upper': 0.2, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 26, 'survey_name': 'NEOWISE'}, {'albedo': 0.083, 'albedo_error_lower': -0.054, 'albedo_error_upper': 0.054, 'citation_bibcode': '2019PDSS..251.....M', 'citation_url': 'http://sbnarchive.psi.edu/pds4/non_mission/neowise_diameters_albedos_V2_0.zip', 'count_bands_detection': 2, 'diameter': <Quantity 40.12 km>, 'diameter_error_lower': <Quantity -14.369 km>, 'diameter_error_upper': <Quantity 14.369 km>, 'eta': 0.95, 'eta_error_lower': -0.2, 'eta_error_upper': 0.2, 'measurement_techniques': ['Mid IR photometry'], 'observations_total': 22, 'survey_name': 'NEOWISE'}]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if adding some whitespaces would make this a bit better readable? After all we're already ignoring the output

Comment on lines +172 to +173
Output
======
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

there are already examples above with outputs, so I would find it helpful if this heading would be a bit more detailed

@@ -0,0 +1,250 @@
.. _astroquery.lowellmps:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you add this, all the remote-data directives can be removed from below

Suggested change
.. as all code examples require remote-data access, thus only using this one at the very top
.. doctest-remote-data-all::

database.

The development of this submodule is funded through NASA PDART
Grant No. 80NSSC18K0987 to the `sbpy project <https://sbpy.org>`_.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this still the correct grant number or just a copy paste error from the other solarsystem modules

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, yes, @hhsieh00 that should be 80NSSC22K0143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants