Skip to content

Commit f6342a3

Browse files
committed
Operational URLs included
1 parent 11c2ddf commit f6342a3

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

astroquery/esa/jwst/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class Conf(_config.ConfigNamespace):
2323
Configuration parameters for `astroquery.esa.jwst`.
2424
"""
2525

26-
JWST_TAP_SERVER = _config.ConfigItem("http://jwstdummytap.com", "eJWST TAP Server")
27-
JWST_DATA_SERVER = _config.ConfigItem("http://jwstdummydata.com", "eJWST Data Server")
26+
JWST_TAP_SERVER = _config.ConfigItem("https://jwst.esac.esa.int/server/tap", "eJWST TAP Server")
27+
JWST_DATA_SERVER = _config.ConfigItem("https://jwst.esac.esa.int/server/data?", "eJWST Data Server")
2828
JWST_TOKEN = _config.ConfigItem("jwstToken", "eJWST token")
2929
JWST_MESSAGES = _config.ConfigItem("notification?action=GetNotifications", "eJWST Messages")
3030

astroquery/esa/jwst/core.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import gzip
1313
import os
1414
import shutil
15+
import sys
1516
import tarfile
1617
import zipfile
1718
from builtins import isinstance
@@ -41,7 +42,6 @@ class JwstClass(BaseQuery):
4142

4243
"""
4344
Proxy class to default TapPlus object (pointing to JWST Archive)
44-
THIS MODULE IS NOT OPERATIVE YET. METHODS WILL NOT WORK UNTIL eJWST ARCHIVE IS OFFICIALLY RELEASED
4545
"""
4646

4747
JWST_DEFAULT_COLUMNS = ['observationid', 'calibrationlevel', 'public',
@@ -58,7 +58,7 @@ class JwstClass(BaseQuery):
5858
CAL_LEVELS = ['ALL', 1, 2, 3, -1]
5959
REQUESTED_OBSERVATION_ID = "Missing required argument: 'observation_id'"
6060

61-
def __init__(self, *, tap_plus_handler=None, data_handler=None):
61+
def __init__(self, *, tap_plus_handler=None, data_handler=None, show_messages=True):
6262
if tap_plus_handler is None:
6363
self.__jwsttap = TapPlus(url=conf.JWST_TAP_SERVER,
6464
data_context='data')
@@ -70,7 +70,9 @@ def __init__(self, *, tap_plus_handler=None, data_handler=None):
7070
base_url=conf.JWST_DATA_SERVER)
7171
else:
7272
self.__jwstdata = data_handler
73-
print("THIS MODULE IS NOT OPERATIVE YET. METHODS WILL NOT WORK UNTIL eJWST ARCHIVE IS OFFICIALLY RELEASED")
73+
74+
if show_messages:
75+
self.get_status_messages()
7476

7577
def load_tables(self, *, only_names=False, include_shared_tables=False,
7678
verbose=False):
@@ -1239,4 +1241,7 @@ def get_decoded_string(str):
12391241
return str
12401242

12411243

1242-
Jwst = JwstClass()
1244+
if "pytest" in sys.modules:
1245+
Jwst = JwstClass(show_messages=False)
1246+
else:
1247+
Jwst = JwstClass()

astroquery/esa/jwst/tests/test_jwstdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TestData:
4040

4141
def test_get_product(self):
4242
dummyTapHandler = DummyTapHandler()
43-
jwst = JwstClass(tap_plus_handler=dummyTapHandler)
43+
jwst = JwstClass(tap_plus_handler=dummyTapHandler, show_messages=False)
4444
# default parameters
4545
parameters = {}
4646
parameters['artifact_id'] = None

astroquery/esa/jwst/tests/test_jwsttap.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class TestTap:
8585

8686
def test_load_tables(self):
8787
dummyTapHandler = DummyTapHandler()
88-
tap = JwstClass(tap_plus_handler=dummyTapHandler)
88+
tap = JwstClass(tap_plus_handler=dummyTapHandler, show_messages=False)
8989
# default parameters
9090
parameters = {}
9191
parameters['only_names'] = False
@@ -104,7 +104,7 @@ def test_load_tables(self):
104104

105105
def test_load_table(self):
106106
dummyTapHandler = DummyTapHandler()
107-
tap = JwstClass(tap_plus_handler=dummyTapHandler)
107+
tap = JwstClass(tap_plus_handler=dummyTapHandler, show_messages=False)
108108
# default parameters
109109
parameters = {}
110110
parameters['table'] = 'table'
@@ -121,7 +121,7 @@ def test_load_table(self):
121121

122122
def test_launch_sync_job(self):
123123
dummyTapHandler = DummyTapHandler()
124-
tap = JwstClass(tap_plus_handler=dummyTapHandler)
124+
tap = JwstClass(tap_plus_handler=dummyTapHandler, show_messages=False)
125125
query = "query"
126126
# default parameters
127127
parameters = {}
@@ -164,7 +164,7 @@ def test_launch_sync_job(self):
164164

165165
def test_launch_async_job(self):
166166
dummyTapHandler = DummyTapHandler()
167-
tap = JwstClass(tap_plus_handler=dummyTapHandler)
167+
tap = JwstClass(tap_plus_handler=dummyTapHandler, show_messages=False)
168168
query = "query"
169169
# default parameters
170170
parameters = {}
@@ -212,7 +212,7 @@ def test_launch_async_job(self):
212212

213213
def test_list_async_jobs(self):
214214
dummyTapHandler = DummyTapHandler()
215-
tap = JwstClass(tap_plus_handler=dummyTapHandler)
215+
tap = JwstClass(tap_plus_handler=dummyTapHandler, show_messages=False)
216216
# default parameters
217217
parameters = {}
218218
parameters['verbose'] = False
@@ -227,7 +227,7 @@ def test_list_async_jobs(self):
227227
def test_query_region(self):
228228
connHandler = DummyConnHandler()
229229
tapplus = TapPlus("http://test:1111/tap", connhandler=connHandler)
230-
tap = JwstClass(tap_plus_handler=tapplus)
230+
tap = JwstClass(tap_plus_handler=tapplus, show_messages=False)
231231

232232
# Launch response: we use default response because the
233233
# query contains decimals
@@ -367,7 +367,7 @@ def test_query_region(self):
367367
def test_query_region_async(self):
368368
connHandler = DummyConnHandler()
369369
tapplus = TapPlus("http://test:1111/tap", connhandler=connHandler)
370-
tap = JwstClass(tap_plus_handler=tapplus)
370+
tap = JwstClass(tap_plus_handler=tapplus, show_messages=False)
371371
jobid = '12345'
372372
# Launch response
373373
responseLaunchJob = DummyResponse()
@@ -456,7 +456,7 @@ def test_query_region_async(self):
456456
def test_cone_search_sync(self):
457457
connHandler = DummyConnHandler()
458458
tapplus = TapPlus("http://test:1111/tap", connhandler=connHandler)
459-
tap = JwstClass(tap_plus_handler=tapplus)
459+
tap = JwstClass(tap_plus_handler=tapplus, show_messages=False)
460460
# Launch response: we use default response because the
461461
# query contains decimals
462462
responseLaunchJob = DummyResponse()
@@ -548,7 +548,7 @@ def test_cone_search_sync(self):
548548
def test_cone_search_async(self):
549549
connHandler = DummyConnHandler()
550550
tapplus = TapPlus("http://test:1111/tap", connhandler=connHandler)
551-
tap = JwstClass(tap_plus_handler=tapplus)
551+
tap = JwstClass(tap_plus_handler=tapplus, show_messages=False)
552552
jobid = '12345'
553553
# Launch response
554554
responseLaunchJob = DummyResponse()
@@ -618,7 +618,7 @@ def test_cone_search_async(self):
618618

619619
def test_get_product_by_artifactid(self):
620620
dummyTapHandler = DummyTapHandler()
621-
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler)
621+
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler, show_messages=False)
622622
# default parameters
623623
with pytest.raises(ValueError) as err:
624624
jwst.get_product()
@@ -642,7 +642,7 @@ def test_get_product_by_artifactid(self):
642642

643643
def test_get_product_by_filename(self):
644644
dummyTapHandler = DummyTapHandler()
645-
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler)
645+
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler, show_messages=False)
646646
# default parameters
647647
with pytest.raises(ValueError) as err:
648648
jwst.get_product()
@@ -666,7 +666,7 @@ def test_get_product_by_filename(self):
666666

667667
def test_get_products_list(self):
668668
dummyTapHandler = DummyTapHandler()
669-
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler)
669+
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler, show_messages=False)
670670
# default parameters
671671
with pytest.raises(ValueError) as err:
672672
jwst.get_product_list()
@@ -700,7 +700,7 @@ def test_get_products_list(self):
700700

701701
def test_get_obs_products(self):
702702
dummyTapHandler = DummyTapHandler()
703-
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler)
703+
jwst = JwstClass(tap_plus_handler=dummyTapHandler, data_handler=dummyTapHandler, show_messages=False)
704704
# default parameters
705705
with pytest.raises(ValueError) as err:
706706
jwst.get_obs_products()
@@ -925,7 +925,7 @@ def __check_extracted_files(self, files_expected, files_returned):
925925
raise ValueError(f"Not found expected file: {f}")
926926

927927
def test_query_target_error(self):
928-
jwst = JwstClass()
928+
jwst = JwstClass(show_messages=False)
929929
simbad = Simbad()
930930
ned = Ned()
931931
vizier = Vizier()
@@ -955,16 +955,16 @@ def test_query_target_error(self):
955955

956956
# coordinate_error = 'coordinate must be either a string or astropy.coordinates'
957957
with pytest.raises(ValueError) as err:
958-
jwst.query_target(target_name="M1", target_resolver="SIMBAD",
958+
jwst.query_target(target_name="test", target_resolver="SIMBAD",
959959
radius=units.Quantity(5, units.deg))
960960
assert 'This target name cannot be determined with this resolver: SIMBAD' in err.value.args[0]
961961

962962
with pytest.raises(ValueError) as err:
963-
jwst.query_target(target_name="M1", target_resolver="NED",
963+
jwst.query_target(target_name="test", target_resolver="NED",
964964
radius=units.Quantity(5, units.deg))
965965
assert 'This target name cannot be determined with this resolver: NED' in err.value.args[0]
966966

967967
with pytest.raises(ValueError) as err:
968-
jwst.query_target(target_name="M1", target_resolver="VIZIER",
968+
jwst.query_target(target_name="test", target_resolver="VIZIER",
969969
radius=units.Quantity(5, units.deg))
970970
assert 'This target name cannot be determined with this resolver: VIZIER' in err.value.args[0]

0 commit comments

Comments
 (0)