-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Support case-insensitive query criteria #3087
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Observations.query_criteria
andCatalogs.query_criteria
now support case insensitivity for criteria keyword arguments. For example, the argumentobjtype
is treated the same asobjType
.