Skip to content

Conversation

@weaverba137
Copy link
Member

@weaverba137 weaverba137 commented Jun 26, 2025

This PR closes #1701.

The initial commit simply restores the NOIRLab files to the state and content they were when #1701 was last worked on. Further work and testing will be needed to meet astroquery standards.

@weaverba137
Copy link
Member Author

weaverba137 commented Jun 26, 2025

TO DO items identified (i.e. before even starting the review process):

  • Proofread noirlab/noirlab.rst and verify examples.
  • Remove telescope holdings from init file. These are certainly outdated. Link to the about page.
  • Check required acknowledgment(s).
  • Get remote tests working.
  • Add non-remote tests to increase coverage, e.g. monkeypatch.

@codecov
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

❌ Patch coverage is 93.75000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.84%. Comparing base (27a673d) to head (4f1e6e5).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
astroquery/noirlab/core.py 93.25% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3359      +/-   ##
==========================================
+ Coverage   71.73%   71.84%   +0.10%     
==========================================
  Files         235      237       +2     
  Lines       20258    20354      +96     
==========================================
+ Hits        14533    14623      +90     
- Misses       5725     5731       +6     

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

@weaverba137
Copy link
Member Author

Note to self: tox -e py310-test-online -- -P noirlab to do remote tests on only astroquery.noirlab.

@bsipocz
Copy link
Member

bsipocz commented Jun 27, 2025

You also need -R to run the remote tests

@bsipocz bsipocz added this to the v0.4.11 milestone Aug 12, 2025
Copy link
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.

We did a partial review with some comments, I'm coming back to finish this later this week so no need to address any of these yet.

Comment on lines 159 to 190
def query_region_async(self, coordinate, radius=0.1, hdu=False, cache=True):
"""Query for NOIRLab observations by region of the sky.

Given a sky coordinate and radius, returns a `~astropy.table.Table`
of NOIRLab observations.

Parameters
----------
coordinate : :class:`str` or `~astropy.coordinates` object
The target region which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` object.
radius : :class:`str` or `~astropy.units.Quantity` object, optional
Default 0.1 degrees.
The string must be parsable by `~astropy.coordinates.Angle`. The
appropriate `~astropy.units.Quantity` object from
`~astropy.units` may also be used.
hdu : :class:`bool`, optional
If ``True`` return the URL for HDU-based queries.
cache : :class:`bool`, optional
If ``True`` cache the result locally.

Returns
-------
:class:`~requests.Response`
Response object.
"""
self._validate_version()
ra, dec = coordinate.to_string('decimal').split()
url = f'{self._sia_url(hdu=hdu)}?POS={ra},{dec}&SIZE={radius}&VERB=3&format=json'
response = self._request('GET', url, timeout=self.TIMEOUT, cache=cache)
# response.raise_for_status()
return response
Copy link
Member

Choose a reason for hiding this comment

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

We may want to have async as a kwarg instead and not have two separate methods. See how we do this in some of the other modules e.g. in cadc or ipac.irsa (or the esa modules).

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I can tell cadc still has the old @async_to_sync setup. I took a look at ipac.irsa, and there it is apparent that the meaning of async_job is to submit asynchronous queries to a job system of some kind. That doesn't apply to the NOIRLab API.

Based on my experience with sdss, historically "async" meant "return the response object from self._request(), while "sync" meant "based on the response object, download the files referenced in it". This is definitely more applicable to NOIRLab.

Can you elaborate further on the different meanings of "async"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on my experience with sdss, historically "async" meant "return the response object from self._request(), while "sync" meant "based on the response object, download the files referenced in it". This is definitely more applicable to NOIRLab.

This is correct. For the VO case, it can be different, but your interpretation is what I mean by sync vs async.

We have decided that, moving forward, we should not use the async_to_sync functionality, as it is confusing to developers and isn't widely used (#2598). Instead, we prefer kwarg.

It will be a while before we get around to refactoring the old stuff.

Copy link
Member Author

Choose a reason for hiding this comment

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

@keflavich is there an example of a module where async_to_sync functionality has been replaced with a keyword?

Copy link
Member

@bsipocz bsipocz Jan 15, 2026

Choose a reason for hiding this comment

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

yes, modules (e.g. esa, irsa, simbad) do use the async_job kwarg and then connect to the actual async endpoint to the server.

We have decided that, moving forward, we should not use the async_to_sync functionality, as it is confusing to developers and isn't widely used

I would also add that it wasn't real async, the jobs were not run async on the VO service side, and the duplicated methods were not that great from the user POV either.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bsipocz, OK, but that's not the case I'm interested in here. I'm referring to "async" methods that would return the raw response rather than doing further conversion into a table or other high-level data. SDSS has several examples of this. See also @keflavich's comment above.

@weaverba137
Copy link
Member Author

@bsipocz, thank you, the suggestions all look good so far, but given my schedule it will be easier to address them all when you're done.

@bsipocz
Copy link
Member

bsipocz commented Aug 13, 2025

Yes, totally understandable. I really just submitted this half baked review as that is how far we got during the review tutorial during the summer school I was teaching at. I'll get back to the rest later and will write up an actually usable summary, as there are a couple of things that will need to be fixed while the rest is really just some potential follow-up topics.

And again, thanks for working on this, getting a working noirlab module will be superb!

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

I have some more comments to finish up my review.

