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.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 underresponse-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 throwsNotImplementedError.verbose (
bool) – Toggle for printing verbosely. IfTrue, download progress indicators and filenames are displayed. IfFalse, 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_allflag toTrueto 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 throwsNotImplementedError.
- Returns:
A tuple describing two items (
files_to_getandfolders_to_get. These are)intended to be used by
foxsi4_download_required()to actually do the downloading.files_to_getis adictof each file that should be downloaded from the remote server. The keys in this dictionary are the file names from theinfo.yamlfile. The value for that key is anotherdict, 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_getis adictof each folder that should be downloaded from the remote server. The keys in this dictionary are the folder names from theinfo.yamlfile. The value for that key is anotherdict, 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.load_yaml module
Module containing methods to load in specific or general YAML files.