sndata.utils.data_parsing

The data_parsing module provides file parsing tools for any file formats used by multiple astronomical surveys and / or data releases. It is also responsible for locating and registering data located on the local machine.

sndata.utils.data_parsing.find_data_dir(survey_abbrev: str, release: str) → pathlib.Path[source]

Determine the directory where data files are stored for a data release

If the directory does not exist, create it.

Parameters:
  • survey_abbrev – Abbreviation of the survey to load data for (e.g., CSP)
  • release – Name of the data release from the survey (e.g., DR1)
Returns:

The path of the directory where

sndata.utils.data_parsing.parse_vizier_table_descriptions(readme_path: Union[pathlib.Path, str])[source]

Returns the table descriptions from a vizier readme file

Parameters:readme_path – Path of the file to read
Returns:<Table description (str)>}
Return type:A dictionary {<Table number (int)>
sndata.utils.data_parsing.register_filter_file(file_path: str, filter_name: str, force: bool = False)[source]

Registers filter profiles with sncosmo if not already registered

Assumes the file at file_path is a two column, white space delimited ascii table.

Parameters:
  • file_path – Path of ascii table with wavelength (Ang) and transmission
  • filter_name – The name of the registered filter.
  • force – Whether to re-register a band if already registered
sndata.utils.data_parsing.require_data_path(*data_dirs)[source]

Raise NoDownloadedData exception if given paths don’t exist

Parameters:*data_dirs – Path objects to check exists