Client

Some example scripts which utulize the Client class, can be found under Examples

class astrometry_net_client.client.Client(session=None, settings=None, **kwargs)

Higher level class which makes the interaction with the API easy.

Parameters:
calibrate_file_wcs(filename, settings=None)

Uploads a file, returning the wcs header if it succeeds.

Parameters:
  • filename (str) – Location + name of the file to upload.

  • settings (astrometry_net_client.settings.Settings) – An optional settings dict which only applies to this specific upload. Will override the default settings with which the Client was constructed.

Returns:

Returns the Header if successful, None otherwise.

Return type:

astropy.io.fits.Header or None

upload_file(filename, settings=None)

Uploads file and returns completed job when finished solving.

Parameters:
  • filename (str) – Location + name of the file to upload.

  • settings (astrometry_net_client.settings.Settings) – An optional settings dict which only applies to this specific upload. Will override the default settings with which the Client was constructed.

Returns:

Job – The job of the resulting upload. NOTE: It is possible that the job did not succeed, therefore check with astrometry_net_client.statusables.Statusable.success() if it did.

Return type:

astrometry_net_client.statusables.Job

upload_files_gen(files_iter, queue_size=10)

Generator which uploads a number of files concurrently, yielding the astrometry_net_client.statusables.Job & filename when done.

Note that the files_iter argument is fully consumed when submitting to the executor is done. This means that the results will only be yielded once the iterator is consumed.

Parameters:
  • files_iter (iterable) – Some iterable containing paths to the files which will be uploaded. Is fully consumed before any result is yielded.

  • queue_size (int, optional) – A positive integer, controlling the size of the queue. This will determine the maximum number of simultaneous submissions. Must be greater than 0 and lower than MAX_WORKERS. Default is MAX_WORKERS.

Yields:

(astrometry_net_client.statusables.Job, str) – A tuple containing the finished astrometry_net_client.statusables.Job and the corresponding filename. Yields when the Job is finished. NOTE: Order of yielded filenames can (and likely will) be different from the given files_iter

Raises:

ValueError – When the queue_size is invalid.