read_file_info¶
- astro_metadata_translator.file_helpers.read_file_info(file: ResourcePathExpression, 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
boolorNone If there is an error reading the file and this parameter is
True, a full traceback of the exception will be reported. IfFalseprints a one line summary of the error condition. IfNonethe exception will be allowed to propagate.- content_mode
str Content returned. This can be:
metadatato return the unfixed metadata headers;translatedto return the output from metadata translation.- content_type
str, optional Form of content to be returned. Can be either
jsonto return a JSON string,simpleto always return adict, ornativeto return either adict(formetadata) orObservationInfofortranslated.- outstream
io.StringIOorNone, optional Output stream to use for standard messages. Defaults to
Nonewhich uses the default output stream.
- file
- Returns:
- simple
dictofstrorObservationInfo The return value of
ObservationInfo.to_simple. ReturnsNoneif there was a problem andprint_traceis notNone.
- simple