The overarching theme is to make the API a little bit more consistent with the other modules. And maybe consider using pyvo, but that one is optional for this PR.

And in the meantime it looks like the upstream API has changed, so that may mean some tweaks will be necessary (though the tests are primarily failing with the API number comparison).

Also, the docs build runs into some sphinx errors due to API heading inconsistencies, I'm happy to fix up those before merging.

@weaverba137
Copy link
Member Author

Thank you, I was planning to pick this up next week anyway, so this is good timing.

@weaverba137
Copy link
Member Author

Commit 64b84bf addresses some of the review comments. Others will be addressed soon.

There is an issue that needs to be investigated on the NOIRLab side though. Since I last tested in July, when metadata fields are requested in a query, e.g. md5sum, the field is returned, but a duplicate field with header file:md5sum is also returned. This behavior was unexpected both by me and the developer I mentioned this to.

@weaverba137
Copy link
Member Author

Also, I have no clue why the noirlab.rst is causing a RtD error, because the headers are consistent with other files.

@bsipocz
Copy link
Member

bsipocz commented Sep 18, 2025

Also, I have no clue why the noirlab.rst is causing a RtD error, because the headers are consistent with other files.

That error rings a bell, and will be related to the generated API docs. I would recommend ignoring it for now and I'll have a closer look once this is ready to go in.

@bsipocz bsipocz modified the milestones: v0.4.11, 0.4.12 Sep 18, 2025
* main: (115 commits)
  DOC: removing linking non-module
  MAINT: addig ignoring for py39 warning triggered in boto
  DOC: fix whitespacing around references
  Updates and restructuring of irsa docs.
  Update parameter definitions in MOST docs.
  Corrected epoch parameter definition.
  Further corrections to docstring parameter definitions.
  changelog
  Use continuation when downloading files
  Fix docstring for eccentricity and perihelion time
  DOC: fixing failing doctest
  Changelog
  case insensitive filters
  Raise error if non-string object names
  changelog, docstring
  resolve_objects should accept int
  DOC: clarification for TAP+ [skip ci]
  DOC: Remove unused files
  DOC: Remove defaults channel from RTD
  update path in remote tests
  ...
* main: (95 commits)
  Update change log
  Add interstellar object and dead comet tests.
  Rearrange regex comments
  Allow "dead" comets like 85D
  Use I for interstellar objects, P for periodic comets.
  Numbers are not allowed in fragment designations.
  I/ is not a valid prefix.
  1A, 2A, etc. are not valid objects.
  Update comments to clarify what the code is doing
  Clarify object reassignment.
  Bump the actions group with 2 updates
  maint: switch to the new cds domain name
  fix: remove message when regions is missing
  add changes entry
  remove UCD formatter
  Address review comments from Sam Bianco
  enforce upper limit on MastMissions query radius
  DOC: fix more syntax [skip ci]
  BUG: fix usage of contentless directives
  EUCLIDSWRQ-270: Configure response for get_datalinks with metadata option
  ...
@weaverba137
Copy link
Member Author

@bsipocz, I'm planning to resume work on this PR in the upcoming weeks, in anticipation of a new API version being deployed on the NOIRLab side.

One important question above is about function_name_async functions. I responded to a suggestion with further questions, which I still need answers for.

There is a less urgent question about whether sia_url should be an attribute/property. In NOIRLab's case there are two separate URLs so it kind of has to be a function.

Other open suggestions are things I just need to look up or otherwise implement.

* main: (36 commits)
  Updates to mast_cut
  GAIAPCR-1368 Include PR reference number
  Minimal changes to catalogs docs
  Updated docs
  Updated main page and mast_query page
  Bump the actions group with 2 updates
  changelog
  Be more robust in getting column configuration
  GAIAPCR-1368 new retrieval type RESIDUAL_IMAGE
  fix an error catch
  codestyle
  fix cdms remote tests
  doctest output whitespace
  fix variable name
  remove unnecessary text
  now jplspec / cdms get_molecule behave closer to the same
  factor out parse_molid
  move unique sector logic into helper function
  test coverage for condition when no sectors for target
  add changelog entry
  ...
@weaverba137
Copy link
Member Author

@bsipocz, @keflavich, I hope to finish up a few remaining issues with remote tests (which boil down to column ordering in returned data) in the next day or so. There are still two remaining questions from my previous comment. Addressing those should be easy.

@weaverba137
Copy link
Member Author

PS, all of the test failures on this PR currently are due to items outside of my control.

@weaverba137
Copy link
Member Author

I solved a documentation warning issue I mentioned way back in July. All remaining documentation warnings appear to be from other packages.

The ultimate cause of the warning issue was that automodapi creates a certain header hierarchy (i.e. underline style), and the rest of your document has to be consistent with that, otherwise you get a warning about underlining that doesn't even appear in your document. Once you adjust the underlining to match automodapi the warning goes away.

@bsipocz
Copy link
Member

bsipocz commented Jan 15, 2026

I haven't tried to run the docs build locally, but these failures look familiar. I would recommend rebasing the whole PR on top of the current main and suspect it may just solve it out of the box.

@bsipocz
Copy link
Member

bsipocz commented Jan 15, 2026

RTD is known to fail and will be fixed separately.

@weaverba137
Copy link
Member Author

RTD is known to fail and will be fixed separately.

Thanx. I had already done a recent merge with main.

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