Skip to main content

parse_metakernel()

Parse a SPICE metakernel (.tm) file from a local path, without needing a database.

Usage

Source

parse_metakernel(path)

Handles multiple \begindata / \begintext blocks as the SPICE specification describes.

Parameters

path: str | Path
The .tm file.

Returns

ParsedMetakernel
The parsed PATH_VALUES, PATH_SYMBOLS and KERNELS_TO_LOAD, with the header. source_path is the absolute path of the file.

Raises

FileNotFoundError
path does not exist.

Examples

>>> from spice_kernel_db import parse_metakernel
>>> mk = parse_metakernel("demo.tm")  # a file with the two kernels of the next example
>>> mk.symbol_map

{‘KERNELS’: ‘/data/kernels’}

>>> mk.kernel_filenames()

[‘naif0012.tls’, ‘jup365.bsp’]