read_basic_metadata_from_file#
- astro_metadata_translator.file_helpers.read_basic_metadata_from_file(file, hdrnum, can_raise=True)#
Read a raw header from a file, merging if necessary.
- Parameters:
file (
strorlsst.resources.ResourcePathExpression) – Name of file to read. Can be FITS, YAML or JSON. YAML or JSON must be a simple top-level dict.hdrnum (
int) – Header number to read. Only relevant for FITS. If greater than 1 it will be merged with the primary header. If a negative number is given the second header, if present, will be merged with the primary header. If there is only a primary header a negative number behaves identically to specifying 0 for the HDU number.can_raise (
bool, optional) – Indicate whether the function can raise an exception (default) or should returnNoneon error. Can still raise if an unexpected error is encountered.
- Returns:
header – The header as a dict. Can be
Noneif there was a problem reading the file.- Return type: