@@ -199,7 +199,7 @@ def _validate_settings(self, settings):
199
199
'values for {}' .format (scale_type , required_keys ))
200
200
201
201
def monitor_submission (self , submission_id , * ,
202
- solve_timeout = TIMEOUT , verbose = True ):
202
+ solve_timeout = TIMEOUT , verbose = True , return_submission_id = False ):
203
203
"""
204
204
Monitor the submission for completion.
205
205
@@ -212,15 +212,19 @@ def monitor_submission(self, submission_id, *,
212
212
Time, in seconds, to wait for the astrometry.net solver to find
213
213
a solution.
214
214
verbose : bool, optional
215
- Whether to print out information about the solving
215
+ Whether to print out information about the solving.
216
+ return_submission_id : bool, optional
217
+ Whether to return the Submission ID number.
216
218
217
219
Returns
218
220
-------
219
221
220
- None or `astropy.io.fits.Header`
222
+ None or `~ astropy.io.fits.Header` or (`~astropy.io.fits.Header`, str)
221
223
The contents of the returned object depend on whether the solve
222
224
succeeds or fails. If the solve succeeds the header with
223
- the WCS solution generated by astrometry.net is returned. If the solve
225
+ the WCS solution generated by astrometry.net is returned. A tuple
226
+ containing WCS solution and Submission ID is return if the
227
+ return_submission_id parameter is set True. If the solve
224
228
fails then an empty dictionary is returned. See below for the outcome
225
229
if the solve times out.
226
230
@@ -268,11 +272,15 @@ def monitor_submission(self, submission_id, *,
268
272
else :
269
273
# Try to future-proof a little bit
270
274
raise RuntimeError ('Unrecognized status {}' .format (status ))
271
- return wcs
275
+ if return_submission_id is False :
276
+ return wcs
277
+ else :
278
+ return (wcs , submission_id )
272
279
273
280
def solve_from_source_list (self , x , y , image_width , image_height , * ,
274
281
solve_timeout = TIMEOUT ,
275
282
verbose = True ,
283
+ return_submission_id = False ,
276
284
** settings
277
285
):
278
286
"""
@@ -293,7 +301,9 @@ def solve_from_source_list(self, x, y, image_width, image_height, *,
293
301
Time, in seconds, to wait for the astrometry.net solver to find
294
302
a solution.
295
303
verbose : bool, optional
296
- Whether to print out information about the solving
304
+ Whether to print out information about the solving.
305
+ return_submission_id : bool, optional
306
+ Whether to return the Submission ID number.
297
307
298
308
For a list of the remaining settings, use the method
299
309
`~AstrometryNetClass.show_allowed_settings`.
@@ -318,14 +328,16 @@ def solve_from_source_list(self, x, y, image_width, image_height, *,
318
328
submission_id = response_d ['subid' ]
319
329
return self .monitor_submission (submission_id ,
320
330
solve_timeout = solve_timeout ,
321
- verbose = verbose )
331
+ verbose = verbose ,
332
+ return_submission_id = return_submission_id )
322
333
323
334
def solve_from_image (self , image_file_path , * , force_image_upload = False ,
324
335
ra_key = None , dec_key = None ,
325
336
ra_dec_units = None ,
326
337
fwhm = 3 , detect_threshold = 5 ,
327
338
solve_timeout = TIMEOUT ,
328
339
verbose = True ,
340
+ return_submission_id = False ,
329
341
** settings ):
330
342
"""
331
343
Plate solve from an image, either by uploading the image to
@@ -367,7 +379,10 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False,
367
379
a solution.
368
380
369
381
verbose : bool, optional
370
- Whether to print out information about the solving
382
+ Whether to print out information about the solving.
383
+
384
+ return_submission_id : bool, optional
385
+ Whether to return the Submission ID number.
371
386
372
387
For a list of the remaining settings, use the method
373
388
`~AstrometryNetClass.show_allowed_settings`.
@@ -432,14 +447,16 @@ def solve_from_image(self, image_file_path, *, force_image_upload=False,
432
447
ccd .header ['naxis2' ],
433
448
solve_timeout = solve_timeout ,
434
449
verbose = verbose ,
450
+ return_submission_id = return_submission_id ,
435
451
** settings )
436
452
if response .status_code != 200 :
437
453
raise RuntimeError ('Post of job failed' )
438
454
response_d = response .json ()
439
455
submission_id = response_d ['subid' ]
440
456
return self .monitor_submission (submission_id ,
441
457
solve_timeout = solve_timeout ,
442
- verbose = verbose )
458
+ verbose = verbose ,
459
+ return_submission_id = return_submission_id )
443
460
444
461
445
462
# the default tool for users to interact with is an instance of the Class
0 commit comments