Skip to content

Commit d4787d0

Browse files
Jorge Fernandez HernandezJorge Fernandez Hernandez
authored andcommitted
EUCLIDMNGT-1449 fix comments from the PR
1 parent 0d351b5 commit d4787d0

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

astroquery/esa/euclid/core.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(self, *, environment='PDR', tap_plus_conn_handler=None, datalink_ha
118118
self.get_status_messages()
119119

120120
def cross_match_basic(self, *, table_a_full_qualified_name, table_a_column_ra, table_a_column_dec,
121-
table_b_full_qualified_name='', table_b_column_ra='', table_b_column_dec='',
121+
table_b_full_qualified_name=None, table_b_column_ra=None, table_b_column_dec=None,
122122
results_name=None,
123123
radius=1.0, background=False, verbose=False):
124124
"""Performs a positional cross-match between the specified tables.
@@ -131,7 +131,7 @@ def cross_match_basic(self, *, table_a_full_qualified_name, table_a_column_ra, t
131131
132132
The result is a join table with the identifies of both tables and the distance (degrees), that is returned
133133
without metadata units. If desired, units can be added using the Units package of Astropy as follows:
134-
results[‘separation’].unit = u.degree. To speed up the cross-match, pass the biggest table to the
134+
``results[‘separation’].unit = u.degree``. To speed up the cross-match, pass the biggest table to the
135135
``table_b_full_qualified_name`` parameter.
136136
TAP+ only
137137
@@ -176,10 +176,13 @@ def cross_match_basic(self, *, table_a_full_qualified_name, table_a_column_ra, t
176176
if not schema_a:
177177
raise ValueError(f"Schema name is empty in full qualified table: '{table_a_full_qualified_name}'")
178178

179-
if not table_b_full_qualified_name:
179+
if table_b_full_qualified_name is None:
180180
table_b_full_qualified_name = self.main_table
181181
table_b_column_ra = self.main_table_ra
182182
table_b_column_dec = self.main_table_dec
183+
else:
184+
if table_b_column_ra is None or table_b_column_dec is None:
185+
raise ValueError(f"Invalid ra or dec column names: '{table_b_column_ra}' and '{table_b_column_dec}'")
183186

184187
schema_b = self.__get_schema_name(table_b_full_qualified_name)
185188
if not schema_b:
@@ -252,11 +255,8 @@ def __get_table_metadata(self, full_qualified_table_name, verbose):
252255
"""
253256
Get the table metadata for the input table
254257
"""
255-
try:
256-
table_metadata = self.load_table(table=full_qualified_table_name, verbose=verbose)
257-
except Exception:
258-
raise ValueError(f"Not found table '{full_qualified_table_name}' in the archive")
259-
return table_metadata
258+
259+
return self.load_table(table=full_qualified_table_name, verbose=verbose)
260260

261261
def __get_schema_name(self, full_qualified_table_name):
262262
"""

astroquery/esa/euclid/tests/test_euclidtap.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ def update_user_table(self, table_name, list_of_changes, verbose):
13461346
monkeypatch.setattr(Tap, "load_table", load_table_monkeypatched)
13471347
monkeypatch.setattr(TapPlus, "update_user_table", update_user_table)
13481348

1349-
error_message = "Not found table 'user_hola.tableA' in the archive"
1349+
error_message = "Not found schema name in full qualified table: 'user_hola.tableA'"
13501350
with pytest.raises(ValueError, match=error_message):
13511351
euclid.cross_match_basic(table_a_full_qualified_name="user_hola.tableA", table_a_column_ra="ra",
13521352
table_a_column_dec="dec", background=True)
@@ -1363,14 +1363,22 @@ def update_user_table(self, table_name, list_of_changes, verbose):
13631363
table_a_column_dec="dec")
13641364

13651365
error_message = "Not found schema name in full qualified table: 'hola'"
1366+
with pytest.raises(ValueError, match=error_message):
1367+
euclid.cross_match_basic(table_a_full_qualified_name="schema.table_name", table_a_column_ra="ra",
1368+
table_a_column_dec="dec", table_b_full_qualified_name="hola", table_b_column_ra="ra",
1369+
table_b_column_dec="dec")
1370+
1371+
error_message = "Invalid ra or dec column names: 'None' and 'None'"
13661372
with pytest.raises(ValueError, match=error_message):
13671373
euclid.cross_match_basic(table_a_full_qualified_name="schema.table_name", table_a_column_ra="ra",
13681374
table_a_column_dec="dec", table_b_full_qualified_name="hola")
13691375

13701376
error_message = "Schema name is empty in full qualified table: '.table_name'"
13711377
with pytest.raises(ValueError, match=error_message):
13721378
euclid.cross_match_basic(table_a_full_qualified_name="schema.table_name", table_a_column_ra="ra",
1373-
table_a_column_dec="dec", table_b_full_qualified_name=".table_name")
1379+
table_a_column_dec="dec", table_b_full_qualified_name=".table_name",
1380+
table_b_column_ra="ra",
1381+
table_b_column_dec="dec")
13741382

13751383
error_message = "Invalid radius value. Found 50.0 arcsec, valid range is: 0.1 to 10.0"
13761384
with pytest.raises(ValueError, match=error_message):

0 commit comments

Comments
 (0)