BatAuxiliaryFtp

class gdt.missions.swift.bat.finders.BatAuxiliaryFtp(*args, **kwargs)[source]

Bases: BatFinder

A class that interfaces with the HEASARC FTP observation auxiliary directories. An instance of this class will represent the available files associated with an the observation.

An instance can be created with an observation ID and a date (YYYY-MM) to query and download files. An instance can also be changed from one trigger number to another without having to create a new instance. If multiple instances are created and exist simultaneously, they will all use a single FTP connection.

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

  • date (str, optional) – a date (YYYY-MM) for the observation

num_files

Number of files in the current directory

Type:

int

files

The list of files in the current directory

Type:

list of str

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.

get_all(download_dir, **kwargs)

Download all files within a data products observation.

get_sao(download_dir, *args, **kwargs)

Download the SAO file for the observation

get_sat(download_dir, *args, **kwargs)

Download SAT File for the observation

ls(*args[, fullpath])

List the contents of a directory

ls_all()

List all files for the observation

ls_sao()

List SAO file for the observation

ls_sat()

List the SAT file for the observation

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)

get_all(download_dir, **kwargs)[source]

Download all files within a data products observation.

Parameters:
  • download_dir (str) – The download directory

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

get_sao(download_dir, *args, **kwargs)[source]

Download the SAO file for the observation

Parameters:
  • download_dir (str) – The download directory

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

get_sat(download_dir, *args, **kwargs)[source]

Download SAT File for the observation

Parameters:
  • download_dir (str) – The download directory

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

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.

ls_all()[source]

List all files for the observation

Returns:

(list of str)

ls_sao()[source]

List SAO file for the observation

Returns:

(list of str)

ls_sat()[source]

List the SAT file for the observation

Returns:

(list of str)