response_tools.io package

Subpackages

Submodules

response_tools.io.fetch_response_data module

Script to download data from FOXSI server.

class response_tools.io.fetch_response_data.DownloadPrompt[source]

Bases: object

class response_tools.io.fetch_response_data.DownloadType(*values)[source]

Bases: Enum

component = 3
file = 5
historical = 2
latest = 1
telescope = 4
response_tools.io.fetch_response_data.foxsi4_download_required(overwrite_all=False, overwrite_old=False, verbose=False)[source]

Download all response component files specified in response-information/info.yaml.

Download data products from a remote server to the local filesystem. Retrieves server URL and all local paths for saving data from a config file: response-tools/response-information/info.yaml. All downloaded response data will be saved under response-tools/response-information.

Parameters:
  • overwrite_all (bool) – Whether to just download all required files, regardless of whether they appear on the local disk or not. Use this flag if you are suspicious of the response files you have on your computer.

  • overwrite_old (bool) – Whether to replace old local files with newer versions, if new versions are available. Currently throws NotImplementedError.

  • verbose (bool) – Toggle for printing verbosely. If True, download progress indicators and filenames are displayed. If False, nothing is printed at all.

Returns:

downloaded – A dict of downloaded data. Keys are the same file identifiers from the YAML source. Values are the absolute paths on the local filesystem to the downloaded file. Files which were already existed in the local filesystem (required no downloaded) are not included in the return value.

Return type:

dict

response_tools.io.fetch_response_data.foxsi4_list_missing_response_info(overwrite_all=False, overwrite_old=False)[source]

Check which response files need downloading, according to response-information/info.yaml.

Look at all the required files in info.yaml, and see which of them are not already on the local disk.

Note

Folders will only be flagged for download if they do not exist on disk. A folder may be missing some of the needed response files, but this function will not be aware! If you suspect you are missing some data (due to an interrupted download, corruption, etc.), set the overwrite_all flag to True to pull in all fresh data.

Parameters:
  • overwrite_all (bool) – Whether to just download all required files, regardless of whether they appear on the local disk or not. Use this flag if you are suspicious of the response files you have on your computer.

  • overwrite_old (bool) – Whether to replace old local files with newer versions, if new versions are available. Currently throws NotImplementedError.

Returns:

  • A tuple describing two items (files_to_get and folders_to_get. These are)

  • intended to be used by foxsi4_download_required() to actually do the downloading.

  • files_to_get is a dict of each file that should be downloaded from the remote server. The keys in this dictionary are the file names from the info.yaml file. The value for that key is another dict, which contains the remote server path to the file (under the “remote” key) and the local disk path to save the file (under the “local” key). Like this –

    files_to_get["a_response_file_name"] == {
        "remote": "http://foxsi.space.umn.edu/data/response/response-components/attenuation-data/a_response_file.fits",
        "local":  "response-tools/response_tools/response-information/attenuation-data/a_response_file.fits"
    }
    
  • folders_to_get is a dict of each folder that should be downloaded from the remote server. The keys in this dictionary are the folder names from the info.yaml file. The value for that key is another dict, which contains the remote server path to the folder (under the “remote” key) and the local disk path to save the folder (under the “local” key). Like this –

    folders_to_get["a_response_folder_name/"] == {
        "remote": "http://foxsi.space.umn.edu/data/response/response-components/attenuation-data/a_response_folder/",
        "local":  "response-tools/response_tools/response-information/attenuation-data/a_response_folder/"
    }
    

response_tools.io.fetch_response_data.green_str(text: str)[source]
response_tools.io.fetch_response_data.print_green(txt: str)[source]
response_tools.io.fetch_response_data.print_red(txt: str)[source]

response_tools.io.load_yaml module

Module containing methods to load in specific or general YAML files.

response_tools.io.load_yaml.load_response_context()[source]

Function to load in the context information from file.

response_tools.io.load_yaml.load_yaml(filename)[source]

Function to load in a general YAML file.

Module contents