Support case-insensitive query criteria#3087
Merged
Merged
Conversation
Contributor
Author
bsipocz
requested changes
Aug 26, 2024
bsipocz
left a comment
Member
There was a problem hiding this comment.
I consistently see a new failing remote test with this compared to main, could you please have a look into it?
_________________________________________ TestMast.test_catalogs_query_region __________________________________________
self = <astroquery.mast.tests.test_mast_remote.TestMast object at 0x127c2b920>
def test_catalogs_query_region(self):
def check_result(result, row, exp_values):
assert isinstance(result, Table)
for k, v in exp_values.items():
assert result[row][k] == v
in_radius = 0.1 * u.deg
result = Catalogs.query_region("158.47924 -7.30962",
radius=in_radius,
catalog="Gaia")
row = np.where(result['source_id'] == '3774902350511581696')
check_result(result, row, {'solution_id': '1635721458409799680'})
result = Catalogs.query_region("322.49324 12.16683",
radius=0.001*u.deg,
catalog="HSC",
magtype=2)
row = np.where(result['MatchID'] == '8150896')
with pytest.warns(MaxResultsWarning):
result = Catalogs.query_region("322.49324 12.16683", catalog="HSC", magtype=2, nr=5)
check_result(result, row, {'NumImages': 14, 'TargetName': 'M15'})
result = Catalogs.query_region("322.49324 12.16683",
radius=0.001*u.deg,
catalog="HSC",
version=2,
magtype=2)
row = np.where(result['MatchID'] == '82361658')
check_result(result, row, {'NumImages': 11, 'TargetName': 'NGC7078'})
result = Catalogs.query_region("322.49324 12.16683",
radius=in_radius,
catalog="Gaia",
version=1)
row = np.where(result['source_id'] == '1745948323734098688')
check_result(result, row, {'solution_id': '1635378410781933568'})
result = Catalogs.query_region("322.49324 12.16683",
radius=0.01*u.deg,
catalog="Gaia",
version=2)
row = np.where(result['source_id'] == '1745947739618544000')
check_result(result, row, {'solution_id': '1635721458409799680'})
result = Catalogs.query_region("322.49324 12.16683",
radius=0.01*u.deg, catalog="panstarrs",
table="mean")
row = np.where((result['objName'] == 'PSO J322.4622+12.1920') & (result['yFlags'] == 16777496))
second_id = result[1]['objID']
assert isinstance(result, Table)
np.testing.assert_allclose(result[row]['distance'], 0.039381703406789904)
result = Catalogs.query_region("322.49324 12.16683",
radius=0.01*u.deg, catalog="panstarrs",
table="mean",
pagesize=1,
page=2)
assert isinstance(result, Table)
assert len(result) == 1
> assert second_id == result[0]['objID']
E assert 122603224875385592 == 122583224908139887
astroquery/mast/tests/test_mast_remote.py:700: AssertionError
=============================================== short test summary info ================================================
FAILED astroquery/mast/tests/test_mast_remote.py::TestMast::test_observations_get_cloud_uris_no_duplicates - DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use tim...
FAILED astroquery/mast/tests/test_mast_remote.py::TestMast::test_catalogs_query_region - assert 122603224875385592 == 122583224908139887
Contributor
Author
|
Huh, that is weird. As far as I can tell, it seems like the results are being returned in a variable order for Pan-STARRS (at least). I've moved the |
bsipocz
approved these changes
Aug 28, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Observations.query_criteriaandCatalogs.query_criterianow support case insensitivity for criteria keyword arguments. For example, the argumentobjtypeis treated the same asobjType.