read_file_info¶
- astro_metadata_translator.file_helpers.read_file_info(file: str, hdrnum: int, print_trace: bool | None = None, content_mode: str = 'translated', content_type: str = 'simple', outstream: IO | None = None) str | MutableMapping[str, Any] | ObservationInfo | None ¶
Read information from file.
- Parameters:
- file
str
The file from which the header is to be read.
- hdrnum
int
The HDU number to read. The primary header is always read and merged with the header from this HDU.
- print_trace
bool
orNone
If there is an error reading the file and this parameter is
True
, a full traceback of the exception will be reported. IfFalse
prints a one line summary of the error condition. IfNone
the exception will be allowed to propagate.- content_mode
str
Content returned. This can be:
metadata
to return the unfixed metadata headers;translated
to return the output from metadata translation.- content_type
str
, optional Form of content to be returned. Can be either
json
to return a JSON string,simple
to always return adict
, ornative
to return either adict
(formetadata
) orObservationInfo
fortranslated
.- outstream
io.StringIO
orNone
, optional Output stream to use for standard messages. Defaults to
None
which uses the default output stream.
- file
- Returns:
- simple
dict
ofstr
orObservationInfo
The return value of
ObservationInfo.to_simple
. ReturnsNone
if there was a problem andprint_trace
is notNone
.
- simple