File tree Expand file tree Collapse file tree 4 files changed +47
-3
lines changed Expand file tree Collapse file tree 4 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,9 @@ def get_hap_hst_link(self, observation_id):
148
148
if observation_id is None :
149
149
raise ValueError (self .REQUESTED_OBSERVATION_ID )
150
150
observation_type = self .get_observation_type (observation_id )
151
-
152
- if 'HAP' in observation_type :
151
+ if 'Composite' in observation_type :
152
+ raise ValueError ("HAP-HST link is only available for simple observations. Input observation is Composite." )
153
+ elif 'HAP' in observation_type :
153
154
oids = self ._select_members (observation_id )
154
155
elif 'HST' in observation_type :
155
156
query = f"select observation_id from ehst.observation where obs_type='HAP Simple' and members like '%{ observation_id } %'"
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ class MockResponse:
73
73
def pformat ():
74
74
return True
75
75
76
+
76
77
class TestESAHubble :
77
78
78
79
def get_dummy_tap_handler (self ):
@@ -570,6 +571,14 @@ def test_get_hap_hst_link_attributeerror(self):
570
571
dummy_obs_id = None
571
572
ehst .get_hap_hst_link (dummy_obs_id )
572
573
574
+ @patch .object (ESAHubbleClass , 'get_observation_type' )
575
+ def test_get_hap_hst_link_compositeerror (self , mock_observation_type ):
576
+ with pytest .raises (ValueError ):
577
+ mock_observation_type .return_value = "HAP Composite"
578
+ ehst = ESAHubbleClass (self .get_dummy_tap_handler ())
579
+ dummy_obs_id = "1234"
580
+ ehst .get_hap_hst_link (dummy_obs_id )
581
+
573
582
@patch .object (ESAHubbleClass , '_select_members' )
574
583
@patch .object (ESAHubbleClass , 'get_observation_type' )
575
584
def test_get_member_observations_composite (self , mock_observation_type , mock_select_members ):
Original file line number Diff line number Diff line change @@ -115,10 +115,11 @@ def test_hst_simple_to_hap_simple(self):
115
115
result = esa_hubble .get_hap_hst_link ('jec071i9q' )
116
116
assert result == ['hst_16316_71_acs_sbc_f150lp_jec071i9' ]
117
117
118
+
118
119
"""
119
120
def test_query_target(self):
120
121
temp_file = self.temp_folder.name + "/" + "m31_query.xml"
121
- table = esa_hubble.query_target("m31 ", temp_file)
122
+ table = esa_hubble.query_target("m3 ", temp_file)
122
123
assert os.path.exists(temp_file)
123
124
assert 'OBSERVATION_ID' in table.columns
124
125
"""
Original file line number Diff line number Diff line change @@ -339,6 +339,39 @@ votable). The result of the query will be stored in the file
339
339
result.get_results() or printing it by doing print(result).
340
340
341
341
342
+ -------------------------------
343
+ 9. Getting related members of HAP and HST observations
344
+ -------------------------------
345
+
346
+ This function takes in an observation id of a Composite or Simple observation.
347
+ If the observation is Simple the method returns the Composite observation that
348
+ is built on this simple observation. If the observation is Composite then the
349
+ method returns the simple observations that make it up.
350
+
351
+ .. code-block :: python
352
+
353
+ >> > from astroquery.esa.hubble import ESAHubble
354
+ >> > esahubble = ESAHubble()
355
+ >> > result = esahubble.get_member_observations(" jdrz0c010" )
356
+ >> > print (result)
357
+
358
+
359
+ -------------------------------
360
+ 10. Getting link between Simple HAP and HST observations
361
+ -------------------------------
362
+
363
+ This function takes in an observation id of a Simple HAP or HST observation and
364
+ returns the corresponding HAP or HST observation
365
+
366
+ .. code-block :: python
367
+
368
+ >> > from astroquery.esa.hubble import ESAHubble
369
+ >> > esahubble = ESAHubble()
370
+ >> > result = esahubble.get_hap_hst_link(" hst_16316_71_acs_sbc_f150lp_jec071i9" )
371
+ >> > print (result)
372
+
373
+
374
+
342
375
Reference/API
343
376
=============
344
377
You can’t perform that action at this time.
0 commit comments