read_basic_metadata_from_file¶
- astro_metadata_translator.file_helpers.read_basic_metadata_from_file(file: str, hdrnum: int, errstream: ~typing.IO = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, can_raise: bool = True) MutableMapping[str, Any] | None ¶
Read a raw header from a file, merging if necessary.
- Parameters:
- file
str
Name of file to read. Can be FITS or YAML. YAML 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.
- errstream
io.StringIO
, optional Stream to send messages that would normally be sent to standard error. Defaults to
sys.stderr
. Only used if exceptions are disabled.- can_raise
bool
, optional Indicate whether the function can raise an exception (default) or should return
None
on error. Can still raise if an unexpected error is encountered.
- file
- Returns: