SwiftObsFinder

class gdt.missions.swift.finders.SwiftObsFinder(*args, protocol='HTTPS', **kwargs)[source]

Bases: BaseFinder

A class that interfaces with the HEASARC FTP directories. An instance of this class will represent the available files associated with a single event.

An instance can be created with an astropy Time object and an observation ID to query and download files. An instance can also be changed from one observation to another without having to create a new instance.

Parameters:
  • date (astropy.Time, optional) – A time for the observation

  • obsid (str, optional) – A valid observation ID number

Attributes Summary

cwd

files

The list of files in the current directory

num_files

Number of files in the current directory

Methods Summary

cd(*args)

Change directory

filter(filetype, extension)

Filters the directory for the requested filetype and extension

get(download_dir, files[, verbose])

Downloads a list of files from the current FTP directory.

ls(*args[, fullpath])

List the contents of a directory

Attributes Documentation

cwd
files

The list of files in the current directory

Type:

(list of str)

num_files

Number of files in the current directory

Type:

(int)

Methods Documentation

cd(*args)

Change directory

Parameters:

args (tuple) – The arguments needed to construct the remote path

filter(filetype, extension)

Filters the directory for the requested filetype and extension

Parameters:
  • filetype (str) – The type of file, e.g. ‘cspec’

  • extension (str) – The file extension, e.g. ‘.pha’

Returns:

(list)

get(download_dir: Union[str, Path], files: List[str], verbose: bool = True) List[Path]

Downloads a list of files from the current FTP directory. This function also returns a list of the downloaded file paths.

Parameters:
  • download_dir (str, Path) – The download directory location

  • files (list of str) – The list of files to download

  • verbose (bool, optional) – If True, will output the download status. Default is True.

Returns:

(list)

ls(*args, fullpath: bool = False)

List the contents of a directory

Parameters:
  • args (tuple) – The arguments needed to construct the remote path

  • fullpath (bool, optional) – If True, will list all files in the current with their full path.