@@ -22,12 +22,9 @@ class MostClass(BaseQuery):
22
22
URL = conf .most_server
23
23
TIMEOUT = conf .timeout
24
24
25
- def __init__ (self ):
26
- super ().__init__ ()
27
-
28
25
def _validate_name_input_type (self , params ):
29
26
"""
30
- Validate required parameters when `input_type='name_input'`.
27
+ Validate required parameters when `` input_type='name_input'` `.
31
28
32
29
Parameters
33
30
----------
@@ -45,7 +42,7 @@ def _validate_name_input_type(self, params):
45
42
46
43
def _validate_nafid_input_type (self , params ):
47
44
"""
48
- Validate required parameters when `input_type='naifid_input'`.
45
+ Validate required parameters when `` input_type='naifid_input'` `.
49
46
50
47
51
48
Parameters
@@ -64,7 +61,7 @@ def _validate_nafid_input_type(self, params):
64
61
65
62
def _validate_mpc_input_type (self , params ):
66
63
"""
67
- Validate required parameters when `input_type='mpc_input'`.
64
+ Validate required parameters when `` input_type='mpc_input'` `.
68
65
69
66
Parameters
70
67
----------
@@ -88,7 +85,7 @@ def _validate_mpc_input_type(self, params):
88
85
89
86
def _validate_manual_input_type (self , params ):
90
87
"""
91
- Validate required parameters when `input_type='manual_input'`.
88
+ Validate required parameters when `` input_type='manual_input'` `.
92
89
93
90
Parameters
94
91
----------
@@ -103,9 +100,9 @@ def _validate_manual_input_type(self, params):
103
100
"""
104
101
obj_type = params .get ("obj_type" , False )
105
102
if not obj_type :
106
- raise ValueError ("When input type is 'mpc_input ' key 'obj_type' is required." )
103
+ raise ValueError ("When input type is 'manual_input ' key 'obj_type' is required." )
107
104
if obj_type not in ("Asteroid" , "Comet" ):
108
- raise ValueError ("Object type is case sensitive and must be one of: ` Asteroid` or ` Comet` " )
105
+ raise ValueError ("Object type is case sensitive and must be one of: ' Asteroid' or ' Comet' " )
109
106
110
107
# MOST will always require at least the distance and eccentricity
111
108
# distance param is named differently in cases of asteroids and comets
@@ -128,8 +125,8 @@ def _validate_input(self, params):
128
125
Validate the minimum required set of parameters, for a given input
129
126
type, are at least truthy.
130
127
131
- These include the keys `catalog`, `input_type`, `output_mode` and
132
- `ephem_step` in addition to keys required by the specified input type.
128
+ These include the keys `` catalog`` , `` input_type`` , `` output_mode` ` and
129
+ `` ephem_step` ` in addition to keys required by the specified input type.
133
130
134
131
Parameters
135
132
----------
@@ -159,13 +156,13 @@ def _validate_input(self, params):
159
156
self ._validate_manual_input_type (params )
160
157
else :
161
158
raise ValueError (
162
- "Unrecognized ` input_type` . Expected `name_input`, `nafid_input` "
159
+ "Unrecognized ' input_type' . Expected `name_input`, `nafid_input` "
163
160
f"`mpc_input` or `manual_input`, got { input_type } instead."
164
161
)
165
162
166
163
def _parse_full_regular_response (self , response , withTarballs = False ):
167
164
"""
168
- Parses the response when output type is set to `Regular` or `Full`.
165
+ Parses the response when output type is set to ``" Regular"`` or ``" Full"` `.
169
166
170
167
Parameters
171
168
----------
@@ -178,14 +175,14 @@ def _parse_full_regular_response(self, response, withTarballs=False):
178
175
Returns
179
176
-------
180
177
retdict : `dict`
181
- Dictionary containing the keys `results`, `metadata` and `region`.
182
- Optionally can contain keys `fits_tarball` and `region_tarball`.
183
- The `results` and `metadata` are an `astropy.table.Table` object
178
+ Dictionary containing the keys `` results`` , `` metadata`` and `` region` `.
179
+ Optionally can contain keys `` fits_tarball`` and `` region_tarball` `.
180
+ The `` results`` and `` metadata` ` are an `astropy.table.Table` object
184
181
containing the links to image and region files and minimum object
185
- metadata, while `metadata` contains the image metadata and object
186
- positions. The `region` key contains a link to the DS9 region file
182
+ metadata, while `` metadata` ` contains the image metadata and object
183
+ positions. The `` region` ` key contains a link to the DS9 region file
187
184
representing the matched object trajectory and search boxes. When
188
- existing, `fits_tarball` and `region_tarball` are links to the
185
+ existing, `` fits_tarball`` and `` region_tarball` ` are links to the
189
186
tarball archives of the fits and region images.
190
187
"""
191
188
retdict = {}
@@ -220,9 +217,9 @@ def list_catalogs(self):
220
217
catalog_dropdown_options = html .find ("select" ).find_all ("option" )
221
218
222
219
catalogs = [tag .string for tag in catalog_dropdown_options ]
223
- # I think I saw somewhere that some password prompt will pop up for
224
- # catalogs listed as '--- Internal use only:' but there are seemingly
225
- # no limits to queries there .
220
+
221
+ # The Internal-Use-only datasets are free to search in MOST.
222
+ # The way it is supposed to work is that the images will not be accessible .
226
223
if "--- Internal use only:" in catalogs :
227
224
catalogs .remove ("--- Internal use only:" )
228
225
return catalogs
@@ -531,8 +528,7 @@ def query_object(self, catalog="wise_merge", input_mode="name_input", output_mod
531
528
data = qparams , timeout = self .TIMEOUT )
532
529
533
530
# service unreachable or some other reason
534
- if not response .ok :
535
- raise response .raise_for_status ()
531
+ response .raise_for_status ()
536
532
537
533
# MOST will not raise an bad response if the query is bad because they
538
534
# are not a REST API
@@ -550,7 +546,7 @@ def query_object(self, catalog="wise_merge", input_mode="name_input", output_mod
550
546
matches = votable .parse (io .BytesIO (response .content ))
551
547
if matches .get_table_by_index (0 ).nrows == 0 :
552
548
warnings .warn ("Number of Matched Image Frames = 0" , NoResultsWarning )
553
- return None
549
+ return Table ()
554
550
return matches
555
551
else :
556
552
return self ._parse_full_regular_response (response , qparams ["fits_region_files" ])
0 commit comments