Skip to content

Commit cdba705

Browse files
committed
fix: adding a list of fluxes with the notation flux(U)
1 parent b005fc9 commit cdba705

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jplspec
1919

2020
- minor improvement to lookuptable behavior [#3173,#2901]
2121

22+
simbad
23+
^^^^^^
24+
25+
- Fixed adding a list of fluxes with the deprecated notation
26+
``Simbad.add_votable_fields("flux(U)", "flux(J)")`` [#3186]
27+
2228

2329
Infrastructure, Utility and Other Changes and Additions
2430
-------------------------------------------------------

astroquery/simbad/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,15 +382,17 @@ def add_votable_fields(self, *args):
382382
# the legacy way of adding fluxes
383383
args = list(args)
384384
fluxes_to_add = []
385-
for arg in args:
385+
args_copy = args.copy()
386+
for arg in args_copy:
386387
if arg.startswith("flux_"):
387388
raise ValueError("The votable fields 'flux_***(filtername)' are removed and replaced "
388389
"by 'flux' that will add all information for every filters. "
389390
"See section on filters in "
390391
"https://astroquery.readthedocs.io/en/latest/simbad/simbad_evolution.html"
391392
" to see the new ways to interact with SIMBAD's fluxes.")
392393
if re.match(r"^flux.*\(.+\)$", arg):
393-
warnings.warn("The notation 'flux(U)' is deprecated since 0.4.8 in favor of 'U'. "
394+
warnings.warn("The notation 'flux(XXX)' is deprecated since 0.4.8 in favor of 'XXX'. "
395+
"You will see the column appearing with its new name in the output. "
394396
"See section on filters in "
395397
"https://astroquery.readthedocs.io/en/latest/simbad/simbad_evolution.html "
396398
"to see the new ways to interact with SIMBAD's fluxes.", DeprecationWarning, stacklevel=2)

astroquery/simbad/tests/test_simbad.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def test_add_votable_fields():
265265
simbad_instance = simbad.SimbadClass()
266266
with pytest.raises(ValueError, match=r"The votable fields \'flux_\*\*\*\(filtername\)\' are removed *"):
267267
simbad_instance.add_votable_fields("flux_error(u)")
268-
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(U\)\' is deprecated since 0.4.8 *"):
268+
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(XXX\)\' is deprecated since 0.4.8 *"):
269269
simbad_instance.add_votable_fields("flux(u)")
270270
assert "u_" in str(simbad_instance.columns_in_output)
271271
with pytest.raises(ValueError, match="Coordinates conversion and formatting is no longer supported*"):
@@ -284,6 +284,16 @@ def test_add_votable_fields():
284284
# bundles and tables require a connection to the tap_schema and are thus tested in test_simbad_remote
285285

286286

287+
@pytest.mark.usefixtures("_mock_simbad_class")
288+
@pytest.mark.usefixtures("_mock_basic_columns")
289+
@pytest.mark.usefixtures("_mock_linked_to_basic")
290+
def test_add_list_of_fluxes():
291+
# regression test for https://github.com/astropy/astroquery/issues/3185#issuecomment-2599191953
292+
simbad_instance = simbad.Simbad()
293+
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(XXX\)\' is deprecated since 0.4.8 *"):
294+
simbad_instance.add_votable_fields("flux(U)", "flux(J)")
295+
296+
287297
def test_list_wildcards(capsys):
288298
simbad.SimbadClass.list_wildcards()
289299
wildcards = capsys.readouterr()

0 commit comments

Comments
 (0)