Catalog.load_extension#
- Catalog.load_extension(name_or_path: str | Path | UPath, columns: str | list[str] | None = None, storage_options: dict | None = None) Catalog[source]#
Load an extension of the catalog.
An extension holds additional columns for the rows of a catalog, stored apart from it. It is described by an
<extension>.propertiesfile, which defines the columns to join on. An extension listed in the catalog’s collection (see all_extensions) can be loaded by its name; any other extension is loaded by the path to its<extension>.propertiesfile.The extension is joined with Catalog.join, in the join style that the extension specifies: rows of the catalog with no extension data are kept, with missing values, when it is “left” (the default), and dropped when it is “inner”.
The loaded extensions are listed in extensions.
- Parameters:
- name_or_pathstr or path-like
The name of an extension in the catalog’s collection, or else the path to the
<extension>.propertiesfile of an extension.- columnslist[str] or str or None, default None
The extension columns to load, which may name nested subcolumns (e.g.
"lc.mag"). The column to join on is added when missing. Defaults to the default columns of the extension’s data, or all of its columns if it has none. To load all of its columns, use columns=”all”.- storage_optionsdict or None, default None
Additional options to connect to an extension loaded by path. They are not used to load an extension by name, which uses the storage options of the catalog’s collection.
- Returns:
- Catalog
A new catalog with the extension columns added.
- Raises:
- FileNotFoundError
If name_or_path is neither the name of an extension in the catalog’s collection nor the path to a HATS extension.
- ValueError
If name_or_path does not define an extension, or if the extension is already loaded.
Notes
The current implementation leans on the default Catalog.join behavior and, therefore, the resulting Catalog has no margins. When performing cross-catalog operations with an extended catalog, use it as the left-side of the operation whenever possible.