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

filtered_upload_wrapper(filename, filter_func=None, filter_args=None, *args, **kwargs)

Wrapper around upload_file() which filters the given file based on a specified filter function. Main use for this is a computationally heavy filter function, like counting number of sources locally, and only uploading if not enough are detected.

Parameters:
  • filename (str) – File to be uploaded. See upload_file().

  • filter_func (Callable) – Predicate filter function which takes in the filename and optionally some argument (filter_args).

  • filter_args (List) – Arguments which are to be passed to the filter function.

  • args (other arguments) – Directly passed to upload_file()

  • kwargs (keyword arguments) – Directly passed to upload_file()

Returns:

Job or None – Will be the job of the resulting upload (see upload_file()), or None when filter_func evaluated to False.

Return type:

astrometry_net_client.statusables.Job, 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, filter_func=None, filter_args=None, workers=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.

  • workers (int, optional) – A positive integer, controlling the amount of workers to use for the processing. Will not exceed the value of MAX_WORKERS.

  • filter_func (Callable) – Predicate filter function which takes in the filename and optionally some argument (filter_args).

  • filter_args (List) – Arguments which are to be passed to the filter function.

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