BatDataProductsFtp

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

Bases: BatFinder

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 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(obsid, date)

Change directory to obsid number.

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_afterslew(download_dir, *args, **kwargs)

Download the after-slew for the observation

get_all(download_dir, **kwargs)

Download all files within a data products directory.

get_gti(download_dir, *args, **kwargs)

Download the good timing interval data for the observation

get_lightcurve(download_dir, *args, **kwargs)

Download the lightcurve data for the observation

get_pha(download_dir, *args, **kwargs)

Download the pha files for the observation

get_preslew(download_dir, *args, **kwargs)

Download the pre-slew files for the observation

get_response(download_dir, *args, **kwargs)

Download the response files for the observation

get_slew(download_dir, *args, **kwargs)

Download the files during slew for the observation

ls(*args[, fullpath])

List the contents of a directory

ls_afterslew()

List all after-slew files for the observation

ls_all()

List all files for the observations data products

ls_gti()

List all good timing interval data for the observation

ls_lightcurve()

List all lightcurve data for the observation

ls_pha()

List all pha files for the observation

ls_preslew()

List all pre-slew files for the observation

ls_response()

List all response files for the observation

ls_slew()

List all files during slew 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(obsid: str, date: str)[source]

Change directory to obsid number.

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

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

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_afterslew(download_dir, *args, **kwargs)[source]

Download the after-slew for the observation

Parameters:
  • download_dir (str) – The download directory

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

get_all(download_dir, **kwargs)[source]

Download all files within a data products directory.

Parameters:
  • download_dir (str) – The download directory

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

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

Download the good timing interval data for the observation

Parameters:
  • download_dir (str) – The download directory

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

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

Download the lightcurve data for the observation

Parameters:
  • download_dir (str) – The download directory

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

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

Download the pha files for the observation

Parameters:
  • download_dir (str) – The download directory

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

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

Download the pre-slew files for the observation

Parameters:
  • download_dir (str) – The download directory

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

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

Download the response files for the observation

Parameters:
  • download_dir (str) – The download directory

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

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

Download the files during slew 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_afterslew()[source]

List all after-slew files for the observation

Returns:

(list of str)

ls_all()[source]

List all files for the observations data products

Returns:

(list of str)

ls_gti()[source]

List all good timing interval data for the observation

Returns:

(list of str)

ls_lightcurve()[source]

List all lightcurve data for the observation

Returns:

(list of str)

ls_pha()[source]

List all pha files for the observation

Returns:

(list of str)

ls_preslew()[source]

List all pre-slew files for the observation

Returns:

(list of str)

ls_response()[source]

List all response files for the observation

Returns:

(list of str)

ls_slew()[source]

List all files during slew for the observation

Returns:

(list of str